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.mjs 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
@@ -10454,7 +10454,7 @@ class StartupSystem {
10454
10454
  const renderer = this.renderer;
10455
10455
  renderer.emitWithCustomOptions(renderer.runners.init, options);
10456
10456
  if (options.hello) {
10457
- console.log(`PixiJS ${"7.1.3"} - ${renderer.rendererLogId} - https://pixijs.com`);
10457
+ console.log(`PixiJS ${"7.1.4"} - ${renderer.rendererLogId} - https://pixijs.com`);
10458
10458
  }
10459
10459
  renderer.resize(this.renderer.screen.width, this.renderer.screen.height);
10460
10460
  }
@@ -11887,6 +11887,7 @@ extensions$1.add(ObjectRendererSystem);
11887
11887
  const _Renderer = class extends SystemManager {
11888
11888
  constructor(options) {
11889
11889
  super();
11890
+ this.type = RENDERER_TYPE.WEBGL;
11890
11891
  options = Object.assign({}, settings.RENDER_OPTIONS, options);
11891
11892
  this.gl = null;
11892
11893
  this.CONTEXT_UID = 0;
@@ -12645,7 +12646,7 @@ class TransformFeedback {
12645
12646
  }
12646
12647
  }
12647
12648
 
12648
- const VERSION = "7.1.3";
12649
+ const VERSION = "7.1.4";
12649
12650
 
12650
12651
  class Bounds {
12651
12652
  constructor() {
@@ -19065,8 +19066,7 @@ function square(x, y, nx, ny, innerWeight, outerWeight, clockwise, verts) {
19065
19066
  const eiy = iy + eyy;
19066
19067
  const eox = ox + exx;
19067
19068
  const eoy = oy + eyy;
19068
- verts.push(eix, eiy);
19069
- verts.push(eox, eoy);
19069
+ verts.push(eix, eiy, eox, eoy);
19070
19070
  return 2;
19071
19071
  }
19072
19072
  function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
@@ -19087,23 +19087,17 @@ function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
19087
19087
  const angleInc = angleDiff / segCount;
19088
19088
  startAngle += angleInc;
19089
19089
  if (clockwise) {
19090
- verts.push(cx, cy);
19091
- verts.push(sx, sy);
19090
+ verts.push(cx, cy, sx, sy);
19092
19091
  for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
19093
- verts.push(cx, cy);
19094
- verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
19092
+ verts.push(cx, cy, cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
19095
19093
  }
19096
- verts.push(cx, cy);
19097
- verts.push(ex, ey);
19094
+ verts.push(cx, cy, ex, ey);
19098
19095
  } else {
19099
- verts.push(sx, sy);
19100
- verts.push(cx, cy);
19096
+ verts.push(sx, sy, cx, cy);
19101
19097
  for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
19102
- verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
19103
- verts.push(cx, cy);
19098
+ verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius, cx, cy);
19104
19099
  }
19105
- verts.push(ex, ey);
19106
- verts.push(cx, cy);
19100
+ verts.push(ex, ey, cx, cy);
19107
19101
  }
19108
19102
  return segCount * 2;
19109
19103
  }
@@ -19163,8 +19157,7 @@ function buildNonNativeLine(graphicsData, graphicsGeometry) {
19163
19157
  indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);
19164
19158
  }
19165
19159
  }
19166
- verts.push(x0 - perpx * innerWeight, y0 - perpy * innerWeight);
19167
- verts.push(x0 + perpx * outerWeight, y0 + perpy * outerWeight);
19160
+ verts.push(x0 - perpx * innerWeight, y0 - perpy * innerWeight, x0 + perpx * outerWeight, y0 + perpy * outerWeight);
19168
19161
  for (let i = 1; i < length - 1; ++i) {
19169
19162
  x0 = points[(i - 1) * 2];
19170
19163
  y0 = points[(i - 1) * 2 + 1];
@@ -19194,16 +19187,14 @@ function buildNonNativeLine(graphicsData, graphicsGeometry) {
19194
19187
  const cross = dy0 * dx1 - dy1 * dx0;
19195
19188
  const clockwise = cross < 0;
19196
19189
  if (Math.abs(cross) < 1e-3 * Math.abs(dot)) {
19197
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19198
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19190
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19199
19191
  if (dot >= 0) {
19200
19192
  if (style.join === LINE_JOIN.ROUND) {
19201
19193
  indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
19202
19194
  } else {
19203
19195
  indexCount += 2;
19204
19196
  }
19205
- verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight);
19206
- verts.push(x1 + perp1x * innerWeight, y1 + perp1y * innerWeight);
19197
+ verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight, x1 + perp1x * innerWeight, y1 + perp1y * innerWeight);
19207
19198
  }
19208
19199
  continue;
19209
19200
  }
