pixi.js 7.1.2 → 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.2
3
- * Compiled Tue, 31 Jan 2023 14:52:16 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.2"} - ${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.2";
12652
+ const VERSION = "7.1.4";
12652
12653
 
12653
12654
  class Bounds {
12654
12655
  constructor() {
@@ -15147,11 +15148,14 @@ ${this.fragmentSrc}`;
15147
15148
  class FederatedWheelEvent extends FederatedMouseEvent {
15148
15149
  constructor() {
15149
15150
  super(...arguments);
15150
- this.DOM_DELTA_LINE = 0;
15151
- this.DOM_DELTA_PAGE = 1;
15152
- this.DOM_DELTA_PIXEL = 2;
15151
+ this.DOM_DELTA_PIXEL = 0;
15152
+ this.DOM_DELTA_LINE = 1;
15153
+ this.DOM_DELTA_PAGE = 2;
15153
15154
  }
15154
15155
  }
15156
+ FederatedWheelEvent.DOM_DELTA_PIXEL = 0;
15157
+ FederatedWheelEvent.DOM_DELTA_LINE = 1;
15158
+ FederatedWheelEvent.DOM_DELTA_PAGE = 2;
15155
15159
 
15156
15160
  const PROPAGATION_LIMIT = 2048;
15157
15161
  const tempHitLocation = new Point();
@@ -15523,7 +15527,8 @@ ${this.fragmentSrc}`;
15523
15527
  clickHistory.timeStamp = now;
15524
15528
  clickEvent.detail = clickHistory.clickCount;
15525
15529
  if (clickEvent.pointerType === "mouse") {
15526
- this.dispatchEvent(clickEvent, "click");
15530
+ const isRightButton = clickEvent.button === 2;
15531
+ this.dispatchEvent(clickEvent, isRightButton ? "rightclick" : "click");
15527
15532
  } else if (clickEvent.pointerType === "touch") {
15528
15533
  this.dispatchEvent(clickEvent, "tap");
15529
15534
  }
@@ -15693,9 +15698,13 @@ ${this.fragmentSrc}`;
15693
15698
  if (!listeners)
15694
15699
  return;
15695
15700
  if ("fn" in listeners) {
15701
+ if (listeners.once)
15702
+ e.currentTarget.removeListener(type, listeners.fn, void 0, true);
15696
15703
  listeners.fn.call(listeners.context, e);
15697
15704
  } else {
15698
15705
  for (let i = 0, j = listeners.length; i < j && !e.propagationImmediatelyStopped; i++) {
15706
+ if (listeners[i].once)
15707
+ e.currentTarget.removeListener(type, listeners[i].fn, void 0, true);
15699
15708
  listeners[i].fn.call(listeners[i].context, e);
15700
15709
  }
15701
15710
  }
@@ -19060,8 +19069,7 @@ ${e}`);
19060
19069
  const eiy = iy + eyy;
19061
19070
  const eox = ox + exx;
19062
19071
  const eoy = oy + eyy;
19063
- verts.push(eix, eiy);
19064
- verts.push(eox, eoy);
19072
+ verts.push(eix, eiy, eox, eoy);
19065
19073
  return 2;
19066
19074
  }
19067
19075
  function round(cx, cy, sx, sy, ex, ey, verts, clockwise) {
@@ -19082,23 +19090,17 @@ ${e}`);
19082
19090
  const angleInc = angleDiff / segCount;
19083
19091
  startAngle += angleInc;
19084
19092
  if (clockwise) {
19085
- verts.push(cx, cy);
19086
- verts.push(sx, sy);
19093
+ verts.push(cx, cy, sx, sy);
19087
19094
  for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
19088
- verts.push(cx, cy);
19089
- 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);
19090
19096
  }
19091
- verts.push(cx, cy);
19092
- verts.push(ex, ey);
19097
+ verts.push(cx, cy, ex, ey);
19093
19098
  } else {
19094
- verts.push(sx, sy);
19095
- verts.push(cx, cy);
19099
+ verts.push(sx, sy, cx, cy);
19096
19100
  for (let i = 1, angle = startAngle; i < segCount; i++, angle += angleInc) {
19097
- verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius);
19098
- verts.push(cx, cy);
19101
+ verts.push(cx + Math.sin(angle) * radius, cy + Math.cos(angle) * radius, cx, cy);
19099
19102
  }
19100
- verts.push(ex, ey);
19101
- verts.push(cx, cy);
19103
+ verts.push(ex, ey, cx, cy);
19102
19104
  }
19103
19105
  return segCount * 2;
19104
19106
  }
@@ -19158,8 +19160,7 @@ ${e}`);
19158
19160
  indexCount += square(x0, y0, perpx, perpy, innerWeight, outerWeight, true, verts);
19159
19161
  }
19160
19162
  }
