diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/views/collections/collectionGrid/CollectionGridView.tsx | 14 | ||||
-rw-r--r-- | src/client/views/collections/collectionGrid/Grid.tsx | 6 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/client/views/collections/collectionGrid/CollectionGridView.tsx b/src/client/views/collections/collectionGrid/CollectionGridView.tsx index 9b24f1961..c56a894dc 100644 --- a/src/client/views/collections/collectionGrid/CollectionGridView.tsx +++ b/src/client/views/collections/collectionGrid/CollectionGridView.tsx @@ -231,7 +231,7 @@ export class CollectionGridView extends CollectionSubView(GridSchema) { // console.log(layout[0].w); // } - + console.log(this.props.Document.title + " " + this.props.isSelected() + " " + (!this.props.isSelected() && this.props.renderDepth !== 0 && !this.props.ContainingCollectionView?._isChildActive && !SnappingManager.GetIsDragging() ? "none" : undefined)); return ( <div className="collectionGridView_contents" style={{ @@ -240,12 +240,22 @@ export class CollectionGridView extends CollectionSubView(GridSchema) { pointerEvents: !this.props.isSelected() && this.props.renderDepth !== 0 && !this.props.ContainingCollectionView?._isChildActive && !SnappingManager.GetIsDragging() ? "none" : undefined }} ref={this.createDashEventsTarget} - onPointerDown={e => { ((e.target as any)?.className.includes("react-resizable-handle")) && e.stopPropagation(); }} // the grid doesn't stopPropagation when its widgets are hit, so we need to otherwise the outer documents will respond + onPointerDown={e => { + if (this.props.active(true)) { + if (this.props.isSelected(true)) { + e.stopPropagation(); + } + } + if (this.props.isSelected(true)) { + !((e.target as any)?.className.includes("react-resizable-handle")) && e.preventDefault(); + } + }} // the grid doesn't stopPropagation when its widgets are hit, so we need to otherwise the outer documents will respond > <Grid width={this.props.PanelWidth()} nodeList={contents} layout={layout} + childrenDraggable={this.props.isSelected() ? true : false} transformScale={this.props.ScreenToLocalTransform().Scale} numCols={this.props.Document.numCols as number} rowHeight={this.props.Document.rowHeight as number} diff --git a/src/client/views/collections/collectionGrid/Grid.tsx b/src/client/views/collections/collectionGrid/Grid.tsx index 9c66d1e33..cff5db743 100644 --- a/src/client/views/collections/collectionGrid/Grid.tsx +++ b/src/client/views/collections/collectionGrid/Grid.tsx @@ -7,7 +7,6 @@ import "../../../../../node_modules/react-resizable/css/styles.css"; import * as GridLayout from 'react-grid-layout'; import { Layout } from 'react-grid-layout'; -import { CollectionGridView } from './CollectionGridView'; export { Layout } from 'react-grid-layout'; @@ -19,6 +18,7 @@ interface GridProps { rowHeight: number; setLayout: Function; transformScale: number; + childrenDraggable: boolean; } /** @@ -32,13 +32,10 @@ export default class Grid extends React.Component<GridProps> { * @param layout `Layout[]` */ onLayoutChange(layout: Layout[]) { - console.log("setting in grid component" + layout[0].w); this.props.setLayout(layout); } - Scale = 2 render() { - console.log("In grid layout prop received value= " + this.props.layout?.[0]?.w); return ( <GridLayout className="layout" layout={this.props.layout} @@ -47,6 +44,7 @@ export default class Grid extends React.Component<GridProps> { width={this.props.width} compactType={null} isDroppable={true} + isDraggable={this.props.childrenDraggable} useCSSTransforms={true} margin={[10, 10]} onLayoutChange={layout => this.onLayoutChange(layout)} |