Closed a-gagnon closed 6 months ago
@bbastings
@a-gagnon @pmconne Is there some reason your ViewTool can't check it's own decoration? The LookAndMoveTool uses canvas decorations for touch input controls (like the thumbsticks) and just checks them itself.
The main reason this check exists is to prevent locating a decoration from the suspended PrimitiveTool or InputCollector when the view is changing (eats motion events, can show tooltip, etc.). We also didn't want tools like RotateViewTool to pick a decoration from the suspended PrimitiveTool when trying to identity the point to rotate about (ex. Measure tools measurements).
So no, not in favor of adding an option to ViewTool for "canPickDecorations" because of the issues mentioned and the fact that you really just want to pick your own decorations not all decorations...
Thanks. I figured there was some reason.
It'll take some refactoring and expose some pieces I would've kept internal to the text editing class itself, but checking hit myself is a solution.
Is your feature request related to a problem? Please describe. I'm writing a tool to rotate the view based off the mouse position, but I also allow user to input the angle numerically. For that, I display the current angle in degrees using a canvas decoration. I want to be able to click on it to change the value, but there is some code in ToolAdmin that prevents a viewing tool from interacting with a canvas decoration, ie:
Because of that,
onMouseButton
,onMouseEnter
,pick
and the likes never get called. I had to subclassInputCollector
instead ofViewTool
to get it working in the meantime, but that approach has other issues. What's the reasoning behind this? Not all view tools are started in 'single shot' mode.Describe the solution you'd like Add a function on the
ViewTool
, likecanPickCanvasDecorations
, that I could override and set totrue
whenever I'd like to interact with canvas decorationsDescribe alternatives you've considered As said previously, I subclass
InputCollector
in the meantime, but it has its quirks. For example, if I start anyViewTool
, it won't let me click start my tool since the viewing tool has priority over an input collector.For reference, a screen cap of the tool: