Viewport is continuously layouting [message #925211] |
Thu, 27 September 2012 13:52 |
Maarten Bezemer Messages: 117 Registered: February 2012 |
Senior Member |
|
|
Hi,
I am developing a GEF based model editor. At a certain moment I noticed that lots of resources (CPU and RAM) were being used.
After a while I noticed that FigureCanvas#layoutViewport() is continuously being called. See snippet below (I left out uninteresting parts of the method):
private void layoutViewport() {
ScrollPaneSolver.Result result;
result = ScrollPaneSolver.solve(...);
// ...
Rectangle r = new Rectangle(getClientArea());
getLightweightSystem().getRootFigure().setBounds(r);
}
I noticed that both ScrollPaneSolver#solve() and layoutViewPort() are calling setBounds(). The provided Rectangles differ by 2 pixels in width and in height.
This resulting in the setBounds() method calling fireFigureMoved(), which then calls layourViewport() again. This keeps on going...
Big disadvantage is that all figures get revalidated/layouted which takes lots of resources when the editor is used for big models.
Were does these 2 pxiels come from? A 1 pixel wide border somewhere? (As far as I can see I do not modify the different layered views)
Does anyone have a similar experience and is able to tell me what I am doing wrong, or how I should circumvent this issue?
Edit: It only seems to occur when the scrollbars are visible. When I zoom out far enough (so that the model does easily fit) the problem cease to exist
[Updated on: Thu, 27 September 2012 13:53] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.02567 seconds