@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.
@@ -41689,9 +41689,12 @@ const RouteTravel = ({
41689
41689
  const row = rowRef.current;
41690
41690
  // Already moving, so there is no ease-in to play: it would stall the row for an
41691
41691
  // instant right where the eye is following it.
41692
- const inFlight = Boolean(movement.playing) || Boolean(movement.rowTaken);
41693
- if (movement.playing) {
41694
- movement.playing.stop();
41692
+ const replaced = movement.playing;
41693
+ const inFlight = Boolean(replaced) || Boolean(movement.rowTaken);
41694
+ if (replaced) {
41695
+ // Its frames only: the row stays travelling across the hand-over. Let go of,
41696
+ // it snaps to the nearest page at the read below, and the travel starts there.
41697
+ replaced.cancelFrame();
41695
41698
  }
41696
41699
  const from = row.scrollLeft;
41697
41700
  const {
@@ -41714,8 +41717,11 @@ const RouteTravel = ({
41714
41717
  const playing = {
41715
41718
  // Where this travel put the row, for a scroll event to tell it from a hand.
41716
41719
  written: from,
41717
- stop: () => {
41720
+ cancelFrame: () => {
41718
41721
  cancelAnimationFrame(frame);
41722
+ },
41723
+ stop: () => {
41724
+ playing.cancelFrame();
41719
41725
  if (movement.playing === playing) {
41720
41726
  movement.playing = null;
41721
41727
  row.removeAttribute("data-route-row-travelling");
@@ -41724,9 +41730,12 @@ const RouteTravel = ({
41724
41730
  };
41725
41731
  const step = now => {
41726
41732
  if (start === null) {
41727
- start = now;
41733
+ // When this frame runs, not when it began: under load it began while the
41734
+ // press was still being handled, and that time is no travel.
41735
+ start = performance.now();
41728
41736
  }
41729
- const elapsed = (now - start) / travelMs;
41737
+ // The next frame may have begun while this first one was still being handled.
41738
+ const elapsed = now > start ? (now - start) / travelMs : 0;
41730
41739
  // Read at every frame: the layout may move under the travel (a scrollbar
41731
41740
  // coming in narrows the row), and it goes where the page stands.
41732
41741
  const to = pane.offsetLeft;