@esotericsoftware/spine-canvaskit 4.2.55 → 4.2.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -11804,9 +11804,19 @@ var spine = (() => {
11804
11804
  throw new Error(`Could not load image ${path}`);
11805
11805
  const paintPerBlendMode = /* @__PURE__ */ new Map();
11806
11806
  const shaders = [];
11807
- for (const blendMode of [0 /* Normal */, 1 /* Additive */, 2 /* Multiply */, 3 /* Screen */]) {
11807
+ for (const blendMode of [
11808
+ 0 /* Normal */,
11809
+ 1 /* Additive */,
11810
+ 2 /* Multiply */,
11811
+ 3 /* Screen */
11812
+ ]) {
11808
11813
  const paint = new ck.Paint();
11809
- const shader = image.makeShaderOptions(ck.TileMode.Clamp, ck.TileMode.Clamp, ck.FilterMode.Linear, ck.MipmapMode.Linear);
11814
+ const shader = image.makeShaderOptions(
11815
+ ck.TileMode.Clamp,
11816
+ ck.TileMode.Clamp,
11817
+ ck.FilterMode.Linear,
11818
+ ck.MipmapMode.Linear
11819
+ );
11810
11820
  paint.setShader(shader);
11811
11821
  paint.setBlendMode(toCkBlendMode(ck, blendMode));
11812
11822
  paintPerBlendMode.set(blendMode, paint);
@@ -11820,14 +11830,19 @@ var spine = (() => {
11820
11830
  const slashIndex = atlasFile.lastIndexOf("/");
11821
11831
  const parentDir = slashIndex >= 0 ? atlasFile.substring(0, slashIndex + 1) + "/" : "";
11822
11832
  for (const page of atlas.pages) {
11823
- const texture = await CanvasKitTexture.fromFile(ck, parentDir + page.name, readFile);
11833
+ const texture = await CanvasKitTexture.fromFile(
11834
+ ck,
11835
+ parentDir + page.name,
11836
+ readFile
11837
+ );
11824
11838
  page.setTexture(texture);
11825
11839
  }
11826
11840
  return atlas;
11827
11841
  }
11828
- async function loadSkeletonData(skeletonFile, atlas, readFile) {
11842
+ async function loadSkeletonData(skeletonFile, atlas, readFile, scale = 1) {
11829
11843
  const attachmentLoader = new AtlasAttachmentLoader(atlas);
11830
11844
  const loader = skeletonFile.endsWith(".json") ? new SkeletonJson(attachmentLoader) : new SkeletonBinary(attachmentLoader);
11845
+ loader.scale = scale;
11831
11846
  let data = await readFile(skeletonFile);
11832
11847
  if (skeletonFile.endsWith(".json")) {
11833
11848
  data = bufferToUtf8String(data);
@@ -11843,7 +11858,9 @@ var spine = (() => {
11843
11858
  */
11844
11859
  constructor(skeletonData) {
11845
11860
  this.skeleton = new Skeleton(skeletonData);
11846
- this.animationState = new AnimationState(new AnimationStateData(skeletonData));
11861
+ this.animationState = new AnimationState(
11862
+ new AnimationStateData(skeletonData)
11863
+ );
11847
11864
  }
11848
11865
  /**
11849
11866
  * Updates the animation state and skeleton time by the delta time. Applies the
@@ -11911,7 +11928,14 @@ var spine = (() => {
11911
11928
  let mesh = attachment;
11912
11929
  positions = positions.length < mesh.worldVerticesLength ? Utils.newFloatArray(mesh.worldVerticesLength) : positions;
11913
11930
  numVertices = mesh.worldVerticesLength >> 1;
11914
- mesh.computeWorldVertices(slot, 0, mesh.worldVerticesLength, positions, 0, 2);
11931
+ mesh.computeWorldVertices(
11932
+ slot,
11933
+ 0,
11934
+ mesh.worldVerticesLength,
11935
+ positions,
11936
+ 0,
11937
+ 2
11938
+ );
11915
11939
  triangles = mesh.triangles;
11916
11940
  texture = mesh.region?.texture;
11917
11941
  uvs = mesh.uvs;
@@ -11926,7 +11950,12 @@ var spine = (() => {
11926
11950
  }
11927
11951
  if (texture) {
11928
11952
  if (clipper.isClipping()) {
11929
- clipper.clipTrianglesUnpacked(positions, triangles, triangles.length, uvs);
11953
+ clipper.clipTrianglesUnpacked(
11954
+ positions,
11955
+ triangles,
11956
+ triangles.length,
11957
+ uvs
11958
+ );
11930
11959
  positions = clipper.clippedVertices;
11931
11960
  uvs = clipper.clippedUVs;
11932
11961
  triangles = clipper.clippedTriangles;
@@ -11953,8 +11982,19 @@ var spine = (() => {
11953
11982
  scaledUvs[i2 + 1] = uvs[i2 + 1] * height;
11954
11983
  }
11955
11984
  const blendMode = slot.data.blendMode;
11956
- const vertices = this.ck.MakeVertices(this.ck.VertexMode.Triangles, positions, scaledUvs, colors, triangles, false);
11957
- canvas.drawVertices(vertices, this.ck.BlendMode.Modulate, texture.getImage().paintPerBlendMode.get(blendMode));
11985
+ const vertices = this.ck.MakeVertices(
11986
+ this.ck.VertexMode.Triangles,
11987
+ positions,
11988
+ scaledUvs,
11989
+ colors,
11990
+ triangles,
11991
+ false
11992
+ );
11993
+ canvas.drawVertices(
11994
+ vertices,
11995
+ this.ck.BlendMode.Modulate,
11996
+ texture.getImage().paintPerBlendMode.get(blendMode)
11997
+ );
11958
11998
  vertices.delete();
11959
11999
  }
11960
12000
  clipper.clipEndWithSlot(slot);