-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mouse-dragging idiom does not work #151
Comments
A better fix would be to off-load the engine to a web worker and then stream in ui events. |
I'm not sure that actually fixes the problem. You're still going to have the issue of the webworker never relinquishing control to read the UI event, aren't you? |
|
There are some Javascript compilers that are supposed to implement ES6 features (ECMAScript 6) via current Javascript. How do they implement such things? Maybe you should output ES6 and pass on output to such compiler to give current Javascript? |
Instead of compiling to javascript a netlogo vm would maybe have made it easier to do such things |
There's a useful thread here: |
Btw, we're not speaking of mousedown event handlers, just that you'd keep some flags so that when polled you know the mouse state |
Turboid core (standalone part from Turboid framework) mentioned at http://turboid.net/artikel/real-loops-in-javascript.php might be interesting to check out |
I don't see "requestAnimationFrame" mentioned here as potential solution. See the Timer.js from seajax PivotViewer (port of Silverlight PivotViewer to javascript by programmers of the original version) and the comments/code it has on "requestAnimationFrame" and usage with various browsers. Search for "requestAnimationFrame" in https://github.com/seajax/seajax/blob/master/v2/src/utils/Timer.js an example of PivotViewer if you haven't seen it before is at http://seajax.github.io |
Create a model with a
go
(forever) button, and give it this code:Click on the View. In JVM NetLogo, you will see the message "No more Mr. Mouse". In Tortoise, the code for that line will never be reached. The mouse is never given a chance to update whether it's down or not, since the JS for
while [mouse-down] []
is awhile
loop that dominates control of the system.This could maybe be fixed by actually having
while
compile to recursive(esque)setTimeout
calls. It's kind of gross, but... it would maybe get us better NetLogo semantics. I'm not sure if that would work out well with how we're currently throwingStopInterrupt
s, though. The whole things a big mess of wonky control flow that doesn't translate well into JavaScript.This problem also prevents Mouse Drag One Example from working correctly (since it, too, goes into an endless
while
loop).Discovered while investigating #150.
The text was updated successfully, but these errors were encountered: