canvas.addEventHandler(MouseEvent.MOUSE_DRAGGED, new EventHandler
@Override
public void handle(MouseEvent e) {
double difX = e.getSceneX() - baseDrageX;
double difY = e.getSceneY() - baseDrageY;
baseDrageX = e.getSceneX();
baseDrageY = e.getSceneY();
DirectPosition2D newPos = new DirectPosition2D(difX, difY);
DirectPosition2D result = new DirectPosition2D();
map.getViewport().getScreenToWorld().transform(newPos, result);
ReferencedEnvelope env = new ReferencedEnvelope(map.getViewport().getBounds());
env.translate(env.getMinimum(0) - result.x, env.getMaximum(1) - result.y);
doSetDisplayArea(env);
e.consume();
}
});
/*
- double clicks to restore to original map
*/
canvas.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler() {
@Override
<网址>
<网址>
<网址>
<网址>
<网址>