/**
  * Returns a {@link Rectangle} representing the visual bounds of the given {@link IContentPart}
  * within the coordinate system of the {@link Scene}.
  *
  * @param contentPart The {@link IContentPart} of which the visual bounds are computed.
  * @return A {@link Rectangle} representing the visual bounds of the given {@link IContentPart}
  *     within the coordinate system of the {@link Scene}.
  */
 protected Rectangle getVisualBounds(IContentPart<Node, ? extends Node> contentPart) {
   if (contentPart == null) {
     throw new IllegalArgumentException("contentPart may not be null!");
   }
   return FX2Geometry.toRectangle(
       contentPart.getVisual().localToScene(contentPart.getVisual().getLayoutBounds()));
 }
 @Override
 public void press(MouseEvent e) {
   targetParts = getTargetParts();
   if (targetParts.size() < 2 || e.isControlDown()) {
     invalidGesture = true;
     return;
   }
   // init resize context vars
   initialMouseLocation = new Point(e.getSceneX(), e.getSceneY());
   selectionBounds = getSelectionBounds(targetParts);
   relX1 = new HashMap<>();
   relY1 = new HashMap<>();
   relX2 = new HashMap<>();
   relY2 = new HashMap<>();
   // init scale relocate policies
   for (IContentPart<Node, ? extends Node> targetPart : targetParts) {
     FXTransformPolicy transformPolicy = getTransformPolicy(targetPart);
     if (transformPolicy != null) {
       storeAndDisableRefreshVisuals(targetPart);
       computeRelatives(targetPart);
       init(transformPolicy);
       // transform scale pivot to parent coordinates
       Point pivotInScene = getVisualBounds(targetPart).getTopLeft();
       Point pivotInParent =
           FX2Geometry.toPoint(
               getHost().getVisual().getParent().sceneToLocal(pivotInScene.x, pivotInScene.y));
       // create transformations for scaling around pivot
       int translateToOriginIndex = transformPolicy.createPostTransform();
       int scaleIndex = transformPolicy.createPostTransform();
       int translateBackIndex = transformPolicy.createPostTransform();
       // set translation transforms for scaling
       transformPolicy.setPostTranslate(
           translateToOriginIndex, -pivotInParent.x, -pivotInParent.y);
       transformPolicy.setPostTranslate(translateBackIndex, pivotInParent.x, pivotInParent.y);
       // save rotation index for later adjustments
       scaleIndices.put(targetPart, scaleIndex);
       // create transform for translation of the target part
       translateIndices.put(targetPart, transformPolicy.createPostTransform());
       // initialize resize policy if available
       FXResizePolicy resizePolicy = getResizePolicy(targetPart);
       if (resizePolicy != null) {
         init(resizePolicy);
       }
     }
   }
 }