aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/OverlayView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/OverlayView.tsx')
-rw-r--r--src/client/views/OverlayView.tsx17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/client/views/OverlayView.tsx b/src/client/views/OverlayView.tsx
index 9d970c06f..18abcda72 100644
--- a/src/client/views/OverlayView.tsx
+++ b/src/client/views/OverlayView.tsx
@@ -1,11 +1,12 @@
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";
import { Id } from "../../fields/FieldSymbols";
import { Cast, NumCast } from "../../fields/Types";
-import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnOne, returnTrue, setupMoveUpEvents, Utils } from "../../Utils";
+import { emptyFunction, returnEmptyDoclist, returnEmptyFilter, returnFalse, returnOne, returnTrue, returnZero, setupMoveUpEvents, Utils } from "../../Utils";
import { DocUtils } from "../documents/Documents";
import { CurrentUserUtils } from "../util/CurrentUserUtils";
import { DragManager } from "../util/DragManager";
@@ -146,6 +147,14 @@ export class OverlayView extends React.Component {
return remove;
}
+ removeOverlayDoc = (doc: Doc | Doc[]) => {
+ (doc instanceof Doc ? [doc] : doc).forEach(doc => Doc.RemoveDocFromList((Doc.UserDoc().myOverlayDocs as Doc), undefined, doc));
+ return true;
+ }
+
+ 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 => {
@@ -186,13 +195,13 @@ export class OverlayView extends React.Component {
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}
+ isContentActive={returnTrue}
whenChildContentsActiveChanged={emptyFunction}
focus={DocUtils.DefaultFocus}
styleProvider={DefaultStyleProvider}