removed console statements

This commit is contained in:
paul
2025-03-07 18:29:07 +05:30
parent 217dedc121
commit 6aff8d37e4
2 changed files with 13 additions and 15 deletions

View File

@@ -39,6 +39,8 @@ const CanvasModes = {
}
const IS_PRODUCTION = process.env.NODE_ENV === "production"
class Canvas extends React.Component {
// static contextType = ActiveWidgetContext
@@ -789,6 +791,15 @@ class Canvas extends React.Component {
}
/**
* Checks if the child fell in the swappable area
*
*/
__checkClosestSwappableElement = ({event, parentWidgetId, dragWidgetId}) => {
}
/**
* Adds the child into the children attribute inside the this.widgets list of objects
* // widgets data structure { id, widgetType: widgetComponentType, children: [], parent: "" }
@@ -817,8 +828,6 @@ class Canvas extends React.Component {
const {dragStartCursorPos, initialPos} = posMetaData
console.log("Pos meyta data: ", posMetaData)
let finalPosition = {
x: (clientX - parentRect.left) / this.state.zoom,
y: (clientY - parentRect.top) / this.state.zoom,
@@ -889,7 +898,6 @@ class Canvas extends React.Component {
widgetContainer: WidgetContainer.WIDGET
}
}
console.log("added parent: ", updatedDragWidget)
const updatedDropWidget = {
...dropWidgetObj,
@@ -1068,7 +1076,6 @@ class Canvas extends React.Component {
// FIXME: initial data parentWidgetRef is empty
const { id, widgetType: ComponentType, children = [], parent, initialData = {} } = widget
console.log("parent: ", parent)
const renderChildren = (childrenData) => {
// recursively render the child elements
return childrenData.map((child) => {
@@ -1079,7 +1086,6 @@ class Canvas extends React.Component {
return null
})
}
console.log("initial data: ", initialData, initialData.parentWidgetRef)
return (
@@ -1159,7 +1165,7 @@ class Canvas extends React.Component {
}}
/>
{/* Canvas */}
<div data-canvas className="tw-w-full tw-h-full tw-absolute tw-bg-red-300 tw-top-0 tw-select-none"
<div data-canvas className={`tw-w-full tw-h-full tw-absolute ${!IS_PRODUCTION ? "tw-bg-red-300" : "tw-bg-transparent"} tw-top-0 tw-select-none`}
ref={this.canvasRef}>
<div className="tw-relative tw-w-full tw-h-full">
{

View File

@@ -1160,11 +1160,8 @@ class Widget extends React.Component {
const elementRect = this.elementRef.current.getBoundingClientRect()
const canvasInnerRect = this.props.canvasInnerContainerRef.current.getBoundingClientRect()
const {zoom, pan} = this.props.canvasMetaData
// const {zoom, pan} = this.props.canvasMetaData
console.log("Loss: ", this.props.parentWidgetRef)
// TODO: if parent exist also subtract it
let initialPos = {
x: elementRect.left - canvasInnerRect.left,
@@ -1173,12 +1170,10 @@ class Widget extends React.Component {
let parent = this.props.parentWidgetRef?.current;
console.log("parent1111: ", this.__id, parent, this.props)
while (parent) {
// accounting for nested parents
const parentRect = parent.getBoundingRect()
console.log("parent: ", parentRect)
initialPos.x -= parentRect.left - canvasInnerRect.left
initialPos.y -= parentRect.top - canvasInnerRect.top
@@ -1191,8 +1186,6 @@ class Widget extends React.Component {
initialPos: {...initialPos}
}
console.log("initial pos: ", posMetaData)
setPosMetaData(posMetaData)
}
@@ -1202,7 +1195,6 @@ class Widget extends React.Component {
const {zoom: canvasZoom, pan: canvasPan} = this.canvasMetaData
// FIXME: if the parent container has tw-overflow-none, then the resizable indicator are also hidden
return (
<DragContext.Consumer>