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
There are some times I want to prevent terra draw from receive certain event.
One of the uses of this is when i display a property editor in the map(basically to change the color or style of a single feature), and because this container is above the map the click events related to that container are also being processed by terra draw, so the user ends up drawing below the editor without knowing because all the clicks he is doing while changing the style of something, so i would want to filter which events to be processed by terra draw.
This and many other scenarios pushed me to find a way to hack that.
The way Im doing it right now is registering a listener right before terra draw, then when one of these events is fired I check if I want to terra draw to receive the event and if I don't then i call stopImmediatePropagation and because my listener is being called before terra draw then that event doesnt get to terra draw.
The problem with this approach is, what if we implement something else that has to be registered after terra draw in the queue of events, then this new listeners will also be prevented from getting some events.
Since Im filtering various types of events it would make sense to have a different filter for each type of event terra draw uses.
The proposal is to pass an object of (event)=>boolean functions to terra draw that will serve as filters they will basically return if the event should be processed by terra draw or not.
One for each type of event you want to filter, I know these are the events being used by terra draw: "pointerdown" , "pointermove" , "contextmenu" , "pointerup" ,"keyup" ,"keydown".
Thanks hope this makes sense for more people to use.
The text was updated successfully, but these errors were encountered:
There are some times I want to prevent terra draw from receive certain event.
One of the uses of this is when i display a property editor in the map(basically to change the color or style of a single feature), and because this container is above the map the click events related to that container are also being processed by terra draw, so the user ends up drawing below the editor without knowing because all the clicks he is doing while changing the style of something, so i would want to filter which events to be processed by terra draw.
This and many other scenarios pushed me to find a way to hack that.
The way Im doing it right now is registering a listener right before terra draw, then when one of these events is fired I check if I want to terra draw to receive the event and if I don't then i call stopImmediatePropagation and because my listener is being called before terra draw then that event doesnt get to terra draw.
The problem with this approach is, what if we implement something else that has to be registered after terra draw in the queue of events, then this new listeners will also be prevented from getting some events.
Since Im filtering various types of events it would make sense to have a different filter for each type of event terra draw uses.
The proposal is to pass an object of
(event)=>boolean
functions to terra draw that will serve as filters they will basically return if the event should be processed by terra draw or not.One for each type of event you want to filter, I know these are the events being used by terra draw: "pointerdown" , "pointermove" , "contextmenu" , "pointerup" ,"keyup" ,"keydown".
Thanks hope this makes sense for more people to use.
The text was updated successfully, but these errors were encountered: