aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-08-07 12:50:58 -0400
committerbob <bcz@cs.brown.edu>2019-08-07 12:50:58 -0400
commit221acd0cfb4831435d1d1b61b86c2cc5e3d3b413 (patch)
tree41a96b231dafdfb54980882ac13265b1ca6aef6b /src/client/views/collections
parentadb91b035bd18ff407ce0b2decc07c779282c008 (diff)
got rid of scrollY from pdfs!
Diffstat (limited to 'src/client/views/collections')
-rw-r--r--src/client/views/collections/CollectionPDFView.tsx16
-rw-r--r--src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx6
2 files changed, 3 insertions, 19 deletions
diff --git a/src/client/views/collections/CollectionPDFView.tsx b/src/client/views/collections/CollectionPDFView.tsx
index 3736ebada..8eda4d9ee 100644
--- a/src/client/views/collections/CollectionPDFView.tsx
+++ b/src/client/views/collections/CollectionPDFView.tsx
@@ -1,7 +1,6 @@
-import { action, IReactionDisposer, observable, reaction, computed } from "mobx";
+import { computed } from "mobx";
import { observer } from "mobx-react";
import { Id } from "../../../new_fields/FieldSymbols";
-import { NumCast } from "../../../new_fields/Types";
import { emptyFunction } from "../../../Utils";
import { ContextMenu } from "../ContextMenu";
import { FieldView, FieldViewProps } from "../nodes/FieldView";
@@ -19,21 +18,8 @@ export class CollectionPDFView extends React.Component<FieldViewProps> {
}
private _pdfBox?: PDFBox;
- private _reactionDisposer?: IReactionDisposer;
private _buttonTray: React.RefObject<HTMLDivElement> = React.createRef();
- componentDidMount() {
- this._reactionDisposer = reaction(
- () => NumCast(this.props.Document.scrollY),
- () => this.props.Document.panY = NumCast(this.props.Document.scrollY),
- { fireImmediately: true }
- );
- }
-
- componentWillUnmount() {
- this._reactionDisposer && this._reactionDisposer();
- }
-
@computed
get uIButtons() {
return (
diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
index d347e02b6..8322625f1 100644
--- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx
@@ -352,7 +352,7 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) {
@action
onPointerWheel = (e: React.WheelEvent): void => {
if (BoolCast(this.props.Document.lockedPosition)) return;
- if (!e.ctrlKey && this.props.Document.scrollY !== undefined) {
+ if (!e.ctrlKey && this.props.Document.scrollHeight !== undefined) { // things that can scroll vertically should do that instead of zooming
e.stopPropagation();
return;
}
@@ -367,7 +367,7 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) {
e.stopPropagation();
// bcz: this changes the nativewidth/height, but ImageBox will just revert it back to its defaults. need more logic to fix.
- // if (e.ctrlKey && this.props.Document.scrollY === undefined) {
+ // if (e.ctrlKey && this.props.Document.scrollHeight === undefined) {
// let deltaScale = (1 - (e.deltaY / coefficient));
// let nw = this.nativeWidth * deltaScale;
// let nh = this.nativeHeight * deltaScale;
@@ -403,8 +403,6 @@ export class CollectionFreeFormView extends CollectionSubView(PanZoomDocument) {
const newPanY = Math.min((this.props.Document.scrollHeight !== undefined ? NumCast(this.props.Document.scrollHeight) : (1 - 1 / scale) * this.nativeHeight), Math.max(0, panY));
this.props.Document.panX = this.isAnnotationOverlay ? newPanX : panX;
this.props.Document.panY = this.isAnnotationOverlay ? newPanY : panY;
- if (this.props.Document.scrollHeight !== undefined) this.props.Document.scrollY = this.isAnnotationOverlay ? newPanY : panY;
- else this.props.Document.panY = this.isAnnotationOverlay ? newPanY : panY;
}
}