19161
- verts.push(x0 - perpx * innerWeight, y0 - perpy * innerWeight);
19162
- verts.push(x0 + perpx * outerWeight, y0 + perpy * outerWeight);
19163
+ verts.push(x0 - perpx * innerWeight, y0 - perpy * innerWeight, x0 + perpx * outerWeight, y0 + perpy * outerWeight);
19163
19164
  for (let i = 1; i < length - 1; ++i) {
19164
19165
  x0 = points[(i - 1) * 2];
19165
19166
  y0 = points[(i - 1) * 2 + 1];
@@ -19189,16 +19190,14 @@ ${e}`);
19189
19190
  const cross = dy0 * dx1 - dy1 * dx0;
19190
19191
  const clockwise = cross < 0;
19191
19192
  if (Math.abs(cross) < 1e-3 * Math.abs(dot)) {
19192
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19193
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19193
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19194
19194
  if (dot >= 0) {
19195
19195
  if (style.join === LINE_JOIN.ROUND) {
19196
19196
  indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
19197
19197
  } else {
19198
19198
  indexCount += 2;
19199
19199
  }
19200
- verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight);
19201
- verts.push(x1 + perp1x * innerWeight, y1 + perp1y * innerWeight);
19200
+ verts.push(x1 - perp1x * outerWeight, y1 - perp1y * outerWeight, x1 + perp1x * innerWeight, y1 + perp1y * innerWeight);
19202
19201
  }
19203
19202
  continue;
19204
19203
  }
@@ -19215,59 +19214,60 @@ ${e}`);
19215
19214
  const insideWeight = clockwise ? innerWeight : outerWeight;
19216
19215
  const smallerInsideDiagonalSq = smallerInsideSegmentSq + insideWeight * insideWeight * widthSquared;
19217
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
+ }
19218
19221
  if (insideMiterOk) {
19219
- if (style.join === LINE_JOIN.BEVEL || pdist / widthSquared > miterLimitSquared) {
19220
- if (clockwise) {
19221
- verts.push(imx, imy);
19222
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19223
- verts.push(imx, imy);
19224
- verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19225
- } else {
19226
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19227
- verts.push(omx, omy);
19228
- verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
19229
- verts.push(omx, omy);
19222
+ switch (join) {
19223
+ case LINE_JOIN.MITER: {
19224
+ verts.push(imx, imy, omx, omy);
19225
+ break;
19230
19226
  }
19231
- indexCount += 2;
19232
- } else if (style.join === LINE_JOIN.ROUND) {
19233
- if (clockwise) {
19234
- verts.push(imx, imy);
19235
- verts.push(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);
19238
- verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19239
- } else {
19240
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19241
- verts.push(omx, omy);
19242
- indexCount += round(x1, y1, x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, verts, false) + 4;
19243
- verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
19244
- 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;
19245
19247
  }
19246
- } else {
19247
- verts.push(imx, imy);
19248
- verts.push(omx, omy);
19249
19248
  }
19250
19249
  } else {
19251
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19252
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19253
- if (style.join === LINE_JOIN.ROUND) {
19254
- if (clockwise) {
19255
- indexCount += round(x1, y1, x1 + perpx * outerWeight, y1 + perpy * outerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight, verts, true) + 2;
19256
- } else {
19257
- 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;
19258
19260
  }
19259
- } else if (style.join === LINE_JOIN.MITER && pdist / widthSquared <= miterLimitSquared) {
19260
- if (clockwise) {
19261
- verts.push(omx, omy);
19262
- verts.push(omx, omy);
19263
- } else {
19264
- verts.push(imx, imy);
19265
- 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;
19266
19268
  }
19267
- indexCount += 2;
19268
19269
  }
19269
- verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight);
19270
- verts.push(x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19270
+ verts.push(x1 - perp1x * innerWeight, y1 - perp1y * innerWeight, x1 + perp1x * outerWeight, y1 + perp1y * outerWeight);
19271
19271
  indexCount += 2;
19272
19272
  }
19273
19273
  }
@@ -19282,8 +19282,7 @@ ${e}`);
19282
19282
  perpy /= dist;
19283
19283
  perpx *= width;
19284
19284
  perpy *= width;
19285
- verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight);
19286
- verts.push(x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19285
+ verts.push(x1 - perpx * innerWeight, y1 - perpy * innerWeight, x1 + perpx * outerWeight, y1 + perpy * outerWeight);
19287
19286
  if (!closedShape) {
19288
19287
  if (style.cap === LINE_CAP.ROUND) {
19289
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;
@@ -20850,6 +20849,7 @@ ${e}`);
20850
20849
  let perpY = 0;
20851
20850
  const vertices = this.buffers[0].data;
20852
20851
  const total = points.length;
20852
+ const halfWidth = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
20853
20853
  for (let i = 0; i < total; i++) {
20854
20854
  const point = points[i];
20855
20855
  const index = i * 4;
@@ -20865,11 +20865,15 @@ ${e}`);
20865
20865
  ratio = 1;
20866
20866
  }
20867
20867
  const perpLength = Math.sqrt(perpX * perpX + perpY * perpY);
20868
- const num = this.textureScale > 0 ? this.textureScale * this._width / 2 : this._width / 2;
20869
- perpX /= perpLength;
20870
- perpY /= perpLength;
20871
- perpX *= num;
20872
- 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
+ }
20873
20877
  vertices[index] = point.x + perpX;
20874
20878
  vertices[index + 1] = point.y + perpY;
20875
20879
  vertices[index + 2] = point.x - perpX;