Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jkgenser committed Oct 14, 2024
1 parent 06e505f commit c770de7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 3 additions & 4 deletions demo/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import "./App.css";

import "react-pdf/dist/Page/TextLayer.css";
import "react-pdf/dist/Page/AnnotationLayer.css";
import "react-pdf/dist/Page/TextLayer.css";

import { pdfjs } from "react-pdf";
import { Reader } from "../src/index";
import React, { ChangeEvent, useEffect, useRef, useState } from "react";
import { Page, pdfjs } from "react-pdf";
import { Reader } from "../src/index";
import { PageChangeEvent, ReaderAPI, RenderPageProps } from "../src/types";
import { Page } from "react-pdf";
import TestHighlightsLayer from "./TestHighlights";
import { highlightData } from "./highlightData";

Expand Down
10 changes: 9 additions & 1 deletion src/Reader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ const Reader = ({
const startTime = (scrollingRef.current = Date.now());
// setIsSystemScrolling(true);

// if we are in auto scroll mode, then immediately scroll
// to the offset and not display any animation. For example if scroll
// immediately to a rescaled offset if zoom/scale has just been changed
if (canSmooth.behavior === "auto") {
elementScroll(offset, canSmooth, instance);
return;
}

const run = () => {
if (scrollingRef.current !== startTime) return;
const now = Date.now();
Expand Down Expand Up @@ -206,7 +214,7 @@ const Reader = ({
const jumpToPage = (pageIndex: number) => {
virtualizer.scrollToIndex(pageIndex, {
align: "start",
// behavior: "smooth",
behavior: "smooth",
});
};

Expand Down

0 comments on commit c770de7

Please # to comment.