mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
[as3] SkeletonJson curve timeline parsing was incorrect. Closes #1382.
This commit is contained in:
parent
88406d2cae
commit
277d2f28f7
@ -69,6 +69,11 @@ package spine {
|
|||||||
this.attachmentLoader = attachmentLoader;
|
this.attachmentLoader = attachmentLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getFloatValue(object : Object, key: String, defaultValue : Number) : Number {;
|
||||||
|
var hasKey : Boolean = object.hasOwnProperty(key);
|
||||||
|
return hasKey ? Number(object[key]) : defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
/** @param object A String or ByteArray. */
|
/** @param object A String or ByteArray. */
|
||||||
public function readSkeletonData(object : *, name : String = null) : SkeletonData {
|
public function readSkeletonData(object : *, name : String = null) : SkeletonData {
|
||||||
if (object == null) throw new ArgumentError("object cannot be null.");
|
if (object == null) throw new ArgumentError("object cannot be null.");
|
||||||
@ -558,8 +563,8 @@ package spine {
|
|||||||
|
|
||||||
frameIndex = 0;
|
frameIndex = 0;
|
||||||
for each (valueMap in values) {
|
for each (valueMap in values) {
|
||||||
var x : Number = Number(valueMap["x"] || defaultValue) * timelineScale;
|
var x : Number = getFloatValue(valueMap, "x", defaultValue) * timelineScale;
|
||||||
var y : Number = Number(valueMap["y"] || defaultValue) * timelineScale;
|
var y : Number = getFloatValue(valueMap, "y", defaultValue) * timelineScale;
|
||||||
translateTimeline.setFrame(frameIndex, Number(valueMap["time"] || 0), x, y);
|
translateTimeline.setFrame(frameIndex, Number(valueMap["time"] || 0), x, y);
|
||||||
readCurve(valueMap, translateTimeline, frameIndex);
|
readCurve(valueMap, translateTimeline, frameIndex);
|
||||||
frameIndex++;
|
frameIndex++;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user