diff options
| author | bobzel <zzzman@gmail.com> | 2020-12-15 13:29:15 -0500 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2020-12-15 13:29:15 -0500 |
| commit | 64b71d1f652bb3a7523ed3914d93f4603ae9fe98 (patch) | |
| tree | 8f2ff84fe3173160f2346c05de36ebc56eaea3be /src/client/views/nodes/DocumentView.tsx | |
| parent | 7b82359d68bf2fbc91d8851e2eb80c8b22930fd2 (diff) | |
fixed previous problems -- weird that you can't call componentWillUnmount. also fixed dragging to show original unless hideSource is set
Diffstat (limited to 'src/client/views/nodes/DocumentView.tsx')
| -rw-r--r-- | src/client/views/nodes/DocumentView.tsx | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index da10f2a69..eb1807a71 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -153,9 +153,10 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps super(props); } + componentWillUnmount() { this.cleanupHandlers(true); } componentDidMount() { this.componentDidUpdate(); } componentDidUpdate() { - this.componentWillUnmount(); + this.cleanupHandlers(false); if (this._mainCont.current) { this._dropDisposer = DragManager.MakeDropTarget(this._mainCont.current, this.drop.bind(this), this.props.Document); this._gestureEventDisposer = GestureUtils.MakeGestureTarget(this._mainCont.current, this.onGesture.bind(this)); @@ -163,12 +164,12 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps this._holdDisposer = InteractionUtils.MakeHoldTouchTarget(this._mainCont.current, this.handle1PointerHoldStart.bind(this)); } } - componentWillUnmount() { + cleanupHandlers(unbrush: boolean) { this._dropDisposer?.(); this._gestureEventDisposer?.(); this._multiTouchDisposer?.(); this._holdDisposer?.(); - Doc.UnBrushDoc(this.props.Document); + unbrush && Doc.UnBrushDoc(this.props.Document); } @@ -432,7 +433,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps stopPropagate && e.stopPropagation(); preventDefault && e.preventDefault(); } - }) + }); onPointerDown = (e: React.PointerEvent): void => { // continue if the event hasn't been canceled AND we are using a moues or this is has an onClick or onDragStart function (meaning it is a button document) @@ -732,7 +733,7 @@ export class DocumentViewInternal extends DocComponent<DocumentViewInternalProps }); } - rootSelected = (outsideReaction?: boolean) => { return this.props.isSelected(outsideReaction) || (this.props.Document.rootDocument && this.props.rootSelected?.(outsideReaction)) || false; } + rootSelected = (outsideReaction?: boolean) => this.props.isSelected(outsideReaction) || (this.props.Document.rootDocument && this.props.rootSelected?.(outsideReaction)) || false; panelHeight = () => this.props.PanelHeight() - this.headerMargin; parentActive = (outsideReaction: boolean) => this.props.layerProvider?.(this.layoutDoc) === false ? this.props.parentActive(outsideReaction) : false; screenToLocal = () => this.props.ScreenToLocalTransform().translate(0, -this.headerMargin); |
