public SketchDocument.Guideline newGuide;
public void call(MouseEvent mouseEvent) throws Exception {
if(mouseEvent.getType() == MouseEvent.MouseDragged) {
if(doc instanceof SketchDocument) {
SketchDocument sdoc = (SketchDocument) doc;
if(Ruler.this.vertical) {
if(mouseEvent.getPointInNodeCoords(Ruler.this).getX() > getWidth()) {
if(newGuide == null) {
newGuide = sdoc.getCurrentPage().createGuideline(0,true);
} else {
Point2D pt = mouseEvent.getPointInNodeCoords(context.getCanvas());
pt = context.getCanvas().transformToCanvas(pt);
newGuide.setPosition(pt.getX());
}
}
} else {
if(mouseEvent.getPointInNodeCoords(Ruler.this).getY() > getHeight()) {
if(newGuide == null) {
newGuide = sdoc.getCurrentPage().createGuideline(0,false);
} else {
Point2D pt = mouseEvent.getPointInNodeCoords(context.getCanvas());
pt = context.getCanvas().transformToCanvas(pt);
newGuide.setPosition(pt.getY());
}