From 86eac2d13f619f0e7d7ba4abeed0bd7d53d7e2d6 Mon Sep 17 00:00:00 2001 From: eeng5 Date: Wed, 21 Aug 2019 12:03:25 -0400 Subject: can drag-drop in masonry --- .../collections/CollectionMasonryViewFieldRow.tsx | 34 ++++++++++++---------- .../views/collections/CollectionStackingView.scss | 8 ----- .../views/collections/CollectionStackingView.tsx | 3 ++ 3 files changed, 21 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionMasonryViewFieldRow.tsx b/src/client/views/collections/CollectionMasonryViewFieldRow.tsx index 630d510a1..dbd7f9e3c 100644 --- a/src/client/views/collections/CollectionMasonryViewFieldRow.tsx +++ b/src/client/views/collections/CollectionMasonryViewFieldRow.tsx @@ -143,14 +143,14 @@ export class CollectionMasonryViewFieldRow extends React.Component { + pointerEnteredRow = () => { if (SelectionManager.GetIsDragging()) { this._background = "#b4b4b4"; } } @action - pointerLeave = () => { + pointerLeaveRow = () => { this._background = "inherit"; document.removeEventListener("pointermove", this.startDrag); } @@ -249,6 +249,7 @@ export class CollectionMasonryViewFieldRow extends React.Component + style={{ width: this.props.parent.NodeWidth }} + ref={this.createRowDropRef} + onPointerEnter={this.pointerEnteredRow} + onPointerLeave={this.pointerLeaveRow} + > {headingView} { - this._headingsHack && heading ? (null) : -
list + ` ${this.props.parent.columnWidth}px`, ""), - }}> - {this.masonryChildren(this.props.docList)} - {this.props.parent.columnDragger} -
+
list + ` ${this.props.parent.columnWidth}px`, ""), + }}> + {this.masonryChildren(this.props.docList)} + {this.props.parent.columnDragger} +
} { //controls the +NEW for each row (this.props.parent.props.CollectionView.props.Document.chromeStatus !== 'view-mode' && this.props.parent.props.CollectionView.props.Document.chromeStatus !== 'disabled') ? diff --git a/src/client/views/collections/CollectionStackingView.scss b/src/client/views/collections/CollectionStackingView.scss index a83c97624..deb295a41 100644 --- a/src/client/views/collections/CollectionStackingView.scss +++ b/src/client/views/collections/CollectionStackingView.scss @@ -294,12 +294,4 @@ .rc-switch-checked .rc-switch-inner { left: 8px; } - - -} - -.red-box { - width: 200px; - height: 200px; - background: red; } \ No newline at end of file diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx index c2342eb50..289c3a1fa 100644 --- a/src/client/views/collections/CollectionStackingView.tsx +++ b/src/client/views/collections/CollectionStackingView.tsx @@ -48,6 +48,9 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) { return Math.min(this.props.PanelWidth() / (this.props as any).ContentScaling() - 2 * this.xMargin, this.isStackingView ? Number.MAX_VALUE : NumCast(this.props.Document.columnWidth, 250)); } + @computed get NodeWidth() { + return this.props.PanelWidth(); + } childDocHeight(child: Doc) { return this.getDocHeight(Doc.GetLayoutDataDocPair(this.props.Document, this.props.DataDoc, this.props.fieldKey, child).layout); } -- cgit v1.2.3-70-g09d2