diff options
Diffstat (limited to 'src/client/views/OverlayView.tsx')
-rw-r--r-- | src/client/views/OverlayView.tsx | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/client/views/OverlayView.tsx b/src/client/views/OverlayView.tsx index e1c248a7a..e17da2680 100644 --- a/src/client/views/OverlayView.tsx +++ b/src/client/views/OverlayView.tsx @@ -8,7 +8,7 @@ import { Utils, emptyFunction } from '../../Utils'; import { Doc } from '../../fields/Doc'; import { Height, Width } from '../../fields/DocSymbols'; import { Id } from '../../fields/FieldSymbols'; -import { NumCast } from '../../fields/Types'; +import { NumCast, toList } from '../../fields/Types'; import { DocumentType } from '../documents/DocumentTypes'; import { DragManager } from '../util/DragManager'; import { dropActionType } from '../util/DropActionTypes'; @@ -176,17 +176,13 @@ export class OverlayView extends ObservableReactComponent<{}> { return remove; } - removeOverlayDoc = (doc: Doc | Doc[]) => { - (doc instanceof Doc ? [doc] : doc).forEach(Doc.RemFromMyOverlay); - return true; - }; + removeOverlayDoc = (docs: Doc | Doc[]) => toList(docs).every(Doc.RemFromMyOverlay); docScreenToLocalXf = computedFn((doc: Doc) => () => new Transform(-NumCast(doc.overlayX), -NumCast(doc.overlayY), 1)); @computed get overlayDocs() { return Doc.MyOverlayDocs.filter(d => !LightboxView.LightboxDoc || d.type === DocumentType.PRES).map(d => { - let offsetx = 0; - let offsety = 0; + let [offsetx, offsety] = [0, 0]; const dref = React.createRef<HTMLDivElement>(); const onPointerMove = action((e: PointerEvent, down: number[]) => { if (e.cancelBubble) return false; // if the overlay doc processed the move event (e.g., to pan its contents), then the event should be marked as canceled since propagation can't be stopped |