jean-emmanuel / open-stage-control

Libre and modular OSC / MIDI controller
https://openstagecontrol.ammd.net
GNU General Public License v3.0
705 stars 90 forks source link

Touch events not firing on mobile [Bug] #829

Closed smithkyle closed 1 year ago

smithkyle commented 1 year ago

Please provide as much contextual informations as possible:

smithkyle commented 1 year ago

Doesn't appear to be confined to mobile - I just tried in safari and chrome on macos, and neither triggered the ontouch function (I believe safari isn't supported, but chrome is).

jean-emmanuel commented 1 year ago

Everything appears to behave as expected here, onTouch only exposes the start and stop events as documented and the pad itself reacts normally to drag events.

smithkyle commented 1 year ago

I made a video of me setting up a fresh session, and then using two built-in client windows to observe the behavior of the onValue function of a button, and the onValue / onTouch functions of an XY pad. When clicking the button, the onValue function updates both instances of the client. When clicking the XY pad, the onTouch function ONLY runs for the client which was clicked, but as I drag around on the pad, you can see that the onValue function updates BOTH clients.

Should the onTouch function only update the client that was interacted with? I am also including the session that was created during the video.

example video test2.json.txt

jean-emmanuel commented 1 year ago

Yes, onTouch should only run when the widget is physically interacted with. On the other hand, since the value is sent to other clients for widgets to synchronize it triggers onValue*. The behavior you describe is correct.

*Note that unless onValue is triggered by a direct interaction the send() function has no effect to prevent sending duplicate messages.

Now the video shows the text widget ends up with a different value in the two clients, this is because it doesn't send any message and thus doesn't hit the cross client sync mechanism. I'm not entirely sure that's a problem, need to think about it.

smithkyle commented 1 year ago

Thanks for your reply. If set() [not send()] is being called in the onTouch function, shouldn’t the widget being set() synchronize the new value to all clients? The behavior that I am seeing is that only the client that received the touch event updates the widget targeted by set() with the new value - the other clients are not synchronizing the widget being set() via the onTouch event with the new value.Thanks again.KyleOn Jun 26, 2023, at 10:52 PM, jean-emmanuel @.**> wrote: Yes, onTouch should only run when the widget is physically interacted with. On the other hand, since the value is passed sent to other clients for widgets to synchronize it triggers onValue. The behavior you describe is correct. *Note that unless onValue is triggered by a direct interaction the send() function has no effect to prevent sending duplicate messages.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

jean-emmanuel commented 1 year ago

If you change the type of the text widget to input it will work as you expect, there's currently a blind spot here for widgets that don't send any message when their value changes (it's not related to the explicit use of send())

smithkyle commented 1 year ago

Sorry for the delay in responding. Switching the variable widget to an input widget worked. After fussing with this, I realized I could actually just use setVar and getVar to much easier avail, which worked better.

jean-emmanuel commented 1 year ago

Ok cool ! As of v1.25.2, variable, text and led widgets will have their value synced accross clients.