Fixed attachment changes.

This commit is contained in:
NathanSweet 2013-04-29 14:38:22 +02:00
parent 90180dafbb
commit eb190c4b3e
2 changed files with 12 additions and 0 deletions

View File

@ -84,10 +84,16 @@ function spine.Skeleton.new (skeletonData, group)
images[slot] = nil
end
else
-- Attachment image has changed.
if image and image.attachment ~= attachment then
image:removeSelf()
image = nil
end
-- Create new image.
if not image then
image = self:createImage(attachment)
if image then
image.attachment = attachment
image:setReferencePoint(display.CenterReferencePoint)
image.width = attachment.width
image.height = attachment.height

View File

@ -74,10 +74,16 @@ function spine.Skeleton.new (skeletonData, group)
images[attachment] = nil
end
else
-- Attachment image has changed.
if image and image.attachment ~= attachment then
image:removeSelf()
image = nil
end
-- Create new image.
if not image then
image = self:createImage(attachment)
if image then
image.attachment = attachment
local imageWidth = image:getWidth()
local imageHeight = image:getHeight()
attachment.widthRatio = attachment.width / imageWidth