Skip to content

Commit

Permalink
Catch more undefined things
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Dec 5, 2023
1 parent 7c71dac commit 5d55de8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/util/visibility.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Adapted from https://svelte.dev/repl/ead0f1fcd2d4402bbbd64eca1d665341?version=3.14.1

export function showIfFullyVisible(el) {
// for very old browsers we don't support, bail
if (typeof window.IntersectionObserver === "undefined") return;

const setVisible = (visibility) => {
el.style.visibility = visibility ? "visible" : "hidden";
};
Expand Down
3 changes: 2 additions & 1 deletion src/viewer/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ class Doc extends Svue {
if (this.scrollzoom == null) return resolve();

const scrollTop =
(this.scrollzoom.components[pageNumber].y - this.layout.pageGap / 4) *
(this.scrollzoom.components[pageNumber]?.y -
this.layout.pageGap / 4) *
this.scrollzoom.transform.matrix[0];
if (this.scrollzoom.element != null) {
this.scrollzoom.scrollTo(scrollTop);
Expand Down

0 comments on commit 5d55de8

Please sign in to comment.