You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see in the video, I use a cyan highlight style as a preview for what’s being selected. That works great, as long as the model uses original colors.
However, if a model is already colored with OBF.Highlighter (e.g. to color items by level or type), then the previously applied custom color will be lost. From what I can see, restorePreviousColors only runs for the "select" style, so any other style defined doesn't get restored.
This seems like a noticeable limitation in OBF.Highlighter. Are there ideas on how best to solve it? We'd be happy to help out with the changes (e.g. a pull request), if that's something accepted. Or is there another/better pattern for doing temporary previews like this that we're missing?
Multi-Highlight.mp4
Suggested solution 💡
Generalize the style restoration so it works for any style. Probably this means some extra bookkeeping on the order styles were applied.
Alternative ⛕
Thoughts on better ways of using styles
Perhaps the styles should be applied more in a declarative instead of imperative way
Give each style a priority value so that when multiple styles apply to the same item, the highest-priority one wins
Current workaround
Manually reapplying the previous styles after clearing the preview
this does mean that wrong colors are shown briefly
Additional context ☝️
This issue came up while building box-selection in an IFC widget for the low-code app platform https://wistor.nl
Description 📝
As you can see in the video, I use a cyan highlight style as a preview for what’s being selected. That works great, as long as the model uses original colors.
However, if a model is already colored with
OBF.Highlighter(e.g. to color items by level or type), then the previously applied custom color will be lost. From what I can see,restorePreviousColorsonly runs for the"select"style, so any other style defined doesn't get restored.This seems like a noticeable limitation in
OBF.Highlighter. Are there ideas on how best to solve it? We'd be happy to help out with the changes (e.g. a pull request), if that's something accepted. Or is there another/better pattern for doing temporary previews like this that we're missing?Multi-Highlight.mp4
Suggested solution 💡
Generalize the style restoration so it works for any style. Probably this means some extra bookkeeping on the order styles were applied.
Alternative ⛕
Thoughts on better ways of using styles
Current workaround
Additional context ☝️
This issue came up while building box-selection in an IFC widget for the low-code app platform https://wistor.nl
You can find a working repo of it here:
https://github.com/MarcinKoziuk/ThatOpen-demos
Validations ✅