|Re: Selection Behaviour of edges [message #1802909 is a reply to message #1801237]
||Mon, 18 February 2019 20:05
|| Matthias Wienand
Registered: March 2015
there are multiple ways of tackling this (as always).
Some options for implementing the feedback/highlight, graduating from most simple & special to most general & complex:
- Add a JavaFX Effect to the visuals that need highlighting (if possible).
- Render as part of your regular parts, for example, by using an isHighlighted field that you can set and call refreshVisual().
- Reuse selectionFeedbackPartFactory etc. but from another behavior, so that it is independent from SelectionModel.
- Implement custom feedback parts for the highlighting (as well as factory, model, and behavior).
Personally, I like your suggestion, because it is a reusable pattern that can be applied in many situations:
- Create a Model (e.g. HighlightModel)
- Create a Behavior (e.g. HighlightBehavior) that listens to Model changes
- Create a Policy and an Operation for manipulation of the new Model (e.g. ChangeHighlightOperation, HighlightPolicy)
- Create Handlers that write to the Model (e.g. HighlightConnectedOnClickHandler, RemoveHighlightOnClickHandler (at rootpart or something))
That is a solid setup where you can still decide if you want to apply the highlight lightweight (effect, or as part of your parts) or controlled by feedback parts (where you can still decide to reuse selection stuff, e.g. geometry provider, color, etc.).
[Updated on: Mon, 18 February 2019 20:05]
Report message to a moderator
Powered by FUDForum
. Page generated in 0.01994 seconds