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
When set to false the canvas will start to draw with the mouse anyway. I have tried mousemove and touchmove events. Same behaviour across browsers. Any idea? Thanks!
Hi! Thanks for trying sketch and for finding creating this issue. The problem is that mouse events are bound and triggered even if the sketch isn't running (i.e the update/draw loop is stopped) which is the state it's in when you tell sketch not to autostart.
On the one hand, it would make sense to prevent these events from firing if the sketch isn't running. However, you may still want to receive things like resize events even if it isn't and in some cases even mouse events (perhaps you're tracking the mouse but not drawing.) Regardless, the current architecture means that all events are handled in the same way and so I'd need to add special cases for this.
The intended meaning for the running flag (which is what's toggled when you start or stop a sketch) was to reflect state of the update/draw loop which happens each frame. I think this is an interesting case though and worth thinking about.
In the meantime and as a quick fix you can just check the running flag in your mouse handlers (example) or for your specific use case, use the dragging flag (example).
I hope that solves your problem for now and if you and others think that stopping (or not starting) the sketch should mean that all events are disabled then I can make this change to the library.
When set to false the canvas will start to draw with the mouse anyway. I have tried mousemove and touchmove events. Same behaviour across browsers. Any idea? Thanks!
Here's the jsFiddle:
http://jsfiddle.net/bitflower/ss3dkhnz/3/
The text was updated successfully, but these errors were encountered: