mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 23:34:53 +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.bone = bones[input.readInt(true)];
|
||||
float offset = input.readFloat();
|
||||
float propertyScale = 1;
|
||||
data.property = switch (input.readByte()) {
|
||||
case 0 -> new FromRotate();
|
||||
case 1 -> {
|
||||
offset *= scale;
|
||||
propertyScale = scale;
|
||||
yield new FromX();
|
||||
}
|
||||
case 2 -> {
|
||||
offset *= scale;
|
||||
propertyScale = scale;
|
||||
yield new FromY();
|
||||
}
|
||||
case 3 -> new FromScaleX();
|
||||
@ -445,9 +446,9 @@ public class SkeletonBinary extends SkeletonLoader {
|
||||
case 5 -> new FromShearY();
|
||||
default -> null;
|
||||
};
|
||||
data.property.offset = offset;
|
||||
data.property.offset = offset * propertyScale;
|
||||
data.offset = input.readFloat();
|
||||
data.scale = input.readFloat();
|
||||
data.scale = input.readFloat() / propertyScale;
|
||||
}
|
||||
constraints[i] = data;
|
||||
}
|
||||
|
||||
@ -413,9 +413,10 @@ public class SkeletonJson extends SkeletonLoader {
|
||||
if (data.bone == null) throw new SerializationException("Slider bone not found: " + boneName);
|
||||
String property = constraintMap.getString("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.scale = constraintMap.getFloat("scale", 1);
|
||||
data.scale = constraintMap.getFloat("scale", 1) / propertyScale;
|
||||
data.local = constraintMap.getBoolean("local", false);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user