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

Bug 510419

Summary: Provide #fitToSize() functionality in ViewportPolicy and use it in FitToViewportAction.
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF MVCAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.1.0   
Target Milestone: 5.0.0 (Oxygen) M5   
Hardware: All   
OS: All   
Whiteboard:

Description Matthias Wienand CLA 2017-01-13 05:22:45 EST
Currently, fit-to-size functionality is only provided in InfiniteCanvas. Therefore, it is difficult to perform fit-to-size using ViewportPolicy. Thus, fit-to-size functionality is not available if a custom ViewportPolicy is used that restricts viewport changes, for example, to resemble a text editor w.r.t. zooming. In addition, the new ViewportPolicy#fitToSize() should be used within FitToViewportAction and FitToViewportLockAction to determine an operation that performs fit-to-viewport, so that a custom ViewportPolicy is respected by these actions.
Comment 1 Matthias Wienand CLA 2017-01-16 07:19:35 EST
I implemented ViewportPolicy#fitToSize(), #fitToSize(zoomMin), and #fitToSize(zoomMin, zoomMax). The method is safe against being called when the InfiniteCanvas does not have contents. The FitToViewportAction delegates to ViewportPolicy now for constructing the operation that actually performs fit-to-viewport. The code is published on the master branch, therefore, I resolve this ticket as fixed for 5.0.0 M5.