aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MarqueeAnnotator.tsx
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2021-02-01 18:42:38 -0500
committerusodhi <61431818+usodhi@users.noreply.github.com>2021-02-01 18:42:38 -0500
commitb160a00f80c4855e190d75f97482b5b019e77437 (patch)
tree4fd150d45a5c49b9d5572edcb663956c0b29dd60 /src/client/views/MarqueeAnnotator.tsx
parent888fb3b3933e7aa48e9ac3abe85536328fcca336 (diff)
parent41bb365dd4f787aec2262dcb07508e0de3837e10 (diff)
more merge
Diffstat (limited to 'src/client/views/MarqueeAnnotator.tsx')
-rw-r--r--src/client/views/MarqueeAnnotator.tsx6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/views/MarqueeAnnotator.tsx b/src/client/views/MarqueeAnnotator.tsx
index 8ef69802b..4ffccbc90 100644
--- a/src/client/views/MarqueeAnnotator.tsx
+++ b/src/client/views/MarqueeAnnotator.tsx
@@ -21,6 +21,7 @@ export interface MarqueeAnnotatorProps {
rootDoc: Doc;
down: number[];
scaling?: () => number;
+ containerOffset?: () => number[];
mainCont: HTMLDivElement;
savedAnnotations: Dictionary<number, HTMLDivElement[]>;
annotationLayer: HTMLDivElement;
@@ -69,9 +70,10 @@ export class MarqueeAnnotator extends React.Component<MarqueeAnnotatorProps> {
if ((this.props.savedAnnotations.values()[0][0] as any).marqueeing) {
const scale = this.props.scaling?.() || 1;
const anno = this.props.savedAnnotations.values()[0][0];
+ const containerOffset = this.props.containerOffset?.() || [0, 0];
const mainAnnoDoc = Docs.Create.FreeformDocument([], { backgroundColor: color, annotationOn: this.props.rootDoc, title: "Annotation on " + this.props.rootDoc.title });
- if (anno.style.left) mainAnnoDoc.x = parseInt(anno.style.left) / scale;
- if (anno.style.top) mainAnnoDoc.y = (NumCast(this.props.rootDoc._scrollTop) + parseInt(anno.style.top)) / scale;
+ if (anno.style.left) mainAnnoDoc.x = (parseInt(anno.style.left) - containerOffset[0]) / scale;
+ if (anno.style.top) mainAnnoDoc.y = (parseInt(anno.style.top) - containerOffset[1] + NumCast(this.props.rootDoc._scrollTop)) / scale;
if (anno.style.height) mainAnnoDoc._height = parseInt(anno.style.height) / scale;
if (anno.style.width) mainAnnoDoc._width = parseInt(anno.style.width) / scale;
mainAnnoDoc.group = mainAnnoDoc;