diff options
author | bobzel <zzzman@gmail.com> | 2020-09-09 13:07:33 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2020-09-09 13:07:33 -0400 |
commit | 320f18503439c7e490f259ed2ed7355ff72b4237 (patch) | |
tree | 69fc716767970cfaffa9608a6d1b074b3a1ffb86 | |
parent | 262361a9df317259e5182124f18537d4d3c14c43 (diff) |
fixed unpnning pdf annotations. remvoed unused UI from PDFmenu
-rw-r--r-- | src/client/views/nodes/PDFBox.scss | 8 | ||||
-rw-r--r-- | src/client/views/nodes/PDFBox.tsx | 13 | ||||
-rw-r--r-- | src/client/views/pdf/Annotation.tsx | 11 | ||||
-rw-r--r-- | src/client/views/pdf/PDFMenu.tsx | 12 | ||||
-rw-r--r-- | src/client/views/pdf/PDFViewer.tsx | 15 |
5 files changed, 34 insertions, 25 deletions
diff --git a/src/client/views/nodes/PDFBox.scss b/src/client/views/nodes/PDFBox.scss index f2ab37984..1c73ec8cb 100644 --- a/src/client/views/nodes/PDFBox.scss +++ b/src/client/views/nodes/PDFBox.scss @@ -189,8 +189,8 @@ margin-bottom: auto; transform-origin: 42% 15%; width: 100%; - transform: rotate(55deg); - font-size: 200; + transform: rotate(55deg) scale(0.8); + font-size: 80; padding: 5%; overflow: hidden; display: inline-block; @@ -202,6 +202,8 @@ } .pdfBox { + width: 100%; + height: 100%; .pdfViewerDash-text { .textLayer { span { @@ -212,6 +214,8 @@ } .pdfBox-interactive { + width: 100%; + height: 100%; pointer-events: all; .pdfViewerDash-text { .textLayer { diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index a2b406c3f..7bdbe3cae 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -191,7 +191,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps, PdfDocum onClick={action(() => this._pageControls = !this._pageControls)} /> {this._pageControls ? pageBtns : (null)} </div> - <div className="pdfBox-settingsCont" key="settings" onPointerDown={(e) => e.stopPropagation()}> + {/* <div className="pdfBox-settingsCont" key="settings" onPointerDown={(e) => e.stopPropagation()}> <button className="pdfBox-settingsButton" onClick={action(() => this._flyout = !this._flyout)} title="Open Annotation Settings" > <div className="pdfBox-settingsButton-arrow" style={{ transform: `scaleX(${this._flyout ? -1 : 1})` }} /> <div className="pdfBox-settingsButton-iconCont"> @@ -220,7 +220,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps, PdfDocum </button> </div> </div> - </div> + </div> */} </div>); } @@ -236,12 +236,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps, PdfDocum @computed get contentScaling() { return this.props.ContentScaling(); } @computed get renderTitleBox() { const classname = "pdfBox" + (this.active() ? "-interactive" : ""); - return <div className={classname} style={{ - width: !this.props.Document._fitWidth ? this.Document._nativeWidth || 0 : `${100 / this.contentScaling}%`, - //height adjusted for mobile (window.screen.width > 600) - height: !this.props.Document._fitWidth && (window.screen.width > 600) ? this.Document._nativeHeight || 0 : `${100 / this.contentScaling}%`, - transform: `scale(${this.contentScaling})` - }} > + return <div className={classname} > <div className="pdfBox-title-outer"> <strong className="pdfBox-title" >{this.props.Document.title}</strong> </div> @@ -270,7 +265,7 @@ export class PDFBox extends ViewBoxAnnotatableComponent<FieldViewProps, PdfDocum render() { const pdfUrl = Cast(this.dataDoc[this.props.fieldKey], PdfField, null); if (this.props.isSelected() || this.props.renderDepth === 0 || this.props.Document._scrollY !== undefined) this._everActive = true; - if (pdfUrl && (this._everActive || this.props.Document._scrollTop || (this.dataDoc[this.props.fieldKey + "-nativeWidth"] && this.props.ScreenToLocalTransform().Scale < 2.5))) { + if (pdfUrl && (this._everActive || this.props.Document._scrollTop)) { if (pdfUrl instanceof PdfField && this._pdf) { return this.renderPdfView; } diff --git a/src/client/views/pdf/Annotation.tsx b/src/client/views/pdf/Annotation.tsx index 222a6cb0f..5ec564e7b 100644 --- a/src/client/views/pdf/Annotation.tsx +++ b/src/client/views/pdf/Annotation.tsx @@ -12,7 +12,7 @@ import "./Annotation.scss"; interface IAnnotationProps { anno: Doc; addDocTab: (document: Doc, where: string) => boolean; - pinToPres: (document: Doc) => void; + pinToPres: (document: Doc, unpin?: boolean) => void; focus: (doc: Doc) => void; dataDoc: Doc; fieldKey: string; @@ -22,8 +22,8 @@ interface IAnnotationProps { export class Annotation extends React.Component<IAnnotationProps> { render() { - return DocListCast(this.props.anno.annotations).map(a => ( - <RegionAnnotation {...this.props} document={a} x={NumCast(a.x)} y={NumCast(a.y)} width={a[WidthSym]()} height={a[HeightSym]()} key={a[Id]} />)); + return DocListCast(this.props.anno.annotations).map(a => + <RegionAnnotation {...this.props} pinToPres={this.props.pinToPres} document={a} x={NumCast(a.x)} y={NumCast(a.y)} width={a[WidthSym]()} height={a[HeightSym]()} key={a[Id]} />); } } @@ -33,7 +33,7 @@ interface IRegionAnnotationProps { width: number; height: number; addDocTab: (document: Doc, where: string) => boolean; - pinToPres: (document: Doc) => void; + pinToPres: (document: Doc, unpin: boolean) => void; document: Doc; dataDoc: Doc; fieldKey: string; @@ -82,7 +82,8 @@ class RegionAnnotation extends React.Component<IRegionAnnotationProps> { pinToPres = () => { const group = FieldValue(Cast(this.props.document.group, Doc)); - group && this.props.pinToPres(group); + const isPinned = group && Doc.isDocPinned(group) ? true : false; + group && this.props.pinToPres(group, isPinned); } @action diff --git a/src/client/views/pdf/PDFMenu.tsx b/src/client/views/pdf/PDFMenu.tsx index 32dd376ac..c5ed75980 100644 --- a/src/client/views/pdf/PDFMenu.tsx +++ b/src/client/views/pdf/PDFMenu.tsx @@ -161,12 +161,12 @@ export class PDFMenu extends AntimodeMenu<AntimodeMenuProps> { <FontAwesomeIcon icon="trash-alt" size="lg" /></button>, <button key="6" className="antimodeMenu-button" title="Pin to Presentation" onPointerDown={this.PinToPres}> <FontAwesomeIcon icon="map-pin" size="lg" /></button>, - <div key="7" className="pdfMenu-addTag" > - <input onChange={this.keyChanged} placeholder="Key" style={{ gridColumn: 1 }} /> - <input onChange={this.valueChanged} placeholder="Value" style={{ gridColumn: 3 }} /> - </div>, - <button key="8" className="antimodeMenu-button" title={`Add tag: ${this._keyValue} with value: ${this._valueValue}`} onPointerDown={this.addTag}> - <FontAwesomeIcon style={{ transition: "all .2s" }} color={this._added ? "#42f560" : "white"} icon="check" size="lg" /></button>, + // <div key="7" className="pdfMenu-addTag" > + // <input onChange={this.keyChanged} placeholder="Key" style={{ gridColumn: 1 }} /> + // <input onChange={this.valueChanged} placeholder="Value" style={{ gridColumn: 3 }} /> + // </div>, + // <button key="8" className="antimodeMenu-button" title={`Add tag: ${this._keyValue} with value: ${this._valueValue}`} onPointerDown={this.addTag}> + // <FontAwesomeIcon style={{ transition: "all .2s" }} color={this._added ? "#42f560" : "white"} icon="check" size="lg" /></button>, ]; return this.getElement(buttons); diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 8afb041b9..03ccca019 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -72,7 +72,7 @@ interface IViewerProps { active: (outsideReaction?: boolean) => boolean; isChildActive: (outsideReaction?: boolean) => boolean; addDocTab: (document: Doc, where: string) => boolean; - pinToPres: (document: Doc) => void; + pinToPres: (document: Doc, unpin?: boolean) => void; addDocument?: (doc: Doc) => boolean; setPdfViewer: (view: PDFViewer) => void; ScreenToLocalTransform: () => Transform; @@ -224,7 +224,11 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu await this.initialLoad(); this._disposers.scrollTop = reaction(() => Cast(this.layoutDoc._scrollTop, "number", null), - (stop) => (stop !== undefined && this.layoutDoc._scrollY === undefined && this._mainCont.current) && (this._mainCont.current.scrollTop = stop), + (stop) => { + if (stop !== undefined && this.layoutDoc._scrollY === undefined && this._mainCont.current) { + (this._mainCont.current.scrollTop = stop); + } + }, { fireImmediately: true }); this._disposers.filterScript = reaction( @@ -362,10 +366,15 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu } + pageDelay: any; @action onScroll = (e: React.UIEvent<HTMLElement>) => { this.Document._scrollY === undefined && (this.layoutDoc._scrollTop = this._mainCont.current!.scrollTop); - this._pdfViewer && (this.Document._curPage = this._pdfViewer.currentPageNumber); + this.pageDelay && clearTimeout(this.pageDelay); + this.pageDelay = setTimeout(() => { + this.pageDelay = undefined; + this._pdfViewer && (this.Document._curPage = this._pdfViewer.currentPageNumber); + }, 250); } // get the page index that the vertical offset passed in is on |