These are chat archives for pixijs/pixi.js

17th
Jan 2016
Micheal Winger
@mordof
Jan 17 2016 01:43
if a Graphics object isn't rendered in the scene - containsPoint will not work, is that correct?
i guess that makes some sense if it doesn't know relative to the position where it should be checking
Micheal Winger
@mordof
Jan 17 2016 02:01
no worries on that.. shifted the x, y myself so i can use the shape.contains :)
Bar Ziony
@bartzy
Jan 17 2016 14:59
How do I hard-set the dimensions of a PIXI displayobject/container/sprite?
I want it to be exactly 400x400, regardless of the sprite's texture size for example.
Chad Engler
@englercj
Jan 17 2016 16:04
For a sprite, you can set the width/hight directly which will adjust the scale to make it that size
A DO/Container doesn't have dimensions per say, its bounds are the size of its children
Bar Ziony
@bartzy
Jan 17 2016 16:25
Thanks.
How can I make a Container have a specified size though? I don't want to children to go over these dimensions.
I don't quite understand the reasoning behind not having some kind of frame/bounds that you set when creating the object?
instead of having the content implicitly determine the size of the object
Ivan Popelyshev
@ivanpopelyshev
Jan 17 2016 16:31
override getBounds()
Bar Ziony
@bartzy
Jan 17 2016 16:35
ok
can I do that for the sprite as well ?
Bar Ziony
@bartzy
Jan 17 2016 16:43
@ivanpopelyshev I mean, overriding getBounds
Chad Engler
@englercj
Jan 17 2016 16:58
When you say "have a specified size" what does that mean?
Are you trying to clip out all things outside the container?
If so, you are looking for bounds
I don't quite understand the reasoning behind not having some kind of frame/bounds that you set when creating the object?
Because a container isn't drawn, size doesn't actually mean anything for a container
Bar Ziony
@bartzy
Jan 17 2016 17:00
I have a list of layers coming from a configuration. Each layer has x, y and width/height. I want to set the width and the height explicitly.
Some layers are images. Some are not...
so for example, I have a layer which has 2 children - an image and its mask. And you can move the image in the "hole" that the mask creates.
That layer has a specific size. I don't want the size of the children to determine it...
Bar Ziony
@bartzy
Jan 17 2016 17:11
@englercj So I should override getBounds for both Container and Sprite?
I dont' quite get the relation between width/_width and getBounds :|
It seems like _width is getting used by Sprite in onTextureUpdate
Bar Ziony
@bartzy
Jan 17 2016 17:39
@englercj ? :)
Ivan Popelyshev
@ivanpopelyshev
Jan 17 2016 18:50
@Bartzy why do you need width/height anyway
position scale and rotation are important, getBounds() are used only for filters
do what you want with _width _height and getBounds()
Chad Engler
@englercj
Jan 17 2016 23:39
Can you tell me what you actually need the size for?
Like I mentioned, size doesn't have any semantic meaning for an container; so I'm not sure what behavior you are trying to create
if you want to render only within a size, use a mask; if you want to apply a filter to an area, use filterArea; interactions within an area, use hitArea
width/height is how big the item being drawn is, which for a container is nothing