Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 479395

Summary: Refactoring of ScrollPaneEx and FXGridLayer to InfiniteCanvas
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF FXAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: nyssen
Version: 0.2.0   
Target Milestone: 4.0.0 / 3.11.0 (Neon) M3   
Hardware: All   
OS: All   
Whiteboard:

Description Matthias Wienand CLA 2015-10-09 04:35:38 EDT
The background grid that is rendered by the FXGridLayer is not updated correctly when the zoom level changes, i.e. the grid positions are unstable when zooming.
Comment 1 Alexander Nyßen CLA 2015-10-12 13:51:53 EDT
We should merge the FXGridLayer into ScrollPaneEx and add respective options there. This will allow to access the viewport transform (which can then also be applied to the grid layer).
Comment 2 Alexander Nyßen CLA 2015-10-15 10:04:01 EDT
Ensured that grid layer reflects the translation and scaling of the scrollpane's viewport transform. The implementation is still pretty slow, but the grid now stays stable during zoom).
Comment 3 Alexander Nyßen CLA 2015-10-16 12:10:40 EDT
Further simplified the dependencies between ScrollPaneEx and FXGridLayer and improved the FXGridLayer API.
Comment 4 Alexander Nyßen CLA 2015-10-19 06:53:26 EDT
Continued my refactoring:

-Migrated FXGridLayer into a Group and simplified some indirect bindings to use the nested FXCanvas directly.
-Removed the no longer useful GroupLayersSetup snippet.
Comment 5 Alexander Nyßen CLA 2015-10-19 14:17:11 EDT
Simplified the code further
- Ensured FXGridLayer offers all properties as JavaFX properties.
- Ensured FXGridLayer gridTransform is offered as a read-only property only, so only the tx, ty, mxx, myy values can be changed (not the complete transform).
- Refactored ScrollPaneEx to use less bindings and cache contentBounds and scrolledBounds values. Invalidation of bindinds is performed through listeners. Values get re-computed in updateScrollBars().
Comment 6 Matthias Wienand CLA 2015-10-30 05:55:37 EDT
The ScrollPaneEx and the FXGridLayer should be provided as a single node (InfiniteCanvas). I renamed the bug accordingly.
Comment 7 Matthias Wienand CLA 2015-11-06 10:55:25 EST
- Renamed ScrollPaneEx to InfiniteCanvas.
- Removed FXGridLayer and moved the inner GridCanvas class into the InfiniteCanvas class.
- Moved the grid layer properties ("show grid", "zoom grid", "grid cell width", "grid cell height") into the InfiniteCanvas.
- Added new properties to the InfiniteCanvas: "horizontal scrollbar policy" and "vertical scrollbar policy" can be used to specify when to show scrollbars (always, never, as needed).
- Removed the get{Top,Right,Bottom,Left}Excess(Node) methods as they can be implemented using standard JavaFX methods quite easily.
- Made the ScrollBars only accissble for sub-classes.
- Removed the norm{Hv,Vv}(double) methods and lerp{Hv,Vv}Ratio(double) methods as they were never used within GEF4.
- Extracted the registration of listeners into protected methods so that sub-classes can prevent the registration/register different listeners.
- Added four Groups to the InfiniteCanvas that can be used to add visuals at different positions: underlay, scrolled underlay, scrolled overlay, and overlay.
- Added two protected methods for the composition of visuals: createLayers() and createScrolledLayers(). The createLayers() method returns by default the underlay, the scrolled pane, the overlay, and the scrollbar group. The createScrolledLayers() method returns by default the grid canvas, the scrolled underlay, the content, and the scrolled overlay.
Comment 8 Matthias Wienand CLA 2015-11-06 10:56:07 EST
The changes have been published on the master branch. Therefore, I resolve this ticket as fixed for 3.11.0M3.