mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 18:26:12 +08:00
[as3] Fix PathConstraint length spacing for zero length bones. See #1023.
This commit is contained in:
parent
bcc7da56d2
commit
cbb37a6096
Binary file not shown.
@ -33,6 +33,7 @@ package spine {
|
||||
|
||||
public class PathConstraint implements Constraint {
|
||||
private static const NONE : int = -1, BEFORE : int = -2, AFTER : int = -3;
|
||||
private static const epsilon : Number = 0.00001;
|
||||
internal var _data : PathConstraintData;
|
||||
internal var _bones : Vector.<Bone>;
|
||||
public var target : Slot;
|
||||
@ -88,11 +89,15 @@ package spine {
|
||||
for (var i : int = 0, n : int = spacesCount - 1; i < n;) {
|
||||
var bone : Bone = bones[i];
|
||||
var setupLength : Number = bone.data.length;
|
||||
if (setupLength == 0) setupLength = 0.000000001;
|
||||
var x : Number = setupLength * bone.a, y : Number = setupLength * bone.c;
|
||||
var length : Number = Math.sqrt(x * x + y * y);
|
||||
if (scale) lengths[i] = length;
|
||||
spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
|
||||
if (setupLength < epsilon) {
|
||||
if (scale) lengths[i] = 0;
|
||||
spaces[++i] = 0;
|
||||
} else {
|
||||
var x : Number = setupLength * bone.a, y : Number = setupLength * bone.c;
|
||||
var length : Number = Math.sqrt(x * x + y * y);
|
||||
if (scale) lengths[i] = length;
|
||||
spaces[++i] = (lengthSpacing ? setupLength + spacing : spacing) * length / setupLength;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 1; i < spacesCount; i++)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user