return points;
}
public static PCanvas createCanvas() {
final PCanvas canvas = new PCanvas();
final PCamera camera = canvas.getCamera();
final PText tooltipNode = new PText();
tooltipNode.setPickable(false);
camera.addChild(tooltipNode);
camera.addInputEventListener(new PBasicInputEventHandler() {
public void mouseMoved(final PInputEvent event) {
updateToolTip(event);
}
public void mouseDragged(final PInputEvent event) {
updateToolTip(event);
}
public void updateToolTip(final PInputEvent event) {
final PNode n = event.getPickedNode();
final Object object = (Object) n.getAttribute("tooltip");
if (object != null) {
final String tooltipString = object.toString();
final Point2D p = event.getCanvasPosition();
event.getPath().canvasToLocal(p, camera);
tooltipNode.setText(tooltipString);
tooltipNode.setOffset(p.getX() + 8, p.getY() - 8);
} else {
tooltipNode.setText(null);
}
}
});
// uninstall default zoom event handler
canvas.removeInputEventListener(canvas.getZoomEventHandler());
// install mouse wheel zoom event handler
final PMouseWheelZoomEventHandler mouseWheelZoomEventHandler = new PMouseWheelZoomEventHandler();
canvas.addInputEventListener(mouseWheelZoomEventHandler);
return canvas;
}