[GEF4] Selection handles for different actions [message #1732753] |
Thu, 19 May 2016 21:42 |
|
For some of my parts, I would like to be able to generate a different set of selection handles depending on the action the user wants to perform.
For example, I have a part that manages a GeometricNode<Polyline>. The default action is to manipulate the shape of the line, so the selection handle factory creates handles to move each line segment and to create new segments. That's all working fine.
Now I want to add an action that lets the user split the line into two at one of the bendpoints in the line, so I want a different set of selection handles, only on the bendpoints, that will indicate which bendpoint is to be used to split the line. Triggering that mode would be either by a gesture (e.g. ctrl+click) or from a context menu button.
Looking at FXDefaultSelectionHandlePartFactory, I can't see any way that I can indicate what mode it should create handles for - it only accepts a SelectionBehavior, and as far as I can see the contextMap is always hardcoded as an empty map. Does that mean I need to create a different type of handle part factory, and invoke that from a custom policy? I'd like something reasonably generic, as I have several different scenarios that have a similar mechanism.
Colin Sharples
CTG Games Ltd
Wellington, New Zealand
|
|
|
Re: [GEF4] Selection handles for different actions [message #1732781 is a reply to message #1732753] |
Fri, 20 May 2016 08:14 |
|
Hi Colin,
I would use a viewer model to store the handle mode, e.g. HandleModeModel. Then, you can subclass SelectionBehavior and add listeners to the HandleModeModel so that the selection handles are updated when the handle mode changes. The handle mode can be put into the context map so that it is available within the handle part factory.
Best regards,
Matthias
|
|
|
Powered by
FUDForum. Page generated in 0.01740 seconds