aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MarqueeAnnotator.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/MarqueeAnnotator.tsx')
-rw-r--r--src/client/views/MarqueeAnnotator.tsx29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/client/views/MarqueeAnnotator.tsx b/src/client/views/MarqueeAnnotator.tsx
index 8aed34d24..024ae7ba8 100644
--- a/src/client/views/MarqueeAnnotator.tsx
+++ b/src/client/views/MarqueeAnnotator.tsx
@@ -34,6 +34,7 @@ export interface MarqueeAnnotatorProps {
getPageFromScroll?: (top: number) => number;
finishMarquee: (x?: number, y?: number) => void;
anchorMenuClick?: () => undefined | ((anchor: Doc) => void);
+ anchorMenuFlashcard?: () => Promise<String>;
anchorMenuCrop?: (anchor: Doc | undefined, addCrop: boolean) => Doc | undefined;
highlightDragSrcColor?: string;
}
@@ -46,10 +47,10 @@ export class MarqueeAnnotator extends ObservableReactComponent<MarqueeAnnotatorP
makeObservable(this);
}
- @observable private _width: number = 0;
- @observable private _height: number = 0;
- @computed get top() { return Math.min(this._start.y, this._start.y + this._height); } // prettier-ignore
- @computed get left() { return Math.min(this._start.x, this._start.x + this._width);} // prettier-ignore
+ @observable Width: number = 0;
+ @observable Height: number = 0;
+ @computed get top() { return Math.min(this._start.y, this._start.y + this.Height); } // prettier-ignore
+ @computed get left() { return Math.min(this._start.x, this._start.x + this.Width);} // prettier-ignore
static clearAnnotations = action((savedAnnotations: ObservableMap<number, HTMLDivElement[]>) => {
AnchorMenu.Instance.Status = 'marquee';
@@ -167,7 +168,7 @@ export class MarqueeAnnotator extends ObservableReactComponent<MarqueeAnnotatorP
@action
public onInitiateSelection(down: number[]) {
- this._width = this._height = 0;
+ this.Width = this.Height = 0;
this._start = this.getTransformedScreenPt(down);
document.removeEventListener('pointermove', this.onSelectMove);
@@ -241,15 +242,15 @@ export class MarqueeAnnotator extends ObservableReactComponent<MarqueeAnnotatorP
@action
onMove = (pt: number[]) => {
const movLoc = this.getTransformedScreenPt(pt);
- this._width = movLoc.x - this._start.x;
- this._height = movLoc.y - this._start.y;
+ this.Width = movLoc.x - this._start.x;
+ this.Height = movLoc.y - this._start.y;
};
@action
onSelectMove = (e: PointerEvent) => {
const movLoc = this.getTransformedScreenPt([e.clientX, e.clientY]);
- this._width = movLoc.x - this._start.x;
- this._height = movLoc.y - this._start.y;
+ this.Width = movLoc.x - this._start.x;
+ this.Height = movLoc.y - this._start.y;
// e.stopPropagation(); // overlay documents are all 'active', yet they can be dragged. if we stop propagation, then they can be marqueed but not dragged. if we don't stop, then they will be marqueed and dragged, but the marquee will be zero width since the doc will move along with the cursor.
};
@@ -280,11 +281,11 @@ export class MarqueeAnnotator extends ObservableReactComponent<MarqueeAnnotatorP
AnchorMenu.Instance.jumpTo(x, y);
}
this.props.finishMarquee(this.isEmpty ? x : undefined, this.isEmpty ? y : undefined);
- this._width = this._height = 0;
+ this.Width = this.Height = 0;
};
get isEmpty() {
- return Math.abs(this._width) <= 10 && Math.abs(this._height) <= 10;
+ return Math.abs(this.Width) <= 10 && Math.abs(this.Height) <= 10;
}
render() {
@@ -294,9 +295,9 @@ export class MarqueeAnnotator extends ObservableReactComponent<MarqueeAnnotatorP
style={{
left: `${this.left}px`,
top: `${this.top}px`,
- width: `${Math.abs(this._width)}px`,
- height: `${Math.abs(this._height)}px`,
- border: `${this._width === 0 ? '' : '2px dashed black'}`,
+ width: `${Math.abs(this.Width)}px`,
+ height: `${Math.abs(this.Height)}px`,
+ border: `${this.Width === 0 ? '' : '2px dashed black'}`,
}}
/>
);