mirror of
https://github.com/xiaoqidun/ofdgo.git
synced 2026-10-29 17:27:08 +08:00
This commit is contained in:
1 parent
367a9b98e9
commit
a3fdf7e57d
1 file changed
+11
-4
+11
-4
@@ -1250,7 +1250,10 @@ async function openDocument(options = {}) {
|
|||||||
state.doc = doc;
|
state.doc = doc;
|
||||||
state.pageIndex = pageIndex;
|
state.pageIndex = pageIndex;
|
||||||
state.scale = options.scale || 1;
|
state.scale = options.scale || 1;
|
||||||
state.fitMode = options.fitMode || "width";
|
if (!options.fitMode) {
|
||||||
|
setContinuous(window.matchMedia("(max-width: 640px)").matches);
|
||||||
|
}
|
||||||
|
state.fitMode = options.fitMode || (!state.continuous && pageCount === 1 ? "height" : "width");
|
||||||
if (!options.skipAutoFonts && await autoLoadDocumentLocalFonts(openSeq)) {
|
if (!options.skipAutoFonts && await autoLoadDocumentLocalFonts(openSeq)) {
|
||||||
if (openSeq !== state.openSeq) {
|
if (openSeq !== state.openSeq) {
|
||||||
return;
|
return;
|
||||||
@@ -2406,11 +2409,15 @@ function fontMeta(font) {
|
|||||||
return parts.join(" · ");
|
return parts.join(" · ");
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleContinuous() {
|
function setContinuous(continuous) {
|
||||||
const anchor = state.fitMode === "free" ? scaleAnchor() : null;
|
state.continuous = continuous;
|
||||||
state.continuous = !state.continuous;
|
|
||||||
el.pageFrame.classList.toggle("continuous", state.continuous);
|
el.pageFrame.classList.toggle("continuous", state.continuous);
|
||||||
el.continuousButton.setAttribute("aria-pressed", String(state.continuous));
|
el.continuousButton.setAttribute("aria-pressed", String(state.continuous));
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleContinuous() {
|
||||||
|
const anchor = state.fitMode === "free" ? scaleAnchor() : null;
|
||||||
|
setContinuous(!state.continuous);
|
||||||
clearStampHighlights();
|
clearStampHighlights();
|
||||||
if (state.fitMode === "free") {
|
if (state.fitMode === "free") {
|
||||||
restoreScaleAnchor(anchor);
|
restoreScaleAnchor(anchor);
|
||||||
|
|||||||
Reference in new issue
Block a user