Browse Source

Scale bounding boxes on load.

NathanSweet 12 years ago
parent
commit
b132231034

+ 1 - 1
spine-c/src/spine/SkeletonJson.c

@@ -464,7 +464,7 @@ SkeletonData* SkeletonJson_readSkeletonData (SkeletonJson* self, const char* jso
 						box->verticesCount = verticesArray->size;
 						box->vertices = MALLOC(float, verticesArray->size);
 						for (vertex = verticesArray->child, i = 0; vertex; vertex = vertex->next, ++i)
-							box->vertices[i] = vertex->valueFloat;
+							box->vertices[i] = vertex->valueFloat * self->scale;
 						break;
 					}
 					}

+ 1 - 1
spine-csharp/src/SkeletonJson.cs

@@ -212,7 +212,7 @@ namespace Spine {
 				List<Object> values = (List<Object>)map["vertices"];
 				float[] vertices = new float[values.Count];
 				for (int i = 0, n = values.Count; i < n; i++)
-					vertices[i] = (float)values[i];
+					vertices[i] = (float)values[i] * scale;
 				boundingBox.Vertices = vertices;
 			}
 

+ 5 - 5
spine-libgdx/src/com/esotericsoftware/spine/SkeletonJson.java

@@ -197,12 +197,12 @@ public class SkeletonJson {
 
 		} else if (attachment instanceof BoundingBoxAttachment) {
 			BoundingBoxAttachment box = (BoundingBoxAttachment)attachment;
-			JsonValue pointsArray = map.require("vertices");
-			float[] points = new float[pointsArray.size];
+			JsonValue verticesArray = map.require("vertices");
+			float[] vertices = new float[verticesArray.size];
 			int i = 0;
-			for (JsonValue point = pointsArray.child; point != null; point = point.next())
-				points[i++] = point.asFloat();
-			box.setVertices(points);
+			for (JsonValue point = verticesArray.child; point != null; point = point.next())
+				vertices[i++] = point.asFloat() * scale;
+			box.setVertices(vertices);
 		}
 
 		return attachment;