ScrollingGraphicalViewer: Auto right scroll when width increases [message #916643] |
Wed, 19 September 2012 05:12  |
Eclipse User |
|
|
|
(1)First Scenario
Figure 1. The element in the most right of canvas.

Figure 2. Hover the element,the button pad shows and the canvas increase size, but not scroll right.
Thus we can't see the right area of context button pad.

(2) Seconde Scenario
Figure 3. Expand the element and the scrollbars shows but not scroll right

Figure 4. Scroll manually

I want to solve this problem by:
(1) add border/inset to ScrollingGraphicalViewer. But can't find it how to add it.
(This approach is not fit to second scenario)
(2) auto scroll to right if the size expand because of drag&drop or others.
Unfortunately, I still can't implement even one of them in graphiti after reading some articles and codes for hours.
So,
If the approach is incorrect, then what is the right way?
If correct, how to do it?
Thanks in advanced.
Jason, Lin
Attachment: 1.png
(Size: 11.00KB, Downloaded 1193 times)
Attachment: 2.png
(Size: 12.81KB, Downloaded 1128 times)
Attachment: 3.png
(Size: 13.30KB, Downloaded 1142 times)
Attachment: 4.png
(Size: 18.40KB, Downloaded 1165 times)
[Updated on: Wed, 19 September 2012 05:17] by Moderator
|
|
|
|
|
|
|
Re: ScrollingGraphicalViewer: auto right scrolling when expand [message #1229899 is a reply to message #1229175] |
Fri, 10 January 2014 08:46  |
Eclipse User |
|
|
|
After playing around with this some more, I have decided to use another approach - the proposed solution is kind of annoying because it still causes the diagram canvas to jitter as the mouse is moved across shapes.
Instead I've decided to increase the size of the canvas' margin border, which adds enough space on all edges of the canvas to display the button pad. This needs to be done immediately after setting the Diagram into the Graphical Viewer contents, like so:
GraphicalViewer viewer = getGraphicalViewer();
viewer.setContents(diagram);
EditPart ep = viewer.getRootEditPart().getContents();
if (ep instanceof AbstractGraphicalEditPart) {
IFigure fig = ((AbstractGraphicalEditPart)ep).getFigure();
fig.setBorder(new MarginBorder(50));
}
This can usually be handled in the Diagram Editor's initializeGraphicalViewer() method.
|
|
|
Powered by
FUDForum. Page generated in 0.04347 seconds