aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-09-24 18:30:18 -0400
committeryipstanley <stanley_yip@brown.edu>2019-09-24 18:30:18 -0400
commit1a12483b52c27259f0f2762d4369a79e1397af9c (patch)
tree9fca82bd3268912e60a6bf2e233f56622f53a4bb /src/client/views/nodes
parentc3e5b50ed59f474cddace89ad4ca25f2ef0c2f74 (diff)
ahhhh
Diffstat (limited to 'src/client/views/nodes')
-rw-r--r--src/client/views/nodes/PDFBox.scss148
-rw-r--r--src/client/views/nodes/PDFBox.tsx12
2 files changed, 75 insertions, 85 deletions
diff --git a/src/client/views/nodes/PDFBox.scss b/src/client/views/nodes/PDFBox.scss
index c88a94c28..b55ca8ba5 100644
--- a/src/client/views/nodes/PDFBox.scss
+++ b/src/client/views/nodes/PDFBox.scss
@@ -5,23 +5,15 @@
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
- .pdfBox-scrollHack {
- pointer-events: none;
- }
}
.pdfBox-cont {
pointer-events: none;
- .pdfPage-textlayer {
- span {
- pointer-events: none !important;
- user-select: none;
- }
- }
}
.pdfBox-cont-interactive {
pointer-events: all;
+
.pdfPage-textlayer {
span {
pointer-events: all !important;
@@ -30,82 +22,90 @@
}
}
-.react-pdf__Page {
- transform-origin: left top;
- position: absolute;
- top: 0;
- left: 0;
-}
+.pdfViewer-text {
+ .textLayer {
+ span {
+ user-select: text;
+ }
+ }
-.react-pdf__Page__textContent span {
- user-select: text;
-}
+ .react-pdf__Page {
+ transform-origin: left top;
+ position: absolute;
+ top: 0;
+ left: 0;
+ }
-.react-pdf__Document {
- position: absolute;
-}
+ .react-pdf__Page__textContent span {
+ user-select: text;
+ }
+ .react-pdf__Document {
+ position: absolute;
+ }
-.pdfBox-settingsCont {
- position: absolute;
- right: 0;
- top: 0;
-
- .pdfBox-settingsButton {
- border-bottom-left-radius: 50%;
- display: flex;
- justify-content: space-evenly;
- align-items: center;
- height: 70px;
- background: none;
- padding: 0;
-
- .pdfBox-settingsButton-arrow {
- width: 0;
- height: 0;
- border-top: 25px solid transparent;
- border-bottom: 25px solid transparent;
- border-right: 25px solid #121721;
- transition: all 0.5s;
- }
- .pdfBox-settingsButton-iconCont {
- background: #121721;
- height: 50px;
- width: 70px;
+ .pdfBox-settingsCont {
+ position: absolute;
+ right: 0;
+ top: 0;
+
+ .pdfBox-settingsButton {
+ border-bottom-left-radius: 50%;
display: flex;
- justify-content: center;
+ justify-content: space-evenly;
align-items: center;
- margin-left: -2px;
- border-radius: 3px;
- }
- }
+ height: 70px;
+ background: none;
+ padding: 0;
- .pdfBox-settingsButton:hover {
- background: none;
- }
+ .pdfBox-settingsButton-arrow {
+ width: 0;
+ height: 0;
+ border-top: 25px solid transparent;
+ border-bottom: 25px solid transparent;
+ border-right: 25px solid #121721;
+ transition: all 0.5s;
+ }
- .pdfBox-settingsFlyout {
- width: 600px;
- position: absolute;
- background: #323232;
- box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.25);
- left: -400px;
- border-radius: 7px;
- padding: 20px;
- display: flex;
- flex-direction: column;
- font-size: 30px;
- transition: all 0.5s;
-
- .pdfBox-settingsFlyout-title {
- color: white;
+ .pdfBox-settingsButton-iconCont {
+ background: #121721;
+ height: 50px;
+ width: 70px;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ margin-left: -2px;
+ border-radius: 3px;
+ }
+ }
+
+ .pdfBox-settingsButton:hover {
+ background: none;
}
- .pdfBox-settingsFlyout-kvpInput {
- margin-top: 20px;
- display: grid;
- grid-template-columns: 47.5% 5% 47.5%;
+ .pdfBox-settingsFlyout {
+ width: 600px;
+ position: absolute;
+ background: #323232;
+ box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.25);
+ left: -400px;
+ border-radius: 7px;
+ padding: 20px;
+ display: flex;
+ flex-direction: column;
+ font-size: 30px;
+ transition: all 0.5s;
+
+ .pdfBox-settingsFlyout-title {
+ color: white;
+ }
+
+ .pdfBox-settingsFlyout-kvpInput {
+ margin-top: 20px;
+ display: grid;
+ grid-template-columns: 47.5% 5% 47.5%;
+ }
}
}
} \ No newline at end of file
diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx
index 764051d62..8471aefe0 100644
--- a/src/client/views/nodes/PDFBox.tsx
+++ b/src/client/views/nodes/PDFBox.tsx
@@ -52,10 +52,6 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen
if (pdfUrl instanceof PdfField) {
Pdfjs.getDocument(pdfUrl.url.pathname).promise.then(pdf => runInAction(() => this._pdf = pdf));
}
- this._reactionDisposer = reaction(
- () => this.Document.panY,
- () => this._mainCont.current && this._mainCont.current.scrollTo({ top: this.Document.panY || 0, behavior: "auto" })
- );
}
componentWillUnmount() {
@@ -167,16 +163,11 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen
this.Document.nativeWidth = nw;
this.Document.nativeHeight = this.Document.nativeHeight ? nw * oldaspect : nh;
this.Document.height = this.Document[WidthSym]() * (nh / nw);
- this.Document.scrollHeight = np * this.Document.nativeHeight;
}
}
- @action
onScroll = (e: React.UIEvent<HTMLDivElement>) => {
- if (e.currentTarget && this.props.ContainingCollectionDoc) {
- this.props.Document.panTransformType = "None";
- this.Document.panY = e.currentTarget.scrollTop;
- }
+ e.stopPropagation();
}
@@ -189,7 +180,6 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen
onScroll={this.onScroll}
style={{ marginTop: `${(this.Document.panY || 0)}px` }}
ref={this._mainCont}>
- <div className="pdfBox-scrollHack" style={{ height: NumCast(this.props.Document.scrollHeight) + ((this.Document.nativeHeight || 0) - (this.Document.nativeHeight || 0) / (this.Document.scale || 1)) }} />
<PDFViewer pdf={this._pdf} url={pdfUrl.url.pathname} active={this.props.active} scrollTo={this.scrollTo} loaded={this.loaded} panY={this.Document.panY || 0}
Document={this.props.Document} DataDoc={this.dataDoc}
addDocTab={this.props.addDocTab} setPanY={this.setPanY} GoToPage={this.GotoPage}