Blocks :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
When a menu's content has a shadow effect or similar that draws outside of layout bounds. We move the node down so that the whole node is inside the popup window and we do not get clipping of the shadow. The problem with this is a shadow on a menu offsets the menu so that it no longer aligns with the menu bar. See the attached screenshots. What should happen is the popup should be moved from the user set X,Y so that the layout bounds 0,0 is positioned at the user requested screenX, screenY. I did a simple patch for this: diff -r 649ecc9fc736 javafx-ui-common/src/javafx/stage/PopupWindow.java --- a/javafx-ui-common/src/javafx/stage/PopupWindow.java Mon Mar 04 15:17:00 2013 -0800 +++ b/javafx-ui-common/src/javafx/stage/PopupWindow.java Mon Mar 04 16:57:25 2013 -0800 @@ -341,7 +341,11 @@ if (ownerNode != null) { ownerNode.visibleProperty().addListener(ownerNodeListener); } - + + Bounds sceneRootBounds = getScene().getRoot().getBoundsInLocal(); + if (sceneRootBounds.getMinX() < 0) screenX += sceneRootBounds.getMinX(); + if (sceneRootBounds.getMinY() < 0) screenY += sceneRootBounds.getMinY(); + setX(screenX); setY(screenY); showImpl(newOwnerWindow); I am not sure this is the right place for this fix and looked a bit deeper. It seems like we have very similar code: if (!isAutoFix()) { final Parent rootNode = getScene().getRoot(); if (rootNode != null) { final Bounds _bounds = rootNode.getLayoutBounds(); setX(this.getX() + _bounds.getMinX()); setY(this.getY() + _bounds.getMinY()); } } At line 403 of PopupWindow.java but its not running because isAutoFix() is true. Looking at the history it looks like this code used to always be run but got moved behind this if statement with a fix for RT-19437 by Lubomir in change 424:b5bafe2e6c6e. So I am not sure why this got removed. So I am unsure if me putting something similar back in place is a good idea or not. Was this removed for a reason or by accident?
|