aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionCarouselView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-09-09 17:34:35 -0400
committerbobzel <zzzman@gmail.com>2020-09-09 17:34:35 -0400
commite650f4dddb6a5f30b8eac0c6097cead28e04cd48 (patch)
treef015b71920a0ff6a0d5a7124b00acb4f8dc1001b /src/client/views/collections/CollectionCarouselView.tsx
parent54c02b71da4e7a698e0d5d7ecf66ab3fd082edf6 (diff)
parent19751f41b642ad68e8029e6ea618232543a02ad8 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views/collections/CollectionCarouselView.tsx')
-rw-r--r--src/client/views/collections/CollectionCarouselView.tsx13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionCarouselView.tsx b/src/client/views/collections/CollectionCarouselView.tsx
index 8a27f8102..c5910b0be 100644
--- a/src/client/views/collections/CollectionCarouselView.tsx
+++ b/src/client/views/collections/CollectionCarouselView.tsx
@@ -13,7 +13,7 @@ import { Doc } from '../../../fields/Doc';
import { FormattedTextBox } from '../nodes/formattedText/FormattedTextBox';
import { ContextMenu } from '../ContextMenu';
import { ObjectField } from '../../../fields/ObjectField';
-import { returnFalse } from '../../../Utils';
+import { returnFalse, returnZero, OmitKeys } from '../../../Utils';
import { ScriptField } from '../../../fields/ScriptField';
type CarouselDocument = makeInterface<[typeof documentSchema, typeof collectionSchema]>;
@@ -45,17 +45,18 @@ export class CollectionCarouselView extends CollectionSubView(CarouselDocument)
onContentClick = () => ScriptCast(this.layoutDoc.onChildClick);
@computed get content() {
const index = NumCast(this.layoutDoc._itemIndex);
- return !(this.childLayoutPairs?.[index]?.layout instanceof Doc) ? (null) :
+ const curDoc = this.childLayoutPairs?.[index];
+ return !(curDoc?.layout instanceof Doc) ? (null) :
<>
<div className="collectionCarouselView-image" key="image">
- <ContentFittingDocumentView {...this.props}
+ <ContentFittingDocumentView {...OmitKeys(this.props, ["NativeWidth", "NativeHeight"]).omit}
onDoubleClick={this.onContentDoubleClick}
onClick={this.onContentClick}
renderDepth={this.props.renderDepth + 1}
LayoutTemplate={this.props.ChildLayoutTemplate}
LayoutTemplateString={this.props.ChildLayoutString}
- Document={this.childLayoutPairs[index].layout}
- DataDoc={this.childLayoutPairs[index].data}
+ Document={curDoc.layout}
+ DataDoc={curDoc.data}
PanelHeight={this.panelHeight}
ScreenToLocalTransform={this.props.ScreenToLocalTransform}
bringToFront={returnFalse}
@@ -71,7 +72,7 @@ export class CollectionCarouselView extends CollectionSubView(CarouselDocument)
<FormattedTextBox key={index} {...this.props}
xMargin={NumCast(this.layoutDoc["_carousel-caption-xMargin"])}
yMargin={NumCast(this.layoutDoc["_carousel-caption-yMargin"])}
- Document={this.childLayoutPairs[index].layout} DataDoc={undefined} fieldKey={"caption"} />
+ Document={curDoc.layout} DataDoc={undefined} fieldKey={"caption"} />
</div>
</>;
}