fixed getInnerRenderStyle for Tkinter widgets and positioning
This commit is contained in:
@@ -189,7 +189,9 @@ class Canvas extends React.Component {
|
||||
break
|
||||
}
|
||||
|
||||
if (ref.current.getElement().contains(target)) {
|
||||
// console.log("refs: ", ref)
|
||||
// TODO: remove the ref.current? if there are bugs it would become hard to debug
|
||||
if (ref.current?.getElement().contains(target)) {
|
||||
|
||||
if (!innerWidget) {
|
||||
innerWidget = ref.current
|
||||
@@ -657,7 +659,7 @@ class Canvas extends React.Component {
|
||||
handleDropEvent = (e, draggedElement, widgetClass = null) => {
|
||||
|
||||
e.preventDefault()
|
||||
console.log("Drop event")
|
||||
// console.log("Drop event")
|
||||
|
||||
this.setState({ isWidgetDragging: false })
|
||||
|
||||
@@ -790,7 +792,7 @@ class Canvas extends React.Component {
|
||||
x: (clientX - parentRect.left) / this.state.zoom,
|
||||
y: (clientY - parentRect.top) / this.state.zoom,
|
||||
}
|
||||
console.log("Swapp: ", swap)
|
||||
|
||||
// TODO: fix swapping for grid layouts
|
||||
if (swap) {
|
||||
// If swapping, we need to find the common parent
|
||||
|
||||
@@ -1133,7 +1133,7 @@ class Widget extends React.Component {
|
||||
>
|
||||
{/* FIXME: Swappable when the parent layout is flex/grid and gap is more, this trick won't work, add bg color to check */}
|
||||
{/* FIXME: Swappable, when the parent layout is gap is 0, it doesn't work well */}
|
||||
<div className="tw-relative tw-w-full tw-bg-red-500 tw-h-full tw-top-0 tw-left-0"
|
||||
<div className="tw-relative tw-w-full tw-h-full tw-top-0 tw-left-0"
|
||||
|
||||
>
|
||||
|
||||
@@ -1151,7 +1151,7 @@ class Widget extends React.Component {
|
||||
{/* helps with swappable: if the mouse is in this area while hovering/dropping, then swap */}
|
||||
</div>
|
||||
|
||||
<div className="tw-relative tw-top-0 tw-left-0 tw-bg-blue-500 tw-w-full tw-h-full" ref={this.innerAreaRef}
|
||||
<div className="tw-relative tw-top-0 tw-left-0 tw-w-full tw-h-full" ref={this.innerAreaRef}
|
||||
>
|
||||
{this.renderContent()}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user