diff options
author | bobzel <zzzman@gmail.com> | 2021-01-19 15:02:03 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2021-01-19 15:02:03 -0500 |
commit | 8538a83baf57d7015b62b4ebc22d2bd7318f9d16 (patch) | |
tree | 7791f2514df785a3a14cf866e7ba47305be88526 | |
parent | 28bed25b20f2882cb40e616e2ecdd7cf0793e105 (diff) |
fixed isPushpin annotation behavior outside of PDFs. fixed link follow highlighting to go away when target is hidden.
-rw-r--r-- | src/client/views/MarqueeAnnotator.tsx | 2 | ||||
-rw-r--r-- | src/client/views/animationtimeline/Timeline.tsx | 3 | ||||
-rw-r--r-- | src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx | 5 | ||||
-rw-r--r-- | src/client/views/pdf/PDFMenu.tsx | 4 | ||||
-rw-r--r-- | src/client/views/pdf/PDFViewer.tsx | 2 |
5 files changed, 9 insertions, 7 deletions
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<MarqueeAnnotatorProps> { 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<FieldViewProps> { */ @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<PanZoomDocument, P const newAfterFocus = (didFocus: boolean) => { 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<AntimodeMenuProps> { @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<Doc> = (color: string) => undefined; @@ -119,7 +119,7 @@ export class PDFMenu extends AntimodeMenu<AntimodeMenuProps> { } 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<IViewerProps, PdfDocu this._marqueeing = [e.clientX, e.clientY]; // if texLayer is hit, then we select text instead of using a marquee } else { // clear out old marquees and initialize menu for new selection - PDFMenu.Instance.Status = "pdf"; + PDFMenu.Instance.Status = "marquee"; PDFMenu.Instance.fadeOut(true); this._savedAnnotations.values().forEach(v => v.forEach(a => a.remove())); this._savedAnnotations.clear(); |