mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 02:06:03 +08:00
[csharp] RegionAttachment#UpdateOffset clean up.
This commit is contained in:
parent
22613ea84c
commit
791a9e6c4a
@ -76,29 +76,19 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateOffset () {
|
public void UpdateOffset () {
|
||||||
float width = this.width;
|
float width = this.width, height = this.height;
|
||||||
float height = this.height;
|
float scaleX = this.scaleX, scaleY = this.scaleY;
|
||||||
float localX2 = width * 0.5f;
|
float localX2 = width * 0.5f;
|
||||||
float localY2 = height * 0.5f;
|
float localY2 = height * 0.5f;
|
||||||
float localX = -localX2;
|
float localX = (-localX2 + regionOffsetX / regionOriginalWidth * width) * scaleX;
|
||||||
float localY = -localY2;
|
float localY = (-localY2 + regionOffsetY / regionOriginalHeight * height) * scaleY;
|
||||||
if (regionOriginalWidth != 0) { // if (region != null)
|
|
||||||
localX += regionOffsetX / regionOriginalWidth * width;
|
|
||||||
localY += regionOffsetY / regionOriginalHeight * height;
|
|
||||||
localX2 -= (regionOriginalWidth - regionOffsetX - regionWidth) / regionOriginalWidth * width;
|
localX2 -= (regionOriginalWidth - regionOffsetX - regionWidth) / regionOriginalWidth * width;
|
||||||
localY2 -= (regionOriginalHeight - regionOffsetY - regionHeight) / regionOriginalHeight * height;
|
localY2 -= (regionOriginalHeight - regionOffsetY - regionHeight) / regionOriginalHeight * height;
|
||||||
}
|
|
||||||
float scaleX = this.scaleX;
|
|
||||||
float scaleY = this.scaleY;
|
|
||||||
localX *= scaleX;
|
|
||||||
localY *= scaleY;
|
|
||||||
localX2 *= scaleX;
|
localX2 *= scaleX;
|
||||||
localY2 *= scaleY;
|
localY2 *= scaleY;
|
||||||
float rotation = this.rotation;
|
float cos = MathUtils.CosDeg(this.rotation);
|
||||||
float cos = MathUtils.CosDeg(rotation);
|
float sin = MathUtils.SinDeg(this.rotation);
|
||||||
float sin = MathUtils.SinDeg(rotation);
|
float x = this.x, y = this.y;
|
||||||
float x = this.x;
|
|
||||||
float y = this.y;
|
|
||||||
float localXCos = localX * cos + x;
|
float localXCos = localX * cos + x;
|
||||||
float localXSin = localX * sin;
|
float localXSin = localX * sin;
|
||||||
float localYCos = localY * cos + y;
|
float localYCos = localY * cos + y;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user