aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/presentationview/PresElementBox.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-05-02 14:31:16 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-05-02 14:31:16 -0400
commit100ad0da00f2a5cea13508abc0c3a8c644095d65 (patch)
treecd7a5e40e8d3b5f0ffb5b70fdef1be37ef975a0d /src/client/views/presentationview/PresElementBox.tsx
parent952bc0d744833ab79f69f2f13abde1e4cee68408 (diff)
turn off targetDropAction when dropping in same colleciton. cleaned up PresBox stuff to use single template to render all contents (which are otherwise unmodified).
Diffstat (limited to 'src/client/views/presentationview/PresElementBox.tsx')
-rw-r--r--src/client/views/presentationview/PresElementBox.tsx16
1 files changed, 8 insertions, 8 deletions
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<FieldViewProps, PresDoc
public static LayoutString(fieldKey: string) { return FieldView.LayoutString(PresElementBox, fieldKey); }
_heightDisposer: IReactionDisposer | undefined;
- @computed get indexInPres() { return DocListCast(this.presBoxDoc.presOrderedDocs).findIndex(d => 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<FieldViewProps, PresDoc
this.targetDoc.opacity = 1;
}
} else {
- if (this.presBoxDoc.presStatus && this.indexInPres > 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<FieldViewProps, PresDoc
}
} else {
if (this.rootDoc.presFadeButton) this.rootDoc.presFadeButton = false;
- if (this.presBoxDoc.presStatus && this.indexInPres < this.currentIndex && this.targetDoc) {
+ if (this.presStatus && this.indexInPres < this.currentIndex && this.targetDoc) {
this.targetDoc.opacity = 0;
}
}
@@ -107,7 +107,7 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps, PresDoc
}
} else {
this.rootDoc.presHideAfterButton = false;
- if (this.presBoxDoc.presStatus && (this.indexInPres < this.currentIndex) && this.targetDoc) {
+ if (this.presStatus && (this.indexInPres < this.currentIndex) && this.targetDoc) {
this.targetDoc.opacity = 0.5;
}
}