-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding DisplayObject to a container causes this error : Uncaught RangeError: Maximum call stack size exceeded at ContentController.createContent #58
Comments
Under the hood. layout/src/controllers/ContentController.ts Line 268 in e1d591b
So, maybe in electron it can not detect it proper way? Try to just pass 'This is a PixiJS text' instead of Text instance. |
Tried to reproduce this one on a normal env, and there is no issue here. |
So, when it is an instance of text, it should just add it there. In case if this is a layout config tree, it should go throughout it and parse -> add elements recursively. So if it recognises your Text instance as layout config, it can start trying to parse it and this could potentially end up in Maximum call stack error |
Hi, thank you for your replying and taking your time. So the code from "Usage" section in the full doc won't work. new Layout({
content: {
content: Sprite.from("bunny.png"),
styles: {
position: "center",
maxWidth: "100%",
minHeight: "100%",
},
},
styles: {
background: "red",
position: "center",
width: `100%`,
height: `100%`,
},
}); I tried to add a rectangle to a layout using addChild() and it was added, but the layout won't recalculate its size. let rect = new Graphics();
rect.beginFill(0xffffff);
rect.drawRect(0, 0, 50, 50);
rect.endFill();
let L = new Layout
(
{
id: 'root',
content:
{
id: 'contentA',
content: {},
styles:
{
background: 'gray',
position: 'center',
borderRadius: 20,
padding: 20,
color: 'white',
}
},
styles:
{
background: 'black',
position: 'center',
borderRadius: 20,
padding: 20,
color: 'white',
}
}
);
L.getChildByID('contentA').addChild(rect); |
OK, that means, I am right and it can not recognise the instances. I could try to take a look into it if you would create some repo with this basic setup, but I am not en expert in electron so can not promise I will be able to fix this. |
Thank you again. |
Don't know of the root cause is the same but I also got call stack exceeded (after upgrading to 0.3.4). After doing a little bit of digging I found that the check I am not using electron by the way. |
Hmmm. Interesting discovery, do you think you could put it together in some repo where I can reproduce it and maybe fix? |
PixiJS UI is not installed in my project. |
Hi.
The bundle format is IIFE so put a script tag to load the one in your html. <script src="pixi.min.js"></script>
<script src="pixi-layout.js"></script>
<script src="index.js"></script> And then put the script below and please tell me the script works or doesn't. new pixiLayout.Layout({
content: {
content: new PIXI.Container(),
styles: {
position: "center",
maxWidth: "100%",
minHeight: "100%",
},
},
styles: {
background: "red",
position: "center",
width: `100%`,
height: `100%`,
},
}); |
got Maximum call stack size exceeded. Debugging shows content type is always object, so this is The issue I had in mind, will think how to improve that checks. |
Thank you again, CyberDex. |
@seafloyd16 , sorry for late answer. This may be related to the way imports are happening. The build is made with rollup, so using option Also as a potential reason it can be 2 different pixi folders used, one is when building pixiLayout, other one is when you import pixi from the file directly, so obviously, even if it is the same versions |
Why I get this error?
I am currently making an Electron app.
Electron is basically uses commonjs so I run esbuild to get a cjs formatted bundle.
And here is my script for quick test.
NodeJS v18.18.0
Electron v27.0.2
The text was updated successfully, but these errors were encountered: