|
Re: Prevent nodes from being dragged out of parent bounds (GEF5) [message #1770449 is a reply to message #1770448] |
Fri, 11 August 2017 10:09   |
Eclipse User |
|
|
|
Hi Thomas,
there are multiple alternatives available for solving this issue:
A) Exchange child node part's TransformPolicy and prevent translation out of its parent's bounds, e.g. ParentRestrictedTransformPolicy. Then, you can bind it for all parts that should be restricted to their parent's bounds. No special code in the child parts is needed.
B) Override child node part's setVisualTransform() method and prevent translation out of its parent's bounds there. The ITransformableContentPart#setVisualTransform() method is called during interaction to apply the translation to the part's visual. The final visual transform (getVisualTransform()) is applied to the model using setContentTransform(). When choosing this alternative, you should probably factor out a RestrictToParentSupport that can simply be called.
Alternative B) is closer to your current status, so you can try it out easily. However, alternative A) allows for easier re-use, although a little more difficult to set-up.
Best regards,
Matthias
[Updated on: Fri, 11 August 2017 10:10] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.04271 seconds