Skip to content
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

fix tiledmap object texture render error #5633

Conversation

sunnylanwanjun
Copy link
Contributor

@sunnylanwanjun sunnylanwanjun commented Oct 28, 2019

修复object group纹理坐标不正确的问题。
修复在同一帧插入删除再插入用户节点,会报组件已存在的问题。(因为组件在下一帧才会从node中移除,这里调用了内部的_removeComponent方法,把组件立即从node中移除,然后再手动调用组件destroy方法。)

@@ -224,7 +224,8 @@ let TiledObjectGroup = cc.Class({
sp = imgNode.addComponent(cc.Sprite);
}
sp.spriteFrame = new cc.SpriteFrame();
sp.spriteFrame.setTexture(grid.tileset.sourceImage, grid);
let rect = cc.rect(grid.x, grid.y, grid.width, grid.height);
sp.spriteFrame.setTexture(grid.tileset.sourceImage, rect);
Copy link
Member

@jareguo jareguo Oct 28, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

直接 cc.rect(grid) 就行

cocos2d/tilemap/CCTiledLayer.js Outdated Show resolved Hide resolved
@jareguo jareguo merged commit e186ad9 into cocos:v2.2.1-release Oct 29, 2019
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants