on master help sign in
Merge pull request #721 from michaelbjames/bugfix/718
c3d3c33Evan Czaplicki
libraries/Native/Signal/Time.js+5−1
@@ -14,9 +14,13 @@ Elm.Native.Time.make = function(elm) {
14 var msPerFrame = 1000 / desiredFPS;
14 var msPerFrame = 1000 / desiredFPS;
15 var prev = elm.timer.now(), curr = prev, diff = 0, wasOn = true;
15 var prev = elm.timer.now(), curr = prev, diff = 0, wasOn = true;
16 var ticker = NS.input(diff);
16 var ticker = NS.input(diff);
17− function tick(zero) { return function() {
17+ function tick(zero) {
18+ return function() {
18 curr = elm.timer.now();
19 curr = elm.timer.now();
19 diff = zero ? 0 : curr - prev;
20 diff = zero ? 0 : curr - prev;
21+ if (prev > curr) {
22+ diff = 0;
23+ }
20 prev = curr;
24 prev = curr;
21 elm.notify(ticker.id, diff);
25 elm.notify(ticker.id, diff);
22 };
26 };
runtime/Debugger.js+7−2
@@ -171,8 +171,8 @@ function debugModule(module, runtime) {
171 }
171 }
172
172
173 function setContinue(position) {
173 function setContinue(position) {
174− var timerDelay = Date.now() - pauseTime;
174+ var pauseDelay = Date.now() - pauseTime;
175− runtime.timer.addDelay(timerDelay);
175+ runtime.timer.addDelay(pauseDelay);
176 programPaused = false;
176 programPaused = false;
177 if (position > 0) {
177 if (position > 0) {
178 // If we're not unpausing at the head, then we need to dump the
178 // If we're not unpausing at the head, then we need to dump the
@@ -180,6 +180,11 @@ function debugModule(module, runtime) {
180 var lastSnapshotPosition = Math.floor(position / EVENTS_PER_SAVE);
180 var lastSnapshotPosition = Math.floor(position / EVENTS_PER_SAVE);
181 eventsUntilSnapshot = EVENTS_PER_SAVE - (position % EVENTS_PER_SAVE);
181 eventsUntilSnapshot = EVENTS_PER_SAVE - (position % EVENTS_PER_SAVE);
182 snapshots = snapshots.slice(0, lastSnapshotPosition + 1);
182 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+
183 recordedEvents = recordedEvents.slice(0, position);
188 recordedEvents = recordedEvents.slice(0, position);
184 tracePath.clearTracesAfter(position);
189 tracePath.clearTracesAfter(position);
185 eventCounter = position;
190 eventCounter = position;
runtime/Init.js+1−1
@@ -47,7 +47,7 @@ function init(display, container, module, ports, moduleToReplace) {
47 var addDelay = function(d) {
47 var addDelay = function(d) {
48 inducedDelay += d;
48 inducedDelay += d;
49 return inducedDelay;
49 return inducedDelay;
50− }
50+ };
51
51
52 return { now : now
52 return { now : now
53 , addDelay : addDelay
53 , addDelay : addDelay