mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-06 18:56:54 +08:00
[libgdx] Fixed slider scale.
This commit is contained in:
parent
1408b21dee
commit
733fa9169c
@ -430,14 +430,15 @@ public class SkeletonBinary extends SkeletonLoader {
|
|||||||
data.local = (nn & 128) != 0;
|
data.local = (nn & 128) != 0;
|
||||||
data.bone = bones[input.readInt(true)];
|
data.bone = bones[input.readInt(true)];
|
||||||
float offset = input.readFloat();
|
float offset = input.readFloat();
|
||||||
|
float propertyScale = 1;
|
||||||
data.property = switch (input.readByte()) {
|
data.property = switch (input.readByte()) {
|
||||||
case 0 -> new FromRotate();
|
case 0 -> new FromRotate();
|
||||||
case 1 -> {
|
case 1 -> {
|
||||||
offset *= scale;
|
propertyScale = scale;
|
||||||
yield new FromX();
|
yield new FromX();
|
||||||
}
|
}
|
||||||
case 2 -> {
|
case 2 -> {
|
||||||
offset *= scale;
|
propertyScale = scale;
|
||||||
yield new FromY();
|
yield new FromY();
|
||||||
}
|
}
|
||||||
case 3 -> new FromScaleX();
|
case 3 -> new FromScaleX();
|
||||||
@ -445,9 +446,9 @@ public class SkeletonBinary extends SkeletonLoader {
|
|||||||
case 5 -> new FromShearY();
|
case 5 -> new FromShearY();
|
||||||
default -> null;
|
default -> null;
|
||||||
};
|
};
|
||||||
data.property.offset = offset;
|
data.property.offset = offset * propertyScale;
|
||||||
data.offset = input.readFloat();
|
data.offset = input.readFloat();
|
||||||
data.scale = input.readFloat();
|
data.scale = input.readFloat() / propertyScale;
|
||||||
}
|
}
|
||||||
constraints[i] = data;
|
constraints[i] = data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -413,9 +413,10 @@ public class SkeletonJson extends SkeletonLoader {
|
|||||||
if (data.bone == null) throw new SerializationException("Slider bone not found: " + boneName);
|
if (data.bone == null) throw new SerializationException("Slider bone not found: " + boneName);
|
||||||
String property = constraintMap.getString("property");
|
String property = constraintMap.getString("property");
|
||||||
data.property = fromProperty(property);
|
data.property = fromProperty(property);
|
||||||
data.property.offset = constraintMap.getFloat("from", 0) * propertyScale(property, scale);
|
float propertyScale = propertyScale(property, scale);
|
||||||
|
data.property.offset = constraintMap.getFloat("from", 0) * propertyScale;
|
||||||
data.offset = constraintMap.getFloat("to", 0);
|
data.offset = constraintMap.getFloat("to", 0);
|
||||||
data.scale = constraintMap.getFloat("scale", 1);
|
data.scale = constraintMap.getFloat("scale", 1) / propertyScale;
|
||||||
data.local = constraintMap.getBoolean("local", false);
|
data.local = constraintMap.getBoolean("local", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user