From 1987cf9c4585fce9fe897c5146ebed1bf45ecd64 Mon Sep 17 00:00:00 2001 From: Geireann Lindfield Roberts <60007097+geireann@users.noreply.github.com> Date: Sun, 2 Aug 2020 23:30:12 +0800 Subject: internal nav in topmost collection --- .../views/presentationview/PresElementBox.scss | 4 +-- .../views/presentationview/PresElementBox.tsx | 33 +++++++++++----------- 2 files changed, 18 insertions(+), 19 deletions(-) (limited to 'src/client/views/presentationview') diff --git a/src/client/views/presentationview/PresElementBox.scss b/src/client/views/presentationview/PresElementBox.scss index c87a1583a..159cb5f8a 100644 --- a/src/client/views/presentationview/PresElementBox.scss +++ b/src/client/views/presentationview/PresElementBox.scss @@ -2,7 +2,7 @@ display: grid; grid-template-columns: max-content max-content max-content; background-color: #d5dce2; - box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.25); + // box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.25); position: relative; pointer-events: all; width: 100%; @@ -44,7 +44,7 @@ .presElementBox-item:hover { transition: all .1s; - background: #AAAAAA; + background: #98b7da; border-radius: 6px; } diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx index 5fba447db..a27d5ef16 100644 --- a/src/client/views/presentationview/PresElementBox.tsx +++ b/src/client/views/presentationview/PresElementBox.tsx @@ -19,9 +19,6 @@ import { PresBox } from "../nodes/PresBox"; import { DocumentType } from "../../documents/DocumentTypes"; import { Tooltip } from "@material-ui/core"; import { DragManager } from "../../util/DragManager"; -import { undoBatch } from "../../util/UndoManager"; -import { DocUtils } from "../../documents/Documents"; -import { DocumentManager } from "../../util/DocumentManager"; export const presSchema = createSchema({ presentationTargetDoc: Doc, @@ -44,7 +41,6 @@ const PresDocument = makeInterface(presSchema, documentSchema); @observer export class PresElementBox extends ViewBoxBaseComponent(PresDocument) { public static LayoutString(fieldKey: string) { return FieldView.LayoutString(PresElementBox, fieldKey); } - private _treedropDisposer?: DragManager.DragDropDisposer; _heightDisposer: IReactionDisposer | undefined; // these fields are conditionally computed fields on the layout document that take this document as a parameter @computed get indexInPres() { return Number(this.lookupField("indexInPres")); } // the index field is where this document is in the presBox display list (since this value is different for each presentation element, the value can't be stored on the layout template which is used by all display elements) @@ -178,14 +174,13 @@ export class PresElementBox extends ViewBoxBaseComponent 100; - embedWidth = () => this.props.PanelWidth() - 20; + // embedWidth = () => this.props.PanelWidth(); // embedHeight = () => Math.min(this.props.PanelWidth() - 20, this.props.PanelHeight() - this.collapsedHeight); - // embedWidth = () => this.props.PanelWidth() - 20; + embedWidth = () => this.props.PanelWidth() - 20; /** * The function that is responsible for rendering a preview or not for this * presentation element. */ - @computed get renderEmbeddedInline() { return !this.rootDoc.presExpandInlineButton || !this.targetDoc ? (null) :
@@ -194,7 +189,7 @@ export class PresElementBox extends ViewBoxBaseComponent "darkgrey"} rootSelected={returnTrue} addDocument={returnFalse} removeDocument={returnFalse} @@ -238,15 +233,21 @@ export class PresElementBox extends ViewBoxBaseComponent = React.createRef(); headerDown = (e: React.PointerEvent) => { + const element = document.elementFromPoint(e.clientX, e.clientY)?.parentElement; e.stopPropagation(); e.preventDefault(); - setupMoveUpEvents(this, e, this.startDrag, emptyFunction, emptyFunction); + if (element) { + console.log(element.className); + if (PresBox.Instance._eleArray.includes(element)) { + setupMoveUpEvents(this, e, this.startDrag, emptyFunction, emptyFunction); + } + } } startDrag = (e: PointerEvent, down: number[], delta: number[]) => { // const ele: HTMLElement[] = PresBox.Instance._eleArray.map(doc => doc); const activeItem = this.rootDoc; - const dragData = new DragManager.DocumentDragData(PresBox.Instance._selectedArray.map(doc => doc)); + const dragData = new DragManager.DocumentDragData(PresBox.Instance.sortArray().map(doc => doc)); // let value = this.getValue(this._heading); // value = typeof value === "string" ? `"${value}"` : value; if (activeItem) { @@ -265,13 +266,9 @@ export class PresElementBox extends ViewBoxBaseComponent { - if (this.props.active(true) || PresBox.Instance._selectedArray.includes(this.rootDoc)) { - e.stopPropagation(); - e.preventDefault(); - } if (e.ctrlKey || e.metaKey) { PresBox.Instance.multiSelect(this.rootDoc, this._itemRef.current!); console.log("cmmd click"); @@ -292,7 +289,7 @@ export class PresElementBox extends ViewBoxBaseComponent - {treecontainer ? (null) : <> + <>
{`${this.indexInPres + 1}.`}
@@ -313,7 +310,7 @@ export class PresElementBox extends ViewBoxBaseComponent
{this.rootDoc.presExpandInlineButton ? "Minimize" : "Expand"}
}>
{ e.stopPropagation(); this.presExpandDocumentClick(); }}> e.stopPropagation()} />
- } +
@@ -328,3 +325,5 @@ export class PresElementBox extends ViewBoxBaseComponent