From 8538a83baf57d7015b62b4ebc22d2bd7318f9d16 Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 19 Jan 2021 15:02:03 -0500 Subject: fixed isPushpin annotation behavior outside of PDFs. fixed link follow highlighting to go away when target is hidden. --- src/client/views/MarqueeAnnotator.tsx | 2 +- src/client/views/animationtimeline/Timeline.tsx | 3 ++- .../views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 5 +++-- src/client/views/pdf/PDFMenu.tsx | 4 ++-- src/client/views/pdf/PDFViewer.tsx | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/views/MarqueeAnnotator.tsx b/src/client/views/MarqueeAnnotator.tsx index fe9c954ca..21048ebe2 100644 --- a/src/client/views/MarqueeAnnotator.tsx +++ b/src/client/views/MarqueeAnnotator.tsx @@ -40,7 +40,7 @@ export class MarqueeAnnotator extends React.Component { constructor(props: any) { super(props); runInAction(() => { - PDFMenu.Instance.Status = "pdf"; + PDFMenu.Instance.Status = "marquee"; PDFMenu.Instance.fadeOut(true); // clear out old marquees and initialize menu for new selection this.props.savedAnnotations.values().forEach(v => v.forEach(a => a.remove())); diff --git a/src/client/views/animationtimeline/Timeline.tsx b/src/client/views/animationtimeline/Timeline.tsx index 093310755..66afad0ac 100644 --- a/src/client/views/animationtimeline/Timeline.tsx +++ b/src/client/views/animationtimeline/Timeline.tsx @@ -12,6 +12,7 @@ import "./Timeline.scss"; import { TimelineOverview } from "./TimelineOverview"; import { Track } from "./Track"; import clamp from "../../util/clamp"; +import { DocumentType } from "../../documents/DocumentTypes"; /** * Timeline class controls most of timeline functions besides individual keyframe and track mechanism. Main functions are @@ -75,7 +76,7 @@ export class Timeline extends React.Component { */ @computed private get children(): Doc[] { - const annotatedDoc = ["image", "video", "pdf"].includes(StrCast(this.props.Document.type)); + const annotatedDoc = [DocumentType.IMG, DocumentType.VID, DocumentType.PDF].includes(StrCast(this.props.Document.type) as any); if (annotatedDoc) { return DocListCast(this.props.Document[Doc.LayoutFieldKey(this.props.Document) + "-annotations"]); } diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index f934fcd92..588ba6922 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -945,17 +945,18 @@ export class CollectionFreeFormView extends CollectionSubView { afterFocus && setTimeout(() => { // @ts-ignore - if (afterFocus?.(didFocus || (newPanX !== savedState.px || newPanY !== savedState.py))) { + if (afterFocus?.(!dontCenter && (didFocus || (newPanX !== savedState.px || newPanY !== savedState.py)))) { this.Document._panX = savedState.px; this.Document._panY = savedState.py; this.Document[this.scaleFieldKey] = savedState.s; this.Document._viewTransition = savedState.pt; } + doc.hidden && Doc.UnHighlightDoc(doc); }, newPanX !== savedState.px || newPanY !== savedState.py ? 500 : 0); return false; }; this.props.focus(this.props.Document, undefined, undefined, newAfterFocus, undefined, newDidFocus); - Doc.linkFollowHighlight(doc); + !doc.hidden && Doc.linkFollowHighlight(doc); } } diff --git a/src/client/views/pdf/PDFMenu.tsx b/src/client/views/pdf/PDFMenu.tsx index 1f8872e3d..603e26021 100644 --- a/src/client/views/pdf/PDFMenu.tsx +++ b/src/client/views/pdf/PDFMenu.tsx @@ -39,7 +39,7 @@ export class PDFMenu extends AntimodeMenu { @observable public _colorBtn = false; @observable public Highlighting: boolean = false; - @observable public Status: "pdf" | "annotation" | "" = ""; + @observable public Status: "marquee" | "annotation" | "" = ""; public StartDrag: (e: PointerEvent, ele: HTMLElement) => void = unimplementedFunction; public Highlight: (color: string) => Opt = (color: string) => undefined; @@ -119,7 +119,7 @@ export class PDFMenu extends AntimodeMenu { } render() { - const buttons = this.Status === "pdf" ? + const buttons = this.Status === "marquee" ? [ this.highlighter, diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx index 26f936c66..f9139220b 100644 --- a/src/client/views/pdf/PDFViewer.tsx +++ b/src/client/views/pdf/PDFViewer.tsx @@ -388,7 +388,7 @@ export class PDFViewer extends ViewBoxAnnotatableComponent v.forEach(a => a.remove())); this._savedAnnotations.clear(); -- cgit v1.2.3-70-g09d2