diff options
| author | yipstanley <stanley_yip@brown.edu> | 2019-06-14 12:50:55 -0400 |
|---|---|---|
| committer | yipstanley <stanley_yip@brown.edu> | 2019-06-14 12:50:55 -0400 |
| commit | 4818b12510404e7d9cf07b7e872c49d7b752976a (patch) | |
| tree | 8c815f134d6909e476bee68db99541b6b0e0c353 /src/client/views/pdf | |
| parent | 94ed67966e7fdc7aa36b1a8b045153d0d661ce57 (diff) | |
| parent | 41c290677030cde827c438d9bfda0dbeac64aa14 (diff) | |
Merge branch 'pdf_impl' of https://github.com/browngraphicslab/Dash-Web into pdf_impl
Diffstat (limited to 'src/client/views/pdf')
| -rw-r--r-- | src/client/views/pdf/PDFMenu.scss | 18 | ||||
| -rw-r--r-- | src/client/views/pdf/PDFMenu.tsx | 28 | ||||
| -rw-r--r-- | src/client/views/pdf/PDFViewer.scss | 2 | ||||
| -rw-r--r-- | src/client/views/pdf/PDFViewer.tsx | 12 | ||||
| -rw-r--r-- | src/client/views/pdf/Page.tsx | 3 |
5 files changed, 55 insertions, 8 deletions
diff --git a/src/client/views/pdf/PDFMenu.scss b/src/client/views/pdf/PDFMenu.scss new file mode 100644 index 000000000..b84ebc12d --- /dev/null +++ b/src/client/views/pdf/PDFMenu.scss @@ -0,0 +1,18 @@ +.pdfMenu-cont { + position: absolute; + z-index: 10000; + width: 100px; + height: 30px; + background: #323232; + box-shadow: 3px 3px 3px rgba(0, 0, 0, 0.25); + border-radius: 0px 4px 4px 4px; + overflow: hidden; + + .pdfMenu-button { + background-color: transparent; + } + + .pdfMenu-button:hover { + background-color: #121212; + } +}
\ No newline at end of file diff --git a/src/client/views/pdf/PDFMenu.tsx b/src/client/views/pdf/PDFMenu.tsx new file mode 100644 index 000000000..cc5c0b77b --- /dev/null +++ b/src/client/views/pdf/PDFMenu.tsx @@ -0,0 +1,28 @@ +import React = require("react"); +import "./PDFMenu.scss"; +import { observable } from "mobx"; +import { observer } from "mobx-react"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; + +@observer +export default class PDFMenu extends React.Component { + static Instance: PDFMenu; + + @observable Top: number = 0; + @observable Left: number = 0; + + constructor(props: Readonly<{}>) { + super(props); + + PDFMenu.Instance = this; + } + + render() { + return ( + <div className="pdfMenu-cont" style={{ left: this.Left, top: this.Top }}> + <button className="pdfMenu-button" title="Highlight"><FontAwesomeIcon icon="highlighter" size="sm" /></button> + <button className="pdfMenu-button" title="Annotate"><FontAwesomeIcon icon="comment-alt" size="sm" /></button> + </div> + ) + } +}
\ No newline at end of file diff --git a/src/client/views/pdf/PDFViewer.scss b/src/client/views/pdf/PDFViewer.scss index a73df2d58..53c33ce0b 100644 --- a/src/client/views/pdf/PDFViewer.scss +++ b/src/client/views/pdf/PDFViewer.scss @@ -35,6 +35,8 @@ top: 0; } + + .pdfViewer-pinAnnotation { background-color: red; position: absolute; diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 144fca9e0..d6081142a 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -103,22 +103,22 @@ class Viewer extends React.Component<IViewerProps> { @action componentDidMount = () => { - let wasSelected = this.props.parent.props.isSelected(); + let wasSelected = this.props.parent.props.active(); // reaction for when document gets (de)selected this._reactionDisposer = reaction( - () => [this.props.parent.props.isSelected(), this.startIndex], + () => [this.props.parent.props.active(), this.startIndex], () => { // if deselected, render images in place of pdf - if (wasSelected && !this.props.parent.props.isSelected()) { + if (wasSelected && !this.props.parent.props.active()) { this.saveThumbnail(); this._pointerEvents = "all"; } // if selected, render pdf - else if (!wasSelected && this.props.parent.props.isSelected()) { + else if (!wasSelected && this.props.parent.props.active()) { this.renderPages(this.startIndex, this.endIndex, true); this._pointerEvents = "none"; } - wasSelected = this.props.parent.props.isSelected(); + wasSelected = this.props.parent.props.active(); }, { fireImmediately: true } ); @@ -586,7 +586,7 @@ class PinAnnotation extends React.Component<IAnnotationProps> { PanelWidth={() => NumCast(this.props.parent.props.parent.Document.nativeWidth)} PanelHeight={() => NumCast(this.props.parent.props.parent.Document.nativeHeight)} focus={emptyFunction} - selectOnLoad={true} + selectOnLoad={false} parentActive={this.props.parent.props.parent.props.active} whenActiveChanged={this.props.parent.props.parent.props.whenActiveChanged} bringToFront={emptyFunction} diff --git a/src/client/views/pdf/Page.tsx b/src/client/views/pdf/Page.tsx index 2c237740c..bdb6952cc 100644 --- a/src/client/views/pdf/Page.tsx +++ b/src/client/views/pdf/Page.tsx @@ -196,7 +196,6 @@ export default class Page extends React.Component<IPageProps> { e.stopPropagation(); } else { - e.stopPropagation(); // set marquee x and y positions to the spatially transformed position let current = this._textLayer.current; if (current) { @@ -399,7 +398,7 @@ export default class Page extends React.Component<IPageProps> { render() { return ( - <div onPointerDown={this.onPointerDown} onDoubleClick={this.doubleClick} className={this.props.name} style={{ "width": this._width, "height": this._height }}> + <div onPointerDown={this.onPointerDown} onDoubleClick={this.doubleClick} className={"page-cont"} style={{ "width": this._width, "height": this._height }}> <div className="canvasContainer"> <canvas ref={this._canvas} /> </div> |
