diff options
author | bobzel <zzzman@gmail.com> | 2024-01-03 09:33:01 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2024-01-03 09:33:01 -0500 |
commit | af42d3061bd85907e3d987f0d794c250cfaded1c (patch) | |
tree | fb8ac044936ce81e27e3093005c94187ab61de95 /src | |
parent | fdc0bf7c54af252178f587709630d36726484b91 (diff) |
from last
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/nodes/DataVizBox/DataVizBox.tsx | 21 | ||||
-rw-r--r-- | src/client/views/nodes/VideoBox.tsx | 2 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx index 12e8e1a69..ff0e3271d 100644 --- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx +++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx @@ -3,7 +3,7 @@ import { Colors, Toggle, ToggleType, Type } from 'browndash-components'; import { ObservableMap, action, computed, observable, runInAction } from 'mobx'; import { observer } from 'mobx-react'; import * as React from 'react'; -import { emptyFunction, returnEmptyString, returnFalse, setupMoveUpEvents } from '../../../../Utils'; +import { emptyFunction, returnEmptyString, returnFalse, returnOne, setupMoveUpEvents } from '../../../../Utils'; import { Doc, DocListCast, Field, Opt, StrListCast } from '../../../../fields/Doc'; import { InkTool } from '../../../../fields/InkField'; import { List } from '../../../../fields/List'; @@ -38,9 +38,9 @@ export enum DataVizView { @observer export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { - private _getAnchor: (savedAnnotations: Opt<ObservableMap<number, HTMLDivElement[]>>, addAsAnnotation: boolean) => Opt<Doc> = () => undefined; private _mainCont: React.RefObject<HTMLDivElement> = React.createRef(); private _ffref = React.createRef<CollectionFreeFormView>(); + private _marqueeref = React.createRef<MarqueeAnnotator>(); private _annotationLayer: React.RefObject<HTMLDivElement> = React.createRef(); anchorMenuClick?: () => undefined | ((anchor: Doc) => void); crop: ((region: Doc | undefined, addCrop?: boolean) => Doc | undefined) | undefined; @@ -58,8 +58,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { e, action(e => { MarqueeAnnotator.clearAnnotations(this._savedAnnotations); - //this._marqueeing = [e.pageX, e.pageY]; - this._marqueeing = [e.clientX, e.clientY]; + this._marqueeref.current?.onInitiateSelection([e.clientX, e.clientY]); return true; }), returnFalse, @@ -70,8 +69,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { }; @action finishMarquee = () => { - this._getAnchor = AnchorMenu.Instance?.GetAnchor; - this._marqueeing = undefined; + this._marqueeref.current?.onTerminateSelection(); this._props.select(false); }; savedAnnotations = () => this._savedAnnotations; @@ -125,8 +123,8 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { } return func() ?? false; }; - getAnchor = (addAsAnnotation?: boolean, pinProps?: PinProps) => { - const visibleAnchor = this._getAnchor?.(this._savedAnnotations, false); // use marquee anchor, otherwise, save zoom/pan as anchor + getAnchor = (addAsAnnotation: boolean, pinProps?: PinProps) => { + const visibleAnchor = AnchorMenu.Instance.GetAnchor?.(undefined, addAsAnnotation); const anchor = !pinProps ? this.Document : this._vizRenderer?.getAnchor(pinProps) ?? @@ -413,15 +411,16 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { </div> {this.sidebarHandle} {this.annotationLayer} - {!this._marqueeing || !this._mainCont.current || !this._annotationLayer.current ? null : ( + {!this._mainCont.current || !this._annotationLayer.current ? null : ( <MarqueeAnnotator + ref={this._marqueeref} Document={this.Document} - getPageFromScroll={undefined} anchorMenuClick={this.anchorMenuClick} scrollTop={0} annotationLayerScrollTop={NumCast(this.Document._layout_scrollTop)} - addDocument={this.sidebarAddDocument} + scaling={returnOne} docView={this._props.DocumentView!} + addDocument={this.sidebarAddDocument} finishMarquee={this.finishMarquee} savedAnnotations={this.savedAnnotations} selectionText={returnEmptyString} diff --git a/src/client/views/nodes/VideoBox.tsx b/src/client/views/nodes/VideoBox.tsx index 8e9cfe3d7..f257d5769 100644 --- a/src/client/views/nodes/VideoBox.tsx +++ b/src/client/views/nodes/VideoBox.tsx @@ -47,7 +47,7 @@ import './VideoBox.scss'; */ @observer -export class VideoBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatableProps & FieldViewProps>() { +export class VideoBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { public static LayoutString(fieldKey: string) { return FieldView.LayoutString(VideoBox, fieldKey); } |