neutralinojs / neutralino.js

JavaScript API for Neutralinojs
https://neutralino.js.org/docs/api/overview
MIT License
237 stars 47 forks source link

setDraggableRegion laggy #80

Closed ratatoeskr666 closed 1 year ago

ratatoeskr666 commented 1 year ago

I found out that the event handling of setDraggableRegion leads to lags. I guess it's due to too many pointermove event invocations at once. On every invocation a message is being sent via websocket to the app. We need some kind of throttleTime (see rxjs) which reduces the amount of pointer move invocations.

I already implemented my own movement logic (which uses rxjs observables and throttleTime) and reduced the amount of pointermove events to 1 every 4ms. And it works smoothly. No more lags.

I will spare some time and look into writing a solution without rxjs and create a pull request for this issue if you agree

shalithasuranga commented 1 year ago

Closed via #83.. Thanks for the pull request :) Btw. would you like to display your GitHub username/name with link on [this list]?(https://neutralino.js.org/docs/contributing/committers) -- we often update this list with contributors who did very good contributions :tada:

ratatoeskr666 commented 1 year ago

Closed via #83.. Thanks for the pull request :) Btw. would you like to display your GitHub username/name with link on [this list]?(https://neutralino.js.org/docs/contributing/committers) -- we often update this list with contributors who did very good contributions 🎉

sure, thank you very much! I really like neutralino and looking forward to contribute more in the future

But you tested the changes, didn't you? As I wrote in the Pull Request: I, unfortunatly, couldn't test the changes yet. I have no idea if the code I committed works (shame on me)

shalithasuranga commented 1 year ago

Great @ratatoeskr666, I made https://github.com/neutralinojs/neutralinojs.github.io/issues/282 to add your GitHub profile to the Neutralinojs website. Regarding the PR, yeah I tested by adjusting threshholds -- the event throttling concept worked for me. May be later we can use a common throttling algorithm with setTimeout, but your implementation also looks great.

Thanks :tada:

ratatoeskr666 commented 1 year ago

Glad to hear. Thank you very much!