pixi.js 7.1.3 → 7.1.4

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.
package/dist/pixi.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * pixi.js - v7.1.3
3
- * Compiled Fri, 24 Feb 2023 18:37:12 UTC
2
+ * pixi.js - v7.1.4
3
+ * Compiled Thu, 02 Mar 2023 16:46:25 UTC
4
4
  *
5
5
  * pixi.js is licensed under the MIT License.
6
6
  * http://www.opensource.org/licenses/mit-license
@@ -10457,7 +10457,7 @@ ${this.fragmentSrc}`;
10457
10457
  const renderer = this.renderer;
10458
10458
  renderer.emitWithCustomOptions(renderer.runners.init, options);
10459
10459
  if (options.hello) {
10460
- console.log(`PixiJS ${"7.1.3"} - ${renderer.rendererLogId} - https://pixijs.com`);
10460
+ console.log(`PixiJS ${"7.1.4"} - ${renderer.rendererLogId} - https://pixijs.com`);
10461
10461
  }
10462
10462
  renderer.resize(this.renderer.screen.width, this.renderer.screen.height);
10463
10463
  }
@@ -11890,6 +11890,7 @@ ${this.fragmentSrc}`;
11890
11890
  const _Renderer = class extends SystemManager {
11891
11891
  constructor(options) {
11892
11892
  super();
11893
+ this.type = RENDERER_TYPE.WEBGL;
11893
11894
  options = Object.assign({}, settings.RENDER_OPTIONS, options);
11894
11895
  this.gl = null;
11895
11896
  this.CONTEXT_UID = 0;
@@ -12648,7 +12649,7 @@ ${this.fragmentSrc}`;
12648
12649
  }
12649
12650
  }
12650
12651
 
12651
- const VERSION = "7.1.3";
12652
+ const VERSION = "7.1.4";
12652
12653
 
12653
12654
  class Bounds {
12654
12655
  constructor() {
@@ -19068,8 +19069,7 @@ ${e}`);
19068
19069
  const eiy = iy + eyy;
19069
19070
  const eox = ox + exx;
19070
19071
  const eoy = oy + eyy;
19071
- verts.push(eix, eiy);
19072
- verts.push(eox, eoy);
19072
+ verts.push(eix, eiy, eox, eoy);
19073
19073
  return 2;
19074
19074
  }
19075
19075
  function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
@@ -19090,23 +19090,17 @@ ${e}`);
19090
19090
  const angleInc = angleDiff / segCount;
19091
19091
  startAngle += angleInc;
19092
19092
  if (clockwise) {
19093
- verts.push(cx, cy);
19094
- verts.push(sx, sy);
19093
+ verts.push(cx, cy, sx, sy);
19095
19094
  for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
19096
- verts.push(cx, cy);
19097
- verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
19095
+ verts.push(cx, cy, cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
19098
19096
  }
19099
- verts.push(cx, cy);
19100
- verts.push(ex, ey);
19097
+ verts.push(cx, cy, ex, ey);
19101
19098
  } else {
19102
- verts.push(sx, sy);
19103
- verts.push(cx, cy);
19099
+ verts.push(sx, sy, cx, cy);
19104
19100
  for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
19105
- verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
19106
- verts.push(cx, cy);
19101
+ verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius, cx, cy);
19107
19102
  }
19108
- verts.push(ex, ey);
19109
- verts.push(cx, cy);
19103
+ verts.push(ex, ey, cx, cy);
19110
19104
  }
19111
19105
  return segCount * 2;
19112
19106
  }
@@ -19166,8 +19160,7 @@ ${e}`);
19166
19160
  indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);
19167
19161
  }
19168
19162
  }
19169
- verts.push(x0 - perpx * innerWeight, y0 - perpy * innerWeight);
19170
- verts.push(x0 + perpx * outerWeight, y0 + perpy * outerWeight);
19163
+ verts.push(x0 - perpx * innerWeight, y0 - perpy * innerWeight, x0 + perpx * outerWeight, y0 + perpy * outerWeight);
19171
19164
  for (let i = 1; i < length - 1; ++i) {
19172
19165
  x0 = points[(i - 1) * 2];
19173
19166
  y0 = points[(i - 1) * 2 + 1];
@@ -19197,16 +19190,14 @@ ${e}`);
19197
19190
  const cross = dy0 * dx1 - dy1 * dx0;
19198
19191
  const clockwise = cross < 0;
19199
19192
  if (Math.abs(cross) < 1e-3 * Math.abs(dot)) {
19200
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19201
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19193
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19202
19194
  if (dot >= 0) {
19203
19195
  if (style.join === LINE_JOIN.ROUND) {
19204
19196
  indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
19205
19197
  } else {
19206
19198
  indexCount += 2;
19207
19199
  }
19208
- verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight);
19209
- verts.push(x1 + perp1x * innerWeight, y1 + perp1y * innerWeight);
19200
+ verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight, x1 + perp1x * innerWeight, y1 + perp1y * innerWeight);
19210
19201
  }
19211
19202
  continue;
19212
19203
  }
