getBoundingBox 问题

arv000
Thu, 09 Apr 2015 08:02:57 +0000

auto sprite2 = ChapterMenuItemImage::create(
                                           "CloseNormal_100.png",
                                           "CloseSelected_100.png",
                                           CC_CALLBACK_1(MapChooseScene::menuCallback, this,iItem));
            sprite2->setPosition(endWidht,endHeight);
            int x = sprite2->getContentSize().width;
            int y =sprite2->getContentSize().height;
            log("x=%d",x);
            log("y=%d",y);
            Rect rect1 = sprite2->getBoundingBox();
            sprite2->setScaleX(itemWidht/(x));
            Rect rect2 = sprite2->getBoundingBox();
            sprite2->setScaleY(itemHeight/(y));

            sprite2->setContentSize(Size(itemWidht,itemHeight));

            Rect rect = sprite2->getBoundingBox();


```


在使用setScaleX，setScaleY之后与那里的


  QQ截图20150409161000.png803×141



图片的原始大小为40*40
理论上来说应该rect de width =100，height=100才对的呀~~~
getContentSize 获取的值是对的，但是getBoundingBox就不对了，不知道为什么求指导~~~

阅读整个主题