diff --git a/.gitignore b/.gitignore index 4d29575..d3e63b4 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,8 @@ /.pnp .pnp.js +python-tests/ + # testing /coverage diff --git a/src/canvas/canvas.js b/src/canvas/canvas.js index ad3398c..b06c960 100644 --- a/src/canvas/canvas.js +++ b/src/canvas/canvas.js @@ -23,10 +23,11 @@ import { ReactComponent as DotsBackground } from "../assets/background/dots.svg" import DroppableWrapper from "../components/draggable/droppable" -import { PosType } from "./constants/layouts" +import { Layouts, PosType } from "./constants/layouts" import WidgetContainer from "./constants/containers" import { isSubClassOfWidget } from "../utils/widget" import { ButtonModal } from "../components/modals" +import ResizeWidgetContainer from "./resizeContainer" // const DotsBackground = require("../assets/background/dots.svg") @@ -65,6 +66,7 @@ class Canvas extends React.Component { this.widgetRefs = {} // stores the actual refs to the widgets inside the canvas {id: ref, id2, ref2...} this.state = { + isWidgetDragging: false, widgetResizing: "", // set this to "nw", "sw" etc based on the side when widgets resizing handles are selected widgets: [], // stores the mapping to widgetRefs, stores id and WidgetType, later used for rendering [{id: , widgetType: WidgetClass, children: [], parent: "", initialData: {}}] zoom: 1, @@ -181,8 +183,8 @@ class Canvas extends React.Component { let innerWidget = null for (let [key, ref] of Object.entries(this.widgetRefs)) { - - if (ref.current === target){ + + if (ref.current === target) { innerWidget = ref.current break } @@ -235,11 +237,13 @@ class Canvas extends React.Component { this.state.selectedWidget?.setZIndex(0) selectedWidget.setZIndex(1000) selectedWidget.select() + // console.log("selected widget", selectedWidget, this.state.selectedWidget) this.setState({ selectedWidget: selectedWidget, toolbarAttrs: selectedWidget.getToolbarAttrs() }) + // if (!this.state.selectedWidget || (selectedWidget.getId() !== this.state.selectedWidget?.getId())) { // this.state.selectedWidget?.deSelect() // deselect the previous widget before adding the new one // this.state.selectedWidget?.setZIndex(0) @@ -301,16 +305,16 @@ class Canvas extends React.Component { { key: "snap", label: (