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
Recently I wanted to add a delay before displaying the text of CooperativeGesturesHandler on smartphones, so I decided to create my own Handler that extends of CooperativeGesturesHandler :
I can't find a way to specify the order inside the HandlerManager._handlers array, I need to specify an order because handlers "touchPan", and "touchZoom" are blocking the "touchMove" event. I can add an allowed list to the "_add" method this way : map.handlers._add("cooperativeGestures", cooperativeGestures , ["touchPan", "touchZoom"]); but now because my custom handler is added at the end of HandlerManager._handlers "touchZoom" and "touchPan" are not blocked by my custom handler.
Well it works, but when it comes to edit other handlers it becomes harder, that's why I would love to have some advices, or the best practices to create my custom handlers.
By the way I would avoid to use HandlerManager._handlers or HandlerManager._handlersById, because in my mind prefixed by _ variables can be changed in new realeases, and I even don't know if it's a great idea to use map.handlers._add too.
Any advices would be appreciate :)
The text was updated successfully, but these errors were encountered:
Most of the handler logic is internal, and too complicated if you ask me.
Some handlers are checking the state of other handler in some situations, I looked into it when fixing some bugs in the cooperative gesture handler.
Recently I wanted to add a delay before displaying the text of CooperativeGesturesHandler on smartphones, so I decided to create my own Handler that extends of CooperativeGesturesHandler :
But here comes the problem : when adding a new Handler this way :
I can't find a way to specify the order inside the HandlerManager._handlers array, I need to specify an order because handlers "touchPan", and "touchZoom" are blocking the "touchMove" event. I can add an allowed list to the "_add" method this way :
map.handlers._add("cooperativeGestures", cooperativeGestures , ["touchPan", "touchZoom"]);
but now because my custom handler is added at the end of HandlerManager._handlers "touchZoom" and "touchPan" are not blocked by my custom handler.Well it works, but when it comes to edit other handlers it becomes harder, that's why I would love to have some advices, or the best practices to create my custom handlers.
By the way I would avoid to use HandlerManager._handlers or HandlerManager._handlersById, because in my mind prefixed by _ variables can be changed in new realeases, and I even don't know if it's a great idea to use map.handlers._add too.
Any advices would be appreciate :)
The text was updated successfully, but these errors were encountered: