on master help sign in
Merge pull request #721 from michaelbjames/bugfix/718

Bugfix/718

commitc3d3c331c514be36bc35c8c9ea45e1fc0c8217a9 authorEvan Czaplicki <info@elm-lang.org> dateThu 31 Jul 2014, 16:35 (12 years ago) parent0e23d1a05fe7e5
3 files changed+13−4
libraries/Native/Signal/Time.js+5−1 runtime/Debugger.js+7−2 runtime/Init.js+1−1
libraries/Native/Signal/Time.js+5−1
@@ -14,9 +14,13 @@ Elm.Native.Time.make = function(elm) {
1414 var msPerFrame = 1000 / desiredFPS;
1515 var prev = elm.timer.now(), curr = prev, diff = 0, wasOn = true;
1616 var ticker = NS.input(diff);
17− function tick(zero) { return function() {
17+ function tick(zero) {
18+ return function() {
1819 curr = elm.timer.now();
1920 diff = zero ? 0 : curr - prev;
21+ if (prev > curr) {
22+ diff = 0;
23+ }
2024 prev = curr;
2125 elm.notify(ticker.id, diff);
2226 };
runtime/Debugger.js+7−2
@@ -171,8 +171,8 @@ function debugModule(module, runtime) {
171171 }
172172
173173 function setContinue(position) {
174− var timerDelay = Date.now() - pauseTime;
175− runtime.timer.addDelay(timerDelay);
174+ var pauseDelay = Date.now() - pauseTime;
175+ runtime.timer.addDelay(pauseDelay);
176176 programPaused = false;
177177 if (position > 0) {
178178 // If we're not unpausing at the head, then we need to dump the
@@ -180,6 +180,11 @@ function debugModule(module, runtime) {
180180 var lastSnapshotPosition = Math.floor(position / EVENTS_PER_SAVE);
181181 eventsUntilSnapshot = EVENTS_PER_SAVE - (position % EVENTS_PER_SAVE);
182182 snapshots = snapshots.slice(0, lastSnapshotPosition + 1);
183+
184+ var lastEventTime = recordedEvents[position-1].timestep;
185+ var scrubTime = runtime.timer.now() - lastEventTime;
186+ runtime.timer.addDelay(scrubTime);
187+
183188 recordedEvents = recordedEvents.slice(0, position);
184189 tracePath.clearTracesAfter(position);
185190 eventCounter = position;
runtime/Init.js+1−1
@@ -47,7 +47,7 @@ function init(display, container, module, ports, moduleToReplace) {
4747 var addDelay = function(d) {
4848 inducedDelay += d;
4949 return inducedDelay;
50− }
50+ };
5151
5252 return { now : now
5353 , addDelay : addDelay