[GEF4] ScrollPaneEx overlap other widgets [message #1713409] |
Tue, 03 November 2015 20:20 |
Frank Benoit Messages: 179 Registered: July 2009 |
Senior Member |
|
|
I use this JavaFX code to create a window with a button on the top, and a GEF4 viewer below. When i use the mouse wheel, i can scroll the content of the viewer over the button.
I would expect, that the content is clipped, but it isn't.
I am new to FX, so this might be a obvious problem. Or a bug in ScrollPaneEx?
AnchorPane paneCtrl = new AnchorPane();
AnchorPane paneDraw = new AnchorPane();
VBox vbox = new VBox( paneCtrl, paneDraw );
btnUpdateModel.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
paneCtrl.getChildren().add(btnUpdateModel);
AnchorPane.setTopAnchor(btnUpdateModel, 10d);
AnchorPane.setLeftAnchor(btnUpdateModel, 10d);
AnchorPane.setRightAnchor(btnUpdateModel, 10d);
ScrollPaneEx drawingPane = viewer.getScrollPane();
paneDraw.getChildren().add(drawingPane);
paneDraw.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
AnchorPane.setTopAnchor(drawingPane, 10d);
AnchorPane.setLeftAnchor(drawingPane, 10d);
AnchorPane.setRightAnchor(drawingPane, 10d);
AnchorPane.setBottomAnchor(drawingPane, 10d);
primaryStage.setScene(new Scene(vbox));
primaryStage.setResizable(true);
primaryStage.setWidth(640);
primaryStage.setHeight(480);
primaryStage.show();
This is how it looks like after scrolling:
Can someone help?
[Updated on: Tue, 03 November 2015 21:27] Report message to a moderator
|
|
|
Re: [GEF4] Clipping of ScrollPaneEx contents [message #1713437 is a reply to message #1713409] |
Wed, 04 November 2015 07:44 |
|
You are right, our ScrollPaneEx does not clip the contents by default (which it should probably do). In addition, the AnchorPane you use does not clip its children either.
Quote:AnchorPane does not clip its content by default, so it is possible that childrens' bounds may extend outside its own bounds if the anchor pane is resized smaller than its preferred size.
You may solve this by setting a clip to the AnchorPane containing the ScrollPaneEx of the viewer:
Rectangle clipRectangle = new Rectangle();
paneDraw.setClip(clipRectangle);
paneDraw.layoutBoundsProperty().addListener((observable, oldValue, newValue) -> {
clipRectangle.setWidth(newValue.getWidth());
clipRectangle.setHeight(newValue.getHeight());
});
In either case I think our ScrollPaneEx should already clip its contents by default (or at least make this configurable). Can you please create a bugzilla for this? We are currently working on refactoring the ScrollPaneEx anyway (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=479395) and could directly take care of this as well.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02167 seconds