aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionStackingView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/collections/CollectionStackingView.tsx')
-rw-r--r--src/client/views/collections/CollectionStackingView.tsx19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index b4a8974f0..80653ec94 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -54,7 +54,7 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
@computed get chromeStatus() { return this.props.chromeStatus || StrCast(this.layoutDoc._chromeStatus); }
@computed get columnHeaders() { return Cast(this.layoutDoc._columnHeaders, listSpec(SchemaHeaderField)); }
@computed get pivotField() { return StrCast(this.layoutDoc._pivotField); }
- @computed get filteredChildren() { return this.childLayoutPairs.filter(pair => pair.layout instanceof Doc && !pair.layout.hidden).map(pair => pair.layout); }
+ @computed get filteredChildren() { return this.childLayoutPairs.filter(pair => pair.layout instanceof Doc).map(pair => pair.layout); }
@computed get headerMargin() { return this.props.styleProvider?.(this.layoutDoc, this.props, StyleProp.HeaderMargin); }
@computed get xMargin() { return NumCast(this.layoutDoc._xMargin, 2 * Math.min(this.gridGap, .05 * this.props.PanelWidth())); }
@computed get yMargin() { return this.props.yMargin || NumCast(this.layoutDoc._yMargin, 5); } // 2 * this.gridGap)); }
@@ -265,7 +265,7 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
return maxWidth / (this.props.scaling?.() || 1);
}
getDocHeight(d?: Doc) {
- if (!d) return 0;
+ if (!d || d.hidden) return 0;
const childLayoutDoc = Doc.Layout(d, this.props.childLayoutTemplate?.());
const childDataDoc = (!d.isTemplateDoc && !d.isTemplateForField && !d.PARAMS) ? undefined : this.props.DataDoc;
const maxHeight = (lim => lim === 0 ? this.props.PanelWidth() : lim === -1 ? 10000 : lim)(NumCast(this.layoutDoc.childLimitHeight, -1));
@@ -280,7 +280,7 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
}
const childHeight = NumCast(childLayoutDoc._height);
const panelHeight = this.props.PanelHeight() - 2 * this.yMargin;
- return Math.min(childHeight, maxHeight, panelHeight) / (this.props.scaling?.() || 1);;
+ return Math.min(childHeight, maxHeight, panelHeight);// / (this.props.scaling?.() || 1);;
}
columnDividerDown = (e: React.PointerEvent) => {
@@ -331,10 +331,21 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
}
}
}
+ if (de.complete.annoDragData?.dragDocument && super.onInternalDrop(e, de)) return this.internalAnchorAnnoDrop(e, de.complete.annoDragData);
return false;
}
@undoBatch
+ internalAnchorAnnoDrop(e: Event, annoDragData: DragManager.AnchorAnnoDragData) {
+ const dropCreator = annoDragData.dropDocCreator;
+ annoDragData.dropDocCreator = (annotationOn: Doc | undefined) => {
+ const dropDoc = dropCreator(annotationOn);
+ return dropDoc || this.rootDoc;
+ };
+ return true;
+ }
+
+ @undoBatch
@action
onExternalDrop = async (e: React.DragEvent): Promise<void> => {
const where = [e.clientX, e.clientY];
@@ -486,6 +497,7 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
@computed get scaling() { return !this.nativeWidth ? 1 : this.props.PanelHeight() / this.nativeHeight; }
+ @computed get backgroundEvents() { return SnappingManager.GetIsDragging(); }
observer: any;
render() {
TraceMobx();
@@ -504,6 +516,7 @@ export class CollectionStackingView extends CollectionSubView<StackingDocument,
height: `${1 / this.scaling * 100}%`,
width: `${1 / this.scaling * 100}%`,
transformOrigin: "top left",
+ pointerEvents: this.backgroundEvents ? "all" : undefined
}}
onScroll={action(e => this._scroll = e.currentTarget.scrollTop)}
onDrop={this.onExternalDrop.bind(this)}