diff options
| author | Sam Wilkins <samwilkins333@gmail.com> | 2019-12-17 16:38:19 -0800 |
|---|---|---|
| committer | Sam Wilkins <samwilkins333@gmail.com> | 2019-12-17 16:38:19 -0800 |
| commit | 10843071eacf94b237d131a50df9c58352441814 (patch) | |
| tree | 854ed4e91131d5f11c4526c0cd24056adf1de2e3 /src/client/views/TemplateMenu.tsx | |
| parent | e553c4ac4785ee1d2c57ed5d5303d6dff26929f9 (diff) | |
| parent | 96ada41d4c3c411be63bd656da65bba7894a4224 (diff) | |
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/TemplateMenu.tsx')
| -rw-r--r-- | src/client/views/TemplateMenu.tsx | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/src/client/views/TemplateMenu.tsx b/src/client/views/TemplateMenu.tsx index 598bcd56d..10419ddb7 100644 --- a/src/client/views/TemplateMenu.tsx +++ b/src/client/views/TemplateMenu.tsx @@ -1,6 +1,5 @@ import { action, observable } from "mobx"; import { observer } from "mobx-react"; -import { DocumentManager } from "../util/DocumentManager"; import { DragManager } from "../util/DragManager"; import { SelectionManager } from "../util/SelectionManager"; import { undoBatch } from "../util/UndoManager"; @@ -10,7 +9,6 @@ import { Template, Templates } from "./Templates"; import React = require("react"); import { Doc } from "../../new_fields/Doc"; import { StrCast } from "../../new_fields/Types"; -import { emptyFunction } from "../../Utils"; const higflyout = require("@hig/flyout"); export const { anchorPoints } = higflyout; export const Flyout = higflyout.default; @@ -62,23 +60,12 @@ export class TemplateMenu extends React.Component<TemplateMenuProps> { toggleFloat = (e: React.ChangeEvent<HTMLInputElement>): void => { SelectionManager.DeselectAll(); const topDocView = this.props.docs[0]; - const topDoc = topDocView.props.Document; const ex = e.target.getBoundingClientRect().left; const ey = e.target.getBoundingClientRect().top; - const de = new DragManager.DocumentDragData([topDoc]); - de.dragDivName = topDocView.props.dragDivName; - de.moveDocument = topDocView.props.moveDocument; - undoBatch(action(() => topDoc.z = topDoc.z ? 0 : 1))(); - setTimeout(() => { - const newDocView = DocumentManager.Instance.getDocumentView(topDoc); - if (newDocView) { - const contentDiv = newDocView.ContentDiv!; - const xf = contentDiv.getBoundingClientRect(); - DragManager.StartDocumentDrag([contentDiv], de, ex, ey, { offsetX: ex - xf.left, offsetY: ey - xf.top, hideSource: true }); - } - }, 0); + DocumentView.FloatDoc(topDocView, ex, ey); } + @undoBatch @action toggleTemplate = (event: React.ChangeEvent<HTMLInputElement>, template: Template): void => { |
