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

Bug 482362

Summary: Infinite loop in InfiniteCanvas class
Product: [Tools] GEF Reporter: Xavier JACQUES <xavier.jacques.external>
Component: GEF FXAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.wienand, nyssen
Version: unspecified   
Target Milestone: 4.0.0 / 3.11.0 (Neon) M4   
Hardware: All   
OS: All   
Whiteboard:

Description Xavier JACQUES CLA 2015-11-17 08:04:18 EST
Condition:
Set a scale transform with y inversion (x will have the same behavior) to the ViewportModel.

viewportModel.setContentsTransform(new AffineTransform().scale(1,-1))

If the grid (in GridModel) is displayed and zoomGrid=true, you fall into infinite loop in the following loops in the repaintGrid() method:

for (double y = -(getLayoutY() - gridTransformProperty.get().getTy()) % scaledGridCellHeight; y < height; y += scaledGridCellHeight) {
	gc.fillRect(Math.floor(x) - 0.5 * xScale, Math.floor(y) - 0.5 * yScale, xScale, yScale);
}
Comment 1 Alexander Nyßen CLA 2015-11-17 12:23:45 EST
With the InfiniteCanvasSnippet provided in org.eclipse.gef4.fx.examples I cannot reproduce this behavior with InfiniteCanvas alone. 

As we have recently removed the ViewportModel (see bug #482096), could you please confirm whether this holds for the current HEAD version as well?
Comment 2 Matthias Wienand CLA 2015-11-20 07:35:19 EST
The relevant code (repaintGrid()) did not change, and I can reproduce the issue on the current HEAD. I fixed the issue by using the absolute scale, so that the loops do not have to be changed. The code is published on the master branch. Therefore, I resolve this ticket as fixed for 3.11.0M4. However, if you encounter any problems with this solution, such as unstable grid positions, feel free to reopen this ticket.