public void drawOverlay(GFX g) {
g.push();
g.translate(context.getSketchCanvas().getPanX(),context.getSketchCanvas().getPanY());
g.scale(context.getSketchCanvas().getScale(),context.getSketchCanvas().getScale());
g.setPaint(FlatColor.RED);
Bounds bounds = shape.getBounds();
g.drawRect(bounds.getX(), bounds.getY(), bounds.getWidth(), bounds.getHeight());
FlatColor color = new FlatColor(0xff097d);
for(VHandle handle : handles) {
switch(handle.getPosition()) {
case Top:
case Bottom:
g.setPaint(color);
g.drawLine(bounds.getX(),handle.getY(),bounds.getX()+bounds.getWidth(),handle.getY());
DrawUtils.drawStandardHandle(g,bounds.getX(),handle.getY(),color);
DrawUtils.drawStandardHandle(g,bounds.getX()+bounds.getWidth(),handle.getY(),color);
break;
case Right:
case Left:
g.setPaint(color);
g.drawLine(handle.getX(),bounds.getY(),handle.getX(),bounds.getY()+bounds.getHeight());
DrawUtils.drawStandardHandle(g,handle.getX(),bounds.getY(),color);
DrawUtils.drawStandardHandle(g,handle.getX(),bounds.getY()+bounds.getHeight(),color);
break;
}
}
g.setPaint(FlatColor.GREEN);
g.translate(bounds.getX(),bounds.getY());
for(SNode node: shape.getNodes()) {
Bounds b = node.getTransformedBounds();
g.drawRect(b.getX(),b.getY(),b.getWidth(),b.getHeight());
}
g.pop();
}