mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[csharp] Port RegionAttachment.java checking for compatible region values.
This commit is contained in:
parent
0b01953690
commit
2345764fbf
@ -79,14 +79,22 @@ namespace Spine {
|
|||||||
public void UpdateOffset () {
|
public void UpdateOffset () {
|
||||||
float width = this.width;
|
float width = this.width;
|
||||||
float height = this.height;
|
float height = this.height;
|
||||||
|
float localX2 = width * 0.5f;
|
||||||
|
float localY2 = height * 0.5f;
|
||||||
|
float localX = -localX2;
|
||||||
|
float localY = -localY2;
|
||||||
|
if (regionOriginalWidth != 0) { // if (region != null)
|
||||||
|
localX += regionOffsetX / regionOriginalWidth * width;
|
||||||
|
localY += regionOffsetY / regionOriginalHeight * height;
|
||||||
|
localX2 -= (regionOriginalWidth - regionOffsetX - regionWidth) / regionOriginalWidth * width;
|
||||||
|
localY2 -= (regionOriginalHeight - regionOffsetY - regionHeight) / regionOriginalHeight * height;
|
||||||
|
}
|
||||||
float scaleX = this.scaleX;
|
float scaleX = this.scaleX;
|
||||||
float scaleY = this.scaleY;
|
float scaleY = this.scaleY;
|
||||||
float regionScaleX = width / regionOriginalWidth * scaleX;
|
localX *= scaleX;
|
||||||
float regionScaleY = height / regionOriginalHeight * scaleY;
|
localY *= scaleY;
|
||||||
float localX = -width / 2 * scaleX + regionOffsetX * regionScaleX;
|
localX2 *= scaleX;
|
||||||
float localY = -height / 2 * scaleY + regionOffsetY * regionScaleY;
|
localY2 *= scaleY;
|
||||||
float localX2 = localX + regionWidth * regionScaleX;
|
|
||||||
float localY2 = localY + regionHeight * regionScaleY;
|
|
||||||
float rotation = this.rotation;
|
float rotation = this.rotation;
|
||||||
float cos = MathUtils.CosDeg(rotation);
|
float cos = MathUtils.CosDeg(rotation);
|
||||||
float sin = MathUtils.SinDeg(rotation);
|
float sin = MathUtils.SinDeg(rotation);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user