aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MarqueeAnnotator.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-03-18 00:08:13 -0400
committerbobzel <zzzman@gmail.com>2021-03-18 00:08:13 -0400
commit188e1e57860f58e9ebe3536a0e1f7cd84ea0db80 (patch)
tree72d1824332295c6a58b7b5933125133b19c5c0f3 /src/client/views/MarqueeAnnotator.tsx
parent6f4f0ffb9f4ab816cf6055c62afc6f79b8e4961f (diff)
cleaned up link making. Documents don't add to the Undo stack when being created and Initializing is set. Links to text regions automatically update their link line endpoints even if autoMove isn't set. regularized initialization fields to avoid special cases about setting delegate keys without a leading "_"
Diffstat (limited to 'src/client/views/MarqueeAnnotator.tsx')
-rw-r--r--src/client/views/MarqueeAnnotator.tsx7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/client/views/MarqueeAnnotator.tsx b/src/client/views/MarqueeAnnotator.tsx
index 1e97f9b41..2e50c9b6d 100644
--- a/src/client/views/MarqueeAnnotator.tsx
+++ b/src/client/views/MarqueeAnnotator.tsx
@@ -98,13 +98,13 @@ export class MarqueeAnnotator extends React.Component<MarqueeAnnotatorProps> {
@undoBatch
@action
- makeAnnotationDocument = (color: string): Opt<Doc> => {
+ 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 scale = this.props.scaling?.() || 1;
const anno = Array.from(this.props.savedAnnotations.values())[0][0];
const containerOffset = this.props.containerOffset?.() || [0, 0];
- const marqueeAnno = Docs.Create.FreeformDocument([], { backgroundColor: color, annotationOn: this.props.rootDoc, title: "Annotation on " + this.props.rootDoc.title });
+ const marqueeAnno = Docs.Create.FreeformDocument([], { _isLinkButton: isLinkButton, backgroundColor: color, annotationOn: this.props.rootDoc, title: "Annotation on " + this.props.rootDoc.title });
marqueeAnno.x = (parseInt(anno.style.left || "0") - containerOffset[0]) / scale;
marqueeAnno.y = (parseInt(anno.style.top || "0") - containerOffset[1]) / scale + NumCast(this.props.scrollTop);
marqueeAnno._height = parseInt(anno.style.height || "0") / scale;
@@ -144,9 +144,8 @@ export class MarqueeAnnotator extends React.Component<MarqueeAnnotatorProps> {
highlight = (color: string, isLinkButton: boolean) => {
// creates annotation documents for current highlights
const effectiveAcl = GetEffectiveAcl(this.props.rootDoc[DataSym]);
- const annotationDoc = [AclAddonly, AclEdit, AclAdmin].includes(effectiveAcl) && this.makeAnnotationDocument(color);
+ const annotationDoc = [AclAddonly, AclEdit, AclAdmin].includes(effectiveAcl) && this.makeAnnotationDocument(color, isLinkButton);
annotationDoc && this.props.addDocument(annotationDoc);
- annotationDoc && (annotationDoc.isLinkButton = isLinkButton);
return annotationDoc as Doc ?? undefined;
}