Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Sprite getWidth problem — Gideros Forum

Sprite getWidth problem

kussakovkussakov Member
edited September 2012 in Bugs and issues
Hi All,

I have an issue with Sprite:getWidth().

The documentation says: "The width is calculated based on the bounds of the content of the sprite."

I have a sprite with several children.
Some of the children are text, some images.
It does not get rotated or anything.

When I use getWidth() I do not get the real width of the sprite. Instead I am getting something that appears to be random number.
I suspect this is because some of the children of the sprite are text sprites...

Has anyone experienced the same problem?
Any thoughts?

Thanks

Vlad

Comments

  • MellsMells Guru
    edited September 2012
    Hi Vlad,
    try with Sprite:getBounds()?
    local x, y, width, height = Sprite:getBounds(stage)
    -> Read more
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • Thanks!

    I will try getBounds and post here if it does not work for me.
  • @kussakov well thats sounds strange
    could you provide simple example so I could confirm that? And we could report it as bug
  • Sprite:getBounds() is now documented.
    local x, y, width, height = sprite:getBounds(sprite) -- returns local (untransformed) bounds
    local x, y, width, height = sprite:getBounds(stage) -- returns bounds as transformed to stage's coordinate system
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
  • Thanks,

    I will try to create a simple project with test case and post it here.
  • I see this bug fixed in v.2012.8.3
    "Sprite:getBounds() function returns wrong values when there are more than 2 level of hierarchies and rotation".
    I have to install it and check. I have more than 2 levels of hierarchy...

Sign In or Register to comment.