[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] How to keep the relation of the sides of a figure?

Hello!

How can I preserve the relation of the sides? When the user drags at the sides of the figure to make it bigger or smaller he can distort the shape.
I have, for example, a shape, that has height=45 and width=30 as default. Now I want, that the ratio/relation/proportion of the sides is always 45:30.


Where can I put the code to monitor the change?

A notification is not thrown until the user releases the mouse after dragging. At this point I get the new width and height within the notification and then I just can ask, if the new w and h has the right ratio. And if not, I can take the old w and h. But the user will never be abel to adjust the exact right ratio with the mouse. So in reality the user wouldn`t be abel to resize the figure anymore, aside from people with a proper amount of luck ;)

I know, that there is a Resize Constraint in the gmfgraph, but this Constraint just prevents from dragging into one (or more) specific direction. I want to allow dragging into any direction, but just within my ratio.

Thanks in advance!
Best wishes!
Julia