sojamo / controlp5

A gui library for processing.org
GNU Lesser General Public License v2.1
490 stars 142 forks source link

Controller shouldn't deactivate on mouseDrag #89

Open conorrussomanno opened 7 years ago

conorrussomanno commented 7 years ago

I think controlP5 would feel much more responsive as a whole if you were able mousePress to activate a controller then move your x/y coordinates before mouseRelease, and still call the event of the button/listItem/etc. Right now, I have a number of scrollableLists and buttons, and if I press, accidentally move at all, and then release if feels like it should click, but doesn't... This would be a big fix for the overall feel of the library.

If this is already possible, please let me know!

GoToLoop commented 7 years ago

https://forum.Processing.org/two/discussion/19065/controlp5-responsiveness-issue

sojamo commented 7 years ago

can you give an example, a working sketch that highlights the problems you encounter?

quarks commented 7 years ago

This comment is also based on the discussion posted by the OP in the Processing forum.

A mouse 'click' generates 3 events in this order

1) PRESS 2) RELEASE 3) CLICK (provided the mouse has not moved between (1) & (2)

If the mouse moves between (1) and (2) the you get multiple DRAG events

1) PRESS 2) DRAG 3) DRAG ... ?) RELEASE

The first is appropriate behaviour for a GUI button and gives the user an opportunity to cancel a button-click by moving the mouse before releasing the mouse button. The second is appropriate for a slider.

Although it should be possible to modify the GUI button behaviour so that a CLICK event is fired provided the mouse has not left the button surface before RELEASE, it would not be the expected behaviour of 99.9% of users.

In fact I don't think this is an issue with controlP5. I think that the controllers are responsive, they just don't respond in the way the OP wants.

sojamo commented 7 years ago

thanks @quarks for this. @conorrussomanno you can take a look at the ControlP5callback example to customize controller actions. Like quarks already highlighted, the behavior you are describing results in a drag-action which cancels out the click-action but still triggers the release-action when the mouse is released inside. An outside release is detected as a releasedoutside-action. If this answers your question, please close the issue.

conorrussomanno commented 7 years ago

Thanks, guys. I'll give it a try and close the issue (in addition to posting my solution) if I can fix the bug.