@@ -19220,59 +19211,60 @@ function buildNonNativeLine(graphicsData, graphicsGeometry) {
19220
19211
  const insideWeight = clockwise ? innerWeight : outerWeight;
19221
19212
  const smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;
19222
19213
  const insideMiterOk = pdist <= smallerInsideDiagonalSq;
19214
+ let join = style.join;
19215
+ if (join === LINE_JOIN.MITER && pdist / widthSquared > miterLimitSquared) {
19216
+ join = LINE_JOIN.BEVEL;
19217
+ }
19223
19218
  if (insideMiterOk) {
19224
- if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) {
19225
- if (clockwise) {
19226
- verts.push(imx, imy);
19227
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19228
- verts.push(imx, imy);
19229
- verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19230
- } else {
19231
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19232
- verts.push(omx, omy);
19233
- verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
19234
- verts.push(omx, omy);
19219
+ switch (join) {
19220
+ case LINE_JOIN.MITER: {
19221
+ verts.push(imx, imy, omx, omy);
19222
+ break;
19235
19223
  }
19236
- indexCount += 2;
19237
- } else if (style.join === LINE_JOIN.ROUND) {
19238
- if (clockwise) {
19239
- verts.push(imx, imy);
19240
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19241
- indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 4;
19242
- verts.push(imx, imy);
19243
- verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19244
- } else {
19245
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19246
- verts.push(omx, omy);
19247
- indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
19248
- verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
19249
- verts.push(omx, omy);
19224
+ case LINE_JOIN.BEVEL: {
19225
+ if (clockwise) {
19226
+ verts.push(imx, imy, x1 + perpx * outerWeight, y1 + perpy * outerWeight, imx, imy, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19227
+ } else {
19228
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, omx, omy, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, omx, omy);
19229
+ }
19230
+ indexCount += 2;
19231
+ break;
19232
+ }
19233
+ case LINE_JOIN.ROUND: {
19234
+ if (clockwise) {
19235
+ verts.push(imx, imy, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19236
+ indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 4;
19237
+ verts.push(imx, imy, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19238
+ } else {
19239
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, omx, omy);
19240
+ indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
19241
+ verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, omx, omy);
19242
+ }
19243
+ break;
19250
19244
  }
19251
- } else {
19252
- verts.push(imx, imy);
19253
- verts.push(omx, omy);
19254
19245
  }
19255
19246
  } else {
19256
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19257
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19258
- if (style.join === LINE_JOIN.ROUND) {
19259
- if (clockwise) {
19260
- indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2;
19261
- } else {
19262
- indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2;
19247
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19248
+ switch (join) {
19249
+ case LINE_JOIN.MITER: {
19250
+ if (clockwise) {
19251
+ verts.push(omx, omy, omx, omy);
19252
+ } else {
19253
+ verts.push(imx, imy, imx, imy);
19254
+ }
19255
+ indexCount += 2;
19256
+ break;
19263
19257
  }
19264
- } else if (style.join === LINE_JOIN.MITER && pdist / widthSquared <= miterLimitSquared) {
19265
- if (clockwise) {
19266
- verts.push(omx, omy);
19267
- verts.push(omx, omy);
19268
- } else {
19269
- verts.push(imx, imy);
19270
- verts.push(imx, imy);
19258
+ case LINE_JOIN.ROUND: {
19259
+ if (clockwise) {
19260
+ indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2;
19261
+ } else {
19262
+ indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 2;
19263
+ }
19264
+ break;
19271
19265
  }
19272
- indexCount += 2;
19273
19266
  }
19274
- verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
19275
- verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19267
+ verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19276
19268
  indexCount += 2;
19277
19269
  }
19278
19270
  }
@@ -19287,8 +19279,7 @@ function buildNonNativeLine(graphicsData, graphicsGeometry) {
19287
19279
  perpy /= dist;
19288
19280
  perpx *= width;
19289
19281
  perpy *= width;
19290
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19291
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19282
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19292
19283
  if (!closedShape) {
19293
19284
  if (style.cap === LINE_CAP.ROUND) {
19294
19285
  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;
@@ -20855,6 +20846,7 @@ class RopeGeometry extends MeshGeometry {
20855
20846
  let perpY = 0;
20856
20847
  const vertices = this.buffers[0].data;
20857
20848
  const total = points.length;
20849
+ const halfWidth = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
20858
20850
  for (let i = 0; i < total; i++) {
20859
20851
  const point = points[i];
20860
20852
  const index = i * 4;
@@ -20870,11 +20862,15 @@ class RopeGeometry extends MeshGeometry {
20870
20862
  ratio = 1;
20871
20863
  }
20872
20864
  const perpLength = Math.sqrt(perpX * perpX + perpY * perpY);
20873
- const num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
20874
- perpX /= perpLength;
20875
- perpY /= perpLength;
20876
- perpX *= num;
20877
- perpY *= num;
20865
+ if (perpLength < 1e-6) {
20866
+ perpX = 0;
20867
+ perpY = 0;
20868
+ } else {
20869
+ perpX /= perpLength;
20870
+ perpY /= perpLength;
20871
+ perpX *= halfWidth;
20872
+ perpY *= halfWidth;
20873
+ }
20878
20874
  vertices[index] = point.x + perpX;
20879
20875
  vertices[index + 1] = point.y + perpY;
20880
20876
  vertices[index + 2] = point.x - perpX;