From 1bba63b1d15cfe76393424a768d2dbc0f0b8cffb Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 2 Nov 2023 10:55:43 -0400 Subject: cleaned up brushView to only apply to freeformviews that aren't overlays (wasn't being used properly. before anyway). cleaned up marquee view divs. --- .../collectionFreeForm/CollectionFreeFormView.tsx | 108 ++++++++------------- 1 file changed, 40 insertions(+), 68 deletions(-) (limited to 'src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 0c3033579..d80ea2cb2 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -64,8 +64,6 @@ export type collectionFreeformViewProps = { noOverlay?: boolean; // used to suppress docs in the overlay (z) layer (ie, for minimap since overlay doesn't scale) engineProps?: any; getScrollHeight?: () => number | undefined; - dontRenderDocuments?: boolean; // used for annotation overlays which need to distribute documents into different freeformviews with different mixBlendModes depending on whether they are transparent or not. - // However, this screws up interactions since only the top layer gets events. so we render the freeformview a 3rd time with all documents in order to get interaction events (eg., marquee) but we don't actually want to display the documents. }; @observer @@ -123,7 +121,6 @@ export class CollectionFreeFormView extends CollectionSubView(); - @observable _marqueeRef: HTMLDivElement | null = null; @observable _marqueeViewRef = React.createRef(); @observable GroupChildDrag: boolean = false; // child document view being dragged. needed to update drop areas of groups when a group item is dragged. @observable _brushedView: { width: number; height: number; panX: number; panY: number } | undefined; // highlighted region of freeform canvas used by presentations to indicate a region @@ -1335,7 +1332,7 @@ export class CollectionFreeFormView extends CollectionSubView @@ -1571,11 +1568,9 @@ export class CollectionFreeFormView extends CollectionSubView { this._firstRender = false; @@ -1612,9 +1607,7 @@ export class CollectionFreeFormView extends CollectionSubView this.doLayoutComputation, - elements => { - if (elements !== undefined) this._layoutElements = elements || []; - }, + elements => elements !== undefined && (this._layoutElements = elements || []), { fireImmediately: true, name: 'doLayout' } ); @@ -1709,7 +1702,6 @@ export class CollectionFreeFormView extends CollectionSubView disposer?.()); - this._marqueeRef?.removeEventListener('dashDragAutoScroll', this.onDragAutoScroll as any); } @action @@ -1717,26 +1709,6 @@ export class CollectionFreeFormView extends CollectionSubView) => { - if ((e as any).handlePan || this.props.isAnnotationOverlay) return; - (e as any).handlePan = true; - - if (!this.layoutDoc._freeform_noAutoPan && !this.props.renderDepth && this._marqueeRef) { - const dragX = e.detail.clientX; - const dragY = e.detail.clientY; - const bounds = this._marqueeRef?.getBoundingClientRect(); - - const deltaX = dragX - bounds.left < 25 ? -(25 + (bounds.left - dragX)) : bounds.right - dragX < 25 ? 25 - (bounds.right - dragX) : 0; - const deltaY = dragY - bounds.top < 25 ? -(25 + (bounds.top - dragY)) : bounds.bottom - dragY < 25 ? 25 - (bounds.bottom - dragY) : 0; - if (deltaX !== 0 || deltaY !== 0) { - this.Document[this.panYFieldKey] = NumCast(this.Document[this.panYFieldKey]) + deltaY / 2; - this.Document[this.panXFieldKey] = NumCast(this.Document[this.panXFieldKey]) + deltaX / 2; - } - } - e.stopPropagation(); - }; - @undoBatch promoteCollection = () => { const childDocs = this.childDocs.slice(); @@ -1926,11 +1898,41 @@ export class CollectionFreeFormView extends CollectionSubView + + + ); + } + @computed get pannableContents() { + return ( + + {this.children} + + ); + } @computed get marqueeView() { TraceMobx(); - return this._firstRender ? ( - this.placeholder - ) : ( + return ( -
{ - this._marqueeRef = r; - r?.addEventListener('dashDragAutoScroll', this.onDragAutoScroll as any); - }} - style={{ opacity: this.props.dontRenderDocuments ? 0.7 : undefined }}> - {this.layoutDoc._freeform_backgroundGrid ? ( -
- -
- ) : null} - - {this.children} - -
+ {this.layoutDoc._freeform_backgroundGrid ? this.backgroundGrid : null} + {this.pannableContents} {this._showAnimTimeline ? : null}
); @@ -2073,7 +2045,7 @@ export class CollectionFreeFormView extends CollectionSubView ) : ( <> - {this.marqueeView} + {this._firstRender ? this.placeholder : this.marqueeView} {this.props.noOverlay ? null : } {!this.GroupChildDrag ? null :
} -- cgit v1.2.3-70-g09d2