+ Rectangle2D boundsInLocal = node.getBoundsInLocal();
+ ICanvasContext ctx = DiagramNodeUtil.getCanvasContext(node);
+ AffineTransform canvasTransform = ctx.getHintStack().getHint(Hints.KEY_CANVAS_TRANSFORM);
+ // for some reason PickContextImpl expands the rectangle by 0.001 (too much) - let's counter it
+ double x = boundsInLocal.getX();
+ double y = boundsInLocal.getY();
+ double scaledWidth = boundsInLocal.getWidth();
+ double scaledHeight = boundsInLocal.getHeight();
+ if (canvasTransform != null) {
+ scaledWidth = boundsInLocal.getWidth() / canvasTransform.getScaleX();
+ scaledHeight= boundsInLocal.getHeight() / canvasTransform.getScaleY();
+ }
+ double width = scaledWidth;
+ double height = scaledHeight;
+ size.setFrame(x, y, width, height);
+