hL.endXProperty().bind(localRadius.multiply(2));
// Adding all parts in a container.
mainContent.getChildren().addAll(frame, viewer, vL, hL);
final Popup popUp = new Popup();
popUp.getContent().add(mainContent);
final EventHandler<MouseEvent> enteredEvent = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
popUp.show(getSkinnable(), e.getScreenX() - shift, e.getScreenY() - shift);
takeSnap(e.getX(), e.getY());
}
};
final EventHandler<MouseEvent> exitedEvent = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
popUp.hide();
}
};
final EventHandler<MouseEvent> movedEvent = new EventHandler<MouseEvent>() {
@Override
public void handle(MouseEvent e) {
final double r = localRadius.get();
final double s = localScaleFactor.get();
if (e.getSceneX() > (scene.getWidth() - (2 * r))) {
popUp.setX(e.getScreenX() - (2 * r) - shift);
} else {
popUp.setX(e.getScreenX() - shift);
}
if (e.getSceneY() > (scene.getHeight() - (2 * r))) {
popUp.setY(e.getScreenY() - (2 * r) - shift);
} else {
popUp.setY(e.getScreenY() - shift);
}
prevX.set(e.getX());
prevY.set(e.getY());
shiftViewerContent(prevX.get(), prevY.get(), r, s);
}