@@ -19223,59 +19214,60 @@ ${e}`);
19223
19214
  const insideWeight = clockwise ? innerWeight : outerWeight;
19224
19215
  const smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;
19225
19216
  const insideMiterOk = pdist <= smallerInsideDiagonalSq;
19217
+ let join = style.join;
19218
+ if (join === LINE_JOIN.MITER && pdist / widthSquared > miterLimitSquared) {
19219
+ join = LINE_JOIN.BEVEL;
19220
+ }
19226
19221
  if (insideMiterOk) {
19227
- if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) {
19228
- if (clockwise) {
19229
- verts.push(imx, imy);
19230
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19231
- verts.push(imx, imy);
19232
- verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19233
- } else {
19234
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19235
- verts.push(omx, omy);
19236
- verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
19237
- verts.push(omx, omy);
19222
+ switch (join) {
19223
+ case LINE_JOIN.MITER: {
19224
+ verts.push(imx, imy, omx, omy);
19225
+ break;
19238
19226
  }
19239
- indexCount += 2;
19240
- } else if (style.join === LINE_JOIN.ROUND) {
19241
- if (clockwise) {
19242
- verts.push(imx, imy);
19243
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19244
- indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 4;
19245
- verts.push(imx, imy);
19246
- verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19247
- } else {
19248
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19249
- verts.push(omx, omy);
19250
- indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
19251
- verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
19252
- verts.push(omx, omy);
19227
+ case LINE_JOIN.BEVEL: {
19228
+ if (clockwise) {
19229
+ verts.push(imx, imy, x1 + perpx * outerWeight, y1 + perpy * outerWeight, imx, imy, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19230
+ } else {
19231
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, omx, omy, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, omx, omy);
19232
+ }
19233
+ indexCount += 2;
19234
+ break;
19235
+ }
19236
+ case LINE_JOIN.ROUND: {
19237
+ if (clockwise) {
19238
+ verts.push(imx, imy, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19239
+ indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 4;
19240
+ verts.push(imx, imy, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19241
+ } else {
19242
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, omx, omy);
19243
+ indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
19244
+ verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, omx, omy);
19245
+ }
19246
+ break;
19253
19247
  }
19254
- } else {
19255
- verts.push(imx, imy);
19256
- verts.push(omx, omy);
19257
19248
  }
19258
19249
  } else {
19259
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19260
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19261
- if (style.join === LINE_JOIN.ROUND) {
19262
- if (clockwise) {
19263
- indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2;
19264
- } else {
19265
- indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2;
19250
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19251
+ switch (join) {
19252
+ case LINE_JOIN.MITER: {
19253
+ if (clockwise) {
19254
+ verts.push(omx, omy, omx, omy);
19255
+ } else {
19256
+ verts.push(imx, imy, imx, imy);
19257
+ }
19258
+ indexCount += 2;
19259
+ break;
19266
19260
  }
19267
- } else if (style.join === LINE_JOIN.MITER && pdist / widthSquared <= miterLimitSquared) {
19268
- if (clockwise) {
19269
- verts.push(omx, omy);
19270
- verts.push(omx, omy);
19271
- } else {
19272
- verts.push(imx, imy);
19273
- verts.push(imx, imy);
19261
+ case LINE_JOIN.ROUND: {
19262
+ if (clockwise) {
19263
+ indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2;
19264
+ } else {
19265
+ indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2;
19266
+ }
19267
+ break;
19274
19268
  }
19275
- indexCount += 2;
19276
19269
  }
19277
- verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
19278
- verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19270
+ verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19279
19271
  indexCount += 2;
19280
19272
  }
19281
19273
  }
@@ -19290,8 +19282,7 @@ ${e}`);
19290
19282
  perpy /= dist;
19291
19283
  perpx *= width;
19292
19284
  perpy *= width;
19293
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19294
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19285
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19295
19286
  if (!closedShape) {
19296
19287
  if (style.cap === LINE_CAP.ROUND) {
19297
19288
  indexCount += round(x1 - perpx * (innerWeight - outerWeight) * 0.5, y1 - perpy * (innerWeight - outerWeight) * 0.5, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight, verts, false) + 2;
@@ -20858,6 +20849,7 @@ ${e}`);
20858
20849
  let perpY = 0;
20859
20850
  const vertices = this.buffers[0].data;
20860
20851
  const total = points.length;
20852
+ const halfWidth = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
20861
20853
  for (let i = 0; i < total; i++) {
20862
20854
  const point = points[i];
20863
20855
  const index = i * 4;
@@ -20873,11 +20865,15 @@ ${e}`);
20873
20865
  ratio = 1;
20874
20866
  }
20875
20867
  const perpLength = Math.sqrt(perpX * perpX + perpY * perpY);
20876
- const num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
20877
- perpX /= perpLength;
20878
- perpY /= perpLength;
20879
- perpX *= num;
20880
- perpY *= num;
20868
+ if (perpLength < 1e-6) {
20869
+ perpX = 0;
20870
+ perpY = 0;
20871
+ } else {
20872
+ perpX /= perpLength;
20873
+ perpY /= perpLength;
20874
+ perpX *= halfWidth;
20875
+ perpY *= halfWidth;
20876
+ }
20881
20877
  vertices[index] = point.x + perpX;
20882
20878
  vertices[index + 1] = point.y + perpY;
20883
20879
  vertices[index + 2] = point.x - perpX;