-
Notifications
You must be signed in to change notification settings - Fork 55
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
pixi-tilemap assigns wrong width and height to the object when there are empty tiles #108
Comments
How width/height is calculated: https://github.com/pixijs/pixi-tilemap/blob/master/src/RectTileLayer.ts#L105 For every tile you add, minX maxX is calculated. What exactly is empty tile? |
If you mean that "tilemap should store width/height independently and ignore tiles that go out of those bounds" - no, sorry, those fields are calculated , its your problem to store width/height you want in your own tilemap. If you guys want different w/h - override the setter getter, like its done in pixi TilingSprite or Sprite |
also you can override calculateBounds of CompositeRectTileLayer or just RectTileLayer to take your own _$_width _$_height local vars , for example. |
Thank you for explaining :) I did a manual calculation on gdevelop's wrapper for pixi-tilemap, but it would be nice if we could have these be calculated and stored by pixi-tilemap somewhere :) Gdevelop uses this to do the bounding box of the object, which has an effect on
|
I am silly, we never add these empty tiles to pixi tilemap - so it has nothing to work with for estimating proper boundaries. @ivanpopelyshev I think I will close this bug, the fault is in the wrapper- since it never tells pixi-tilemap about them. But how do we tell to pixi-tilemap to change it's width/height externally? That would be incredibly useful for our case |
override calculateBounds() to add minX/maxX/minY/maxY that you specify in it :) , just use addFramePad two times - one for real tiles , one for your extra bounds |
At the same time, you have to do something about "width/height" property, if you want to use it for your own set bounds, and not pixi calculated ones. |
@ivanpopelyshev you make it sound like it would be simpler to just store it in my wrapper's variables - like I did on the PR at gdevelop 😄 sorry for raising a false alarm, took me a bit to realize it |
Gdevelop's wrapper for pixi-tilemap uses the width/height value of the object to draw a boundary box.
It appears that pixi-tilemap's width and height values are wrong whenever the tilemap has empty tiles, resulting in a smaller boundary box.
see
4ian/GDevelop#503 (comment)
The text was updated successfully, but these errors were encountered: