From 100ad0da00f2a5cea13508abc0c3a8c644095d65 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Sat, 2 May 2020 14:31:16 -0400 Subject: turn off targetDropAction when dropping in same colleciton. cleaned up PresBox stuff to use single template to render all contents (which are otherwise unmodified). --- src/client/views/presentationview/PresElementBox.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/client/views/presentationview') diff --git a/src/client/views/presentationview/PresElementBox.tsx b/src/client/views/presentationview/PresElementBox.tsx index 1887c8d45..fd202cdc1 100644 --- a/src/client/views/presentationview/PresElementBox.tsx +++ b/src/client/views/presentationview/PresElementBox.tsx @@ -5,7 +5,7 @@ import { Doc, DataSym, DocListCast } from "../../../new_fields/Doc"; import { documentSchema } from '../../../new_fields/documentSchemas'; import { Id } from "../../../new_fields/FieldSymbols"; import { createSchema, makeInterface } from '../../../new_fields/Schema'; -import { Cast, NumCast } from "../../../new_fields/Types"; +import { Cast, NumCast, BoolCast } from "../../../new_fields/Types"; import { emptyFunction, emptyPath, returnFalse, returnTrue, returnOne, returnZero } from "../../../Utils"; import { Transform } from "../../util/Transform"; import { CollectionViewType } from '../collections/CollectionView'; @@ -38,11 +38,11 @@ export class PresElementBox extends ViewBoxBaseComponent d === this.rootDoc); } - @computed get presBoxDoc() { return Cast(this.props.RenderData?.().presBox, Doc) as Doc; } + @computed get indexInPres() { return DocListCast(this.layoutDoc.presOrderedDocs).findIndex(d => d === this.rootDoc); } + @computed get collapsedHeight() { return NumCast(this.layoutDoc.presCollapsedHeight); } + @computed get presStatus() { return BoolCast(this.layoutDoc.presStatus); } + @computed get currentIndex() { return NumCast(this.layoutDoc.currentIndex); } @computed get targetDoc() { return this.rootDoc.presentationTargetDoc as Doc; } - @computed get currentIndex() { return NumCast(this.presBoxDoc?._itemIndex); } - @computed get collapsedHeight() { return NumCast(this.presBoxDoc?.presCollapsedHeight); } componentDidMount() { this._heightDisposer = reaction(() => [this.rootDoc.presExpandInlineButton, this.collapsedHeight], @@ -65,7 +65,7 @@ export class PresElementBox extends ViewBoxBaseComponent this.currentIndex && this.targetDoc) { + if (this.presStatus && this.indexInPres > this.currentIndex && this.targetDoc) { this.targetDoc.opacity = 0; } } @@ -86,7 +86,7 @@ export class PresElementBox extends ViewBoxBaseComponent