diff --git a/modern/src/App.js b/modern/src/App.js index d008aff8..6727a58c 100644 --- a/modern/src/App.js +++ b/modern/src/App.js @@ -115,7 +115,7 @@ function handleMouseButtonEventDispatch( ); } -function GuiObjectEvents({ Component, node, children }) { +function GuiObjectEvents({ node, children }) { const { alpha, ghost } = node.attributes; return ( @@ -153,15 +153,13 @@ function GuiObjectEvents({ Component, node, children }) { pointerEvents: ghost === 1 ? "none" : null, }} > - - {children} - + {children} ); } function Container(props) { - const { id, children, default_x, default_y, default_visible } = props; + const { id, node, children, default_x, default_y, default_visible } = props; const style = { position: "absolute", }; @@ -176,9 +174,11 @@ function Container(props) { } return ( -
- {children} -
+ +
+ {children} +
+
); } @@ -215,25 +215,27 @@ function Layout({ } return ( -
- {children} -
+ +
+ {children} +
+
); } @@ -252,21 +254,23 @@ function Layout({ } return ( -
- {children} -
+ +
+ {children} +
+
); } -function Layer({ node, id, image, children, x, y }) { +function Layer({ node, id, image, x, y }) { if (image == null) { console.warn("Got an Layer without an image. Rendering null", id); return null; @@ -299,14 +303,16 @@ function Layer({ node, id, image, children, x, y }) { params.backgroundImage = `url(${img.imgUrl}`; } return ( -
- {children} -
+ +
+ +
+
); } @@ -335,37 +341,39 @@ function Button({ } return ( -
{ - setDown(true); - document.addEventListener("mouseup", () => { - // TODO: This could be unmounted - setDown(false); - }); - }} - onClick={e => { - if (e.button === 2) { - node.js_trigger("onRightClick"); - } else { - node.js_trigger("onLeftClick"); - } - }} - title={tooltip} - style={{ - position: "absolute", - top: Number(y), - left: Number(x), - backgroundPositionX: -Number(img.x), - backgroundPositionY: -Number(img.y), - width: Number(img.w), - height: Number(img.h), - backgroundImage: `url(${img.imgUrl})`, - }} - > - {children} -
+ +
{ + setDown(true); + document.addEventListener("mouseup", () => { + // TODO: This could be unmounted + setDown(false); + }); + }} + onClick={e => { + if (e.button === 2) { + node.js_trigger("onRightClick"); + } else { + node.js_trigger("onLeftClick"); + } + }} + title={tooltip} + style={{ + position: "absolute", + top: Number(y), + left: Number(x), + backgroundPositionX: -Number(img.x), + backgroundPositionY: -Number(img.y), + width: Number(img.w), + height: Number(img.h), + backgroundImage: `url(${img.imgUrl})`, + }} + > + {children} +
+
); } @@ -408,8 +416,7 @@ function ToggleButton(props) { return