dazzafact Posted December 3, 2018 Share Posted December 3, 2018 Hello, iam trying to add an texture in a Container. Now, i exept this container has inherit the texture Height. If i scale the Container Height it will be scale it with the Height of the full stage height. See Video Composite Shot 1.mp4 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 4, 2018 Share Posted December 4, 2018 Container bounds contain all the children. Height of container is height of its local bounds. When you change the height, "scale.y" changes instead. https://github.com/pixijs/pixi.js/blob/dev/src/core/display/Container.js#L601 That's the same logic Adobe Flash had. To override it you have to extend Container class and override width/height properties, either calculateBounds() method, make it ignore children (https://github.com/pixijs/pixi.js/blob/dev/src/core/display/Container.js#L343) Pixi doesnt have container with fixed bounds in the package. Logic for sprite is a bit different: https://github.com/pixijs/pixi.js/blob/dev/src/core/sprites/Sprite.js#L537, it changes scale based on texture height and not bounds of children. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 4, 2018 Share Posted December 4, 2018 Actually, in your case, I think the problem is that container has position=(0,0) and sprite has position=(bigX, bigY). Of course it downscales to (0,0). Change container position to the point where you want it to scale down, it'll work Quote Link to comment Share on other sites More sharing options...
dazzafact Posted February 25, 2019 Author Share Posted February 25, 2019 Thanks ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.