private void updateScalingGroup() { if (scalingGroup != null) { final double actualScaling; if (fxomDocument == null) { actualScaling = 1.0; } else if (fxomDocument.getSceneGraphRoot() == null) { actualScaling = 1.0; } else { actualScaling = scaling; } scalingGroup.setScaleX(actualScaling); scalingGroup.setScaleY(actualScaling); if (Platform.isSupported(ConditionalFeature.SCENE3D)) { scalingGroup.setScaleZ(actualScaling); } // else { // leave scaleZ unchanged else it breaks zooming when running // with the software pipeline (see DTL-6661). // } } }
private void adjustWorkspace() { final Bounds backgroundBounds, extensionBounds; final Object userSceneGraph; if (fxomDocument == null) { userSceneGraph = null; } else { userSceneGraph = fxomDocument.getSceneGraphRoot(); } if ((userSceneGraph instanceof Node) && (layoutException == null)) { final Node rootNode = (Node) userSceneGraph; final Bounds rootBounds = rootNode.getLayoutBounds(); if (rootBounds.isEmpty() || (rootBounds.getWidth() == 0.0) || (rootBounds.getHeight() == 0.0)) { backgroundBounds = new BoundingBox(0.0, 0.0, 0.0, 0.0); extensionBounds = new BoundingBox(0.0, 0.0, 0.0, 0.0); } else { final double scale; if ((rootBounds.getDepth() > 0) && autoResize3DContent) { // Content is 3D final double scaleX = AUTORESIZE_SIZE / rootBounds.getWidth(); final double scaleY = AUTORESIZE_SIZE / rootBounds.getHeight(); final double scaleZ = AUTORESIZE_SIZE / rootBounds.getDepth(); scale = Math.min(scaleX, Math.min(scaleY, scaleZ)); } else { scale = 1.0; } contentGroup.setScaleX(scale); contentGroup.setScaleY(scale); contentGroup.setScaleZ(scale); final Bounds contentBounds = rootNode.localToParent(rootBounds); backgroundBounds = new BoundingBox( 0.0, 0.0, contentBounds.getMinX() + contentBounds.getWidth(), contentBounds.getMinY() + contentBounds.getHeight()); final Bounds unclippedRootBounds = computeUnclippedBounds(rootNode); assert unclippedRootBounds.getHeight() != 0.0; assert unclippedRootBounds.getWidth() != 0.0; assert rootNode.getParent() == contentGroup; final Bounds unclippedContentBounds = rootNode.localToParent(unclippedRootBounds); extensionBounds = computeExtensionBounds(backgroundBounds, unclippedContentBounds); } } else { backgroundBounds = new BoundingBox(0.0, 0.0, 320.0, 150.0); extensionBounds = new BoundingBox(0.0, 0.0, 0.0, 0.0); } backgroundPane.setPrefWidth(backgroundBounds.getWidth()); backgroundPane.setPrefHeight(backgroundBounds.getHeight()); extensionRect.setX(extensionBounds.getMinX()); extensionRect.setY(extensionBounds.getMinY()); extensionRect.setWidth(extensionBounds.getWidth()); extensionRect.setHeight(extensionBounds.getHeight()); contentSubScene.setWidth(contentGroup.getLayoutBounds().getWidth()); contentSubScene.setHeight(contentGroup.getLayoutBounds().getHeight()); }