@jsenv/navi 0.30.31 → 0.30.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -42989,9 +42989,12 @@ const RouteTravel = ({
42989
42989
  const row = rowRef.current;
42990
42990
  // Already moving, so there is no ease-in to play: it would stall the row for an
42991
42991
  // instant right where the eye is following it.
42992
- const inFlight = Boolean(movement.playing) || Boolean(movement.rowTaken);
42993
- if (movement.playing) {
42994
- movement.playing.stop();
42992
+ const replaced = movement.playing;
42993
+ const inFlight = Boolean(replaced) || Boolean(movement.rowTaken);
42994
+ if (replaced) {
42995
+ // Its frames only: the row stays travelling across the hand-over. Let go of,
42996
+ // it snaps to the nearest page at the read below, and the travel starts there.
42997
+ replaced.cancelFrame();
42995
42998
  }
42996
42999
  const from = row.scrollLeft;
42997
43000
  const {
@@ -43014,8 +43017,11 @@ const RouteTravel = ({
43014
43017
  const playing = {
43015
43018
  // Where this travel put the row, for a scroll event to tell it from a hand.
43016
43019
  written: from,
43017
- stop: () => {
43020
+ cancelFrame: () => {
43018
43021
  cancelAnimationFrame(frame);
43022
+ },
43023
+ stop: () => {
43024
+ playing.cancelFrame();
43019
43025
  if (movement.playing === playing) {
43020
43026
  movement.playing = null;
43021
43027
  row.removeAttribute("data-route-row-travelling");
@@ -43024,9 +43030,12 @@ const RouteTravel = ({
43024
43030
  };
43025
43031
  const step = now => {
43026
43032
  if (start === null) {
43027
- start = now;
43033
+ // When this frame runs, not when it began: under load it began while the
43034
+ // press was still being handled, and that time is no travel.
43035
+ start = performance.now();
43028
43036
  }
43029
- const elapsed = (now - start) / travelMs;
43037
+ // The next frame may have begun while this first one was still being handled.
43038
+ const elapsed = now > start ? (now - start) / travelMs : 0;
43030
43039
  // Read at every frame: the layout may move under the travel (a scrollbar
43031
43040
  // coming in narrows the row), and it goes where the page stands.
43032
43041
  const to = pane.offsetLeft;