diff options
author | bobzel <zzzman@gmail.com> | 2022-06-07 13:39:17 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-06-07 13:39:17 -0400 |
commit | d3c89f90d376310cd583ae1c6ac4a7eb4c5a03ac (patch) | |
tree | 2b159f9a885a739cb27cdc9bff18935f0423e274 /src/client/views/OverlayView.tsx | |
parent | 6493d95e92c8ed58bb3a8c07ea4ca28dae82ea1d (diff) |
fixed dragging items in overlayView to not invalidate DocumentView and cause a rerender. fixed loss of ability to select or drag after dragging a recording.
Diffstat (limited to 'src/client/views/OverlayView.tsx')
-rw-r--r-- | src/client/views/OverlayView.tsx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/client/views/OverlayView.tsx b/src/client/views/OverlayView.tsx index 9d970c06f..6796db51e 100644 --- a/src/client/views/OverlayView.tsx +++ b/src/client/views/OverlayView.tsx @@ -1,5 +1,7 @@ +import { docs } from "googleapis/build/src/apis/docs"; import { action, computed, observable } from "mobx"; import { observer } from "mobx-react"; +import { computedFn } from "mobx-utils"; import * as React from "react"; import ReactLoading from 'react-loading'; import { Doc, WidthSym, HeightSym } from "../../fields/Doc"; @@ -146,6 +148,12 @@ export class OverlayView extends React.Component { return remove; } + removeOverlayDoc = (doc: Doc | Doc[]) => (doc instanceof Doc ? [doc] : doc).map(doc => Doc.RemoveDocFromList((Doc.UserDoc().myOverlayDocs as Doc), "data", doc)).length ? true : false; + + + docScreenToLocalXf = computedFn(function docScreenToLocalXf(this: any, doc: Doc) { + return () => new Transform(-NumCast(doc.x), -NumCast(doc.y), 1); + }.bind(this)); @computed get overlayDocs() { return CurrentUserUtils.OverlayDocs?.map(d => { @@ -179,17 +187,16 @@ export class OverlayView extends React.Component { offsetx = NumCast(d.x) - e.clientX; offsety = NumCast(d.y) - e.clientY; }; - return <div className="overlayView-doc" ref={dref} key={d[Id]} onPointerDown={onPointerDown} style={{ top: d.type === 'presentation' ? 0 : undefined, width: NumCast(d._width), height: NumCast(d._height), transform: `translate(${d.x}px, ${d.y}px)` }}> <DocumentView Document={d} rootSelected={returnTrue} bringToFront={emptyFunction} addDocument={undefined} - removeDocument={doc => (doc instanceof Doc ? [doc] : doc).map(doc => Doc.RemoveDocFromList((Doc.UserDoc().myOverlayDocs as Doc), "data", doc)).length ? true : false} + removeDocument={this.removeOverlayDoc} PanelWidth={d[WidthSym]} PanelHeight={d[HeightSym]} - ScreenToLocalTransform={() => new Transform(-NumCast(d.x), -NumCast(d.y), 1)} + ScreenToLocalTransform={this.docScreenToLocalXf(d)} renderDepth={1} isDocumentActive={returnTrue} isContentActive={emptyFunction} |