changeset 8029:d8c7120ab268

[SCENEBUILDER] Fix for DTL-6837 (NPE when using X or Y rotationAxis).
author Eric Le Ponner <eric.le.ponner@oracle.com>
date Wed, 10 Sep 2014 12:02:47 +0200
parents d02883b88ce5
children c9450b73265d
files apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java	Wed Sep 10 11:43:06 2014 +0200
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/content/ContentPanelController.java	Wed Sep 10 12:02:47 2014 +0200
@@ -366,16 +366,23 @@
                 final FXOMObject nodeFxomObject = mask.getClosestFxNode();
                 if (nodeFxomObject != null) {
                     final Node node = (Node) nodeFxomObject.getSceneGraphObject();
-                    union.add(node.localToScene(node.getLayoutBounds(), true /* rootScene */));
+                    assert node.getLayoutBounds() != null;
+                    final Bounds nodeBounds = node.localToScene(node.getLayoutBounds(), true /* rootScene */);
+                    assert nodeBounds != null;
+                    union.add(nodeBounds);
                 }
             }
         }
 
         if (union.getResult() != null) {
             final Node content = scrollPane.getContent();
-            final Bounds enclosing = content.sceneToLocal(union.getResult(), true /* rootScene */);
+            final Bounds sceneEnclosing = union.getResult();
+            assert sceneEnclosing.getMinZ() == 0.0; // Side effect of SubScene
+            assert sceneEnclosing.getMaxZ() == 0.0;
+            final Bounds localEnclosing = content.sceneToLocal(sceneEnclosing, true /* rootScene */);
+            assert localEnclosing != null;
             final ScrollPaneBooster spb = new ScrollPaneBooster(scrollPane);
-            spb.scrollTo(enclosing);
+            spb.scrollTo(localEnclosing);
         }
     }