aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MarqueeAnnotator.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-04-25 17:15:20 -0400
committerbobzel <zzzman@gmail.com>2024-04-25 17:15:20 -0400
commitd6720fa48d78cc313d6418acd8cbdaeda965285c (patch)
treed9cec7f7b031b20bfc5423bc48f8791074b2d5c1 /src/client/views/MarqueeAnnotator.tsx
parentbd3b34cce2ad85bfc96c16304b532d1510fd359e (diff)
changed marqueeAnnotator to save inline annotations as text strings instead of Docs. enabled making image crops of text selections on PDFs. cleaned up webboxrendered lint promses, and Annotation render
Diffstat (limited to 'src/client/views/MarqueeAnnotator.tsx')
-rw-r--r--src/client/views/MarqueeAnnotator.tsx27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/client/views/MarqueeAnnotator.tsx b/src/client/views/MarqueeAnnotator.tsx
index c4c00e0c3..ea73a53a9 100644
--- a/src/client/views/MarqueeAnnotator.tsx
+++ b/src/client/views/MarqueeAnnotator.tsx
@@ -100,22 +100,19 @@ export class MarqueeAnnotator extends ObservableReactComponent<MarqueeAnnotatorP
let maxX = -Number.MAX_VALUE;
let minY = Number.MAX_VALUE;
let maxY = -Number.MIN_VALUE;
- const annoDocs: Doc[] = [];
+ const annoRects: string[] = [];
savedAnnoMap.forEach((value: HTMLDivElement[]) =>
value.forEach(anno => {
- const textRegion = new Doc();
- textRegion.x = parseInt(anno.style.left ?? '0');
- textRegion.y = parseInt(anno.style.top ?? '0');
- textRegion._height = parseInt(anno.style.height ?? '0');
- textRegion._width = parseInt(anno.style.width ?? '0');
- textRegion.embedContainer = textRegionAnnoProto;
- textRegion.backgroundColor = color;
- annoDocs.push(textRegion);
+ const x = parseInt(anno.style.left ?? '0');
+ const y = parseInt(anno.style.top ?? '0');
+ const height = parseInt(anno.style.height ?? '0');
+ const width = parseInt(anno.style.width ?? '0');
+ annoRects.push(`${x}:${y}:${width}:${height}`);
anno.remove();
- minY = Math.min(NumCast(textRegion.y), minY);
- minX = Math.min(NumCast(textRegion.x), minX);
- maxY = Math.max(NumCast(textRegion.y) + NumCast(textRegion._height), maxY);
- maxX = Math.max(NumCast(textRegion.x) + NumCast(textRegion._width), maxX);
+ minY = Math.min(NumCast(y), minY);
+ minX = Math.min(NumCast(x), minX);
+ maxY = Math.max(NumCast(y) + NumCast(height), maxY);
+ maxX = Math.max(NumCast(x) + NumCast(width), maxX);
})
);
@@ -123,8 +120,10 @@ export class MarqueeAnnotator extends ObservableReactComponent<MarqueeAnnotatorP
textRegionAnnoProto.x = Math.max(minX, 0);
textRegionAnnoProto.height = Math.max(maxY, 0) - Math.max(minY, 0);
textRegionAnnoProto.width = Math.max(maxX, 0) - Math.max(minX, 0);
+ textRegionAnnoProto.backgroundColor = color;
// mainAnnoDocProto.text = this._selectionText;
- textRegionAnnoProto.text_inlineAnnotations = new List<Doc>(annoDocs);
+ textRegionAnnoProto.text_inlineAnnotations = new List<string>(annoRects);
+ textRegionAnnoProto.opacity = 0;
textRegionAnnoProto.layout_unrendered = true;
savedAnnoMap.clear();
return textRegionAnno;