mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-01 05:09:07 +08:00
Fixed attachment changes.
This commit is contained in:
parent
90180dafbb
commit
eb190c4b3e
@ -84,10 +84,16 @@ function spine.Skeleton.new (skeletonData, group)
|
|||||||
images[slot] = nil
|
images[slot] = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
-- Attachment image has changed.
|
||||||
|
if image and image.attachment ~= attachment then
|
||||||
|
image:removeSelf()
|
||||||
|
image = nil
|
||||||
|
end
|
||||||
-- Create new image.
|
-- Create new image.
|
||||||
if not image then
|
if not image then
|
||||||
image = self:createImage(attachment)
|
image = self:createImage(attachment)
|
||||||
if image then
|
if image then
|
||||||
|
image.attachment = attachment
|
||||||
image:setReferencePoint(display.CenterReferencePoint)
|
image:setReferencePoint(display.CenterReferencePoint)
|
||||||
image.width = attachment.width
|
image.width = attachment.width
|
||||||
image.height = attachment.height
|
image.height = attachment.height
|
||||||
|
|||||||
@ -74,10 +74,16 @@ function spine.Skeleton.new (skeletonData, group)
|
|||||||
images[attachment] = nil
|
images[attachment] = nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
-- Attachment image has changed.
|
||||||
|
if image and image.attachment ~= attachment then
|
||||||
|
image:removeSelf()
|
||||||
|
image = nil
|
||||||
|
end
|
||||||
-- Create new image.
|
-- Create new image.
|
||||||
if not image then
|
if not image then
|
||||||
image = self:createImage(attachment)
|
image = self:createImage(attachment)
|
||||||
if image then
|
if image then
|
||||||
|
image.attachment = attachment
|
||||||
local imageWidth = image:getWidth()
|
local imageWidth = image:getWidth()
|
||||||
local imageHeight = image:getHeight()
|
local imageHeight = image:getHeight()
|
||||||
attachment.widthRatio = attachment.width / imageWidth
|
attachment.widthRatio = attachment.width / imageWidth
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user