diff options
| author | bobzel <zzzman@gmail.com> | 2021-07-01 22:43:47 -0400 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2021-07-01 22:43:47 -0400 |
| commit | 464bca333ba97185dcbc93409001adeb26711902 (patch) | |
| tree | 75dd8cb1829d7879ecdf7eaccf0473a8a647954c /src/client/views/MarqueeAnnotator.tsx | |
| parent | fce572c4753adac69378d3ccf509561f0a839781 (diff) | |
added ability to create anchors in PDF/Webboxes by making a selection and clicking the start link button
Diffstat (limited to 'src/client/views/MarqueeAnnotator.tsx')
| -rw-r--r-- | src/client/views/MarqueeAnnotator.tsx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/client/views/MarqueeAnnotator.tsx b/src/client/views/MarqueeAnnotator.tsx index d2074d653..b5df7b79b 100644 --- a/src/client/views/MarqueeAnnotator.tsx +++ b/src/client/views/MarqueeAnnotator.tsx @@ -65,10 +65,9 @@ export class MarqueeAnnotator extends React.Component<MarqueeAnnotatorProps> { doc.addEventListener("pointermove", this.onSelectMove); doc.addEventListener("pointerup", this.onSelectEnd); - AnchorMenu.Instance.OnClick = (e: PointerEvent) => { - this.props.anchorMenuClick?.()?.(this.highlight("rgba(173, 216, 230, 0.75)", true)); - }; + AnchorMenu.Instance.OnClick = (e: PointerEvent) => this.props.anchorMenuClick?.()?.(this.highlight("rgba(173, 216, 230, 0.75)", true)); AnchorMenu.Instance.Highlight = this.highlight; + AnchorMenu.Instance.GetAnchor = () => this.highlight("rgba(173, 216, 230, 0.75)", true); /** * This function is used by the AnchorMenu to create an anchor highlight and a new linked text annotation. * It also initiates a Drag/Drop interaction to place the text annotation. @@ -105,7 +104,8 @@ export class MarqueeAnnotator extends React.Component<MarqueeAnnotatorProps> { @action makeAnnotationDocument = (color: string, isLinkButton?: boolean): Opt<Doc> => { if (this.props.savedAnnotations.size === 0) return undefined; - if ((Array.from(this.props.savedAnnotations.values())[0][0] as any).marqueeing) { + const savedAnnos = Array.from(this.props.savedAnnotations.values())[0]; + if (savedAnnos.length && (savedAnnos[0] as any).marqueeing) { const scale = this.props.scaling?.() || 1; const anno = Array.from(this.props.savedAnnotations.values())[0][0]; const containerOffset = this.props.containerOffset?.() || [0, 0]; |
