@vpmedia/phaser 1.125.0 → 1.126.0

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/index.js CHANGED
@@ -3947,7 +3947,7 @@ var FrameData = class {
3947
3947
  }
3948
3948
  getFrameIndexes(frames, useNumericIndex = true, output = null) {
3949
3949
  const result = output ?? [];
3950
- if (frames.length > 0) for (const f of frames) if (useNumericIndex && this._frames[f]) result.push(this._frames[f].index);
3950
+ if ((frames?.length ?? 0) > 0) for (const f of frames) if (useNumericIndex && this._frames[f]) result.push(this._frames[f].index);
3951
3951
  else {
3952
3952
  const found = this.getFrameByName(f);
3953
3953
  if (found) result.push(found.index);
@@ -5189,7 +5189,7 @@ var InputHandler = class {
5189
5189
  this.game.canvas.style.cursor = "pointer";
5190
5190
  this._setHandCursor = true;
5191
5191
  }
5192
- if (!silent && sendEvent && this.sprite !== null) this.sprite.events.onInputOver$dispatch(this.sprite, pointer);
5192
+ if (!silent && sendEvent && this.sprite?.events) this.sprite.events.onInputOver$dispatch(this.sprite, pointer);
5193
5193
  if (this.sprite.parent && this.sprite.parent.type === 7) this.sprite.parent.onChildInputOver.dispatch(this.sprite, pointer);
5194
5194
  }
5195
5195
  }
@@ -5208,7 +5208,7 @@ var InputHandler = class {
5208
5208
  this.game.canvas.style.cursor = "default";
5209
5209
  this._setHandCursor = false;
5210
5210
  }
5211
- if (!silent && this.sprite !== null) {
5211
+ if (!silent && this.sprite?.events) {
5212
5212
  this.sprite.events.onInputOut$dispatch(this.sprite, pointer);
5213
5213
  if (this.sprite?.parent?.type === 7) this.sprite.parent.onChildInputOut.dispatch(this.sprite, pointer);
5214
5214
  }
@@ -5227,7 +5227,7 @@ var InputHandler = class {
5227
5227
  data.timeDown = this.game.time.time;
5228
5228
  this.downPoint.setTo(pointer.x, pointer.y);
5229
5229
  pointer.dirty = true;
5230
- if (this.sprite !== null) {
5230
+ if (this.sprite?.events) {
5231
5231
  this.sprite.events.onInputDown$dispatch(this.sprite, pointer);
5232
5232
  if (this.sprite?.parent?.type === 7) this.sprite.parent.onChildInputDown.dispatch(this.sprite, pointer);
5233
5233
  if (this.sprite === null) return;
@@ -5266,7 +5266,7 @@ var InputHandler = class {
5266
5266
  data.timeUp = this.game.time.time;
5267
5267
  data.downDuration = data.timeUp - data.timeDown;
5268
5268
  let isOver = this.checkPointerOver(pointer);
5269
- if (this.sprite !== null) {
5269
+ if (this.sprite?.events) {
5270
5270
  if (!this.dragStopBlocksInputUp || this.dragStopBlocksInputUp && !(this.draggable && this.isDragged && this._draggedPointerID === pointer.id)) this.sprite.events.onInputUp$dispatch(this.sprite, pointer, isOver);
5271
5271
  if (this.sprite?.parent?.type === 7) this.sprite.parent.onChildInputUp.dispatch(this.sprite, pointer, isOver);
5272
5272
  if (isOver) isOver = this.checkPointerOver(pointer);
@@ -7737,7 +7737,7 @@ const buildPoly = (graphicsData, webGLData) => {
7737
7737
  const g = color[1] * alpha;
7738
7738
  const b = color[2] * alpha;
7739
7739
  const triangles = triangulate(points, null, 2);
7740
- if (triangles.length === 0) return false;
7740
+ if (!triangles?.length) return false;
7741
7741
  const vertPos = verts.length / 6;
7742
7742
  for (let i = 0; i < triangles.length; i += 3) {
7743
7743
  indices.push(triangles[i] + vertPos);
@@ -12930,7 +12930,7 @@ const checkFullScreenSupport = (device) => {
12930
12930
  device.cancelFullscreen = name;
12931
12931
  break;
12932
12932
  }
12933
- if (Element.ALLOW_KEYBOARD_INPUT !== void 0) device.fullscreenKeyboard = true;
12933
+ if (globalThis.Element && Element.ALLOW_KEYBOARD_INPUT !== void 0) device.fullscreenKeyboard = true;
12934
12934
  }
12935
12935
  };
12936
12936
  /**
@@ -14535,7 +14535,8 @@ var Input = class {
14535
14535
  if (!displayObject.worldVisible) return false;
14536
14536
  this.getLocalPosition(displayObject, pointer, this._localPoint);
14537
14537
  localPoint.copyFrom(this._localPoint);
14538
- if (displayObject.hitArea !== null) return displayObject.hitArea.contains(this._localPoint.x, this._localPoint.y);
14538
+ const { hitArea } = displayObject;
14539
+ if (hitArea && hitArea.contains) return hitArea.contains(this._localPoint.x, this._localPoint.y);
14539
14540
  else if (displayObject instanceof Image$1) {
14540
14541
  const { width } = displayObject.texture.frame;
14541
14542
  const { height } = displayObject.texture.frame;
@@ -15819,7 +15820,8 @@ var DOM = class {
15819
15820
  * @returns {boolean} True if bounds were successfully retrieved, false otherwise.
15820
15821
  */
15821
15822
  getBounds(element, cushion = 0) {
15822
- const target = element.nodeType === void 0 ? element[0] : element;
15823
+ const wrapped = element;
15824
+ const target = wrapped && !wrapped.nodeType ? element[0] : wrapped;
15823
15825
  if (target?.nodeType !== 1) return false;
15824
15826
  return this.calibrate(target.getBoundingClientRect(), cushion);
15825
15827
  }
@@ -16261,7 +16263,7 @@ var ScaleManager = class {
16261
16263
  this.aspectRatio = this.width / this.height;
16262
16264
  if (this.game.canvas) this.dom.getOffset(this.game.canvas, this.offset);
16263
16265
  this.bounds.setTo(this.offset.x, this.offset.y, this.width, this.height);
16264
- if (this.game.input) this.game.input.scale.setTo(this.scaleFactor.x, this.scaleFactor.y);
16266
+ if (this.game.input?.scale) this.game.input.scale.setTo(this.scaleFactor.x, this.scaleFactor.y);
16265
16267
  }
16266
16268
  /**
16267
16269
  * TBD.
@@ -20047,6 +20049,11 @@ var Game = class {
20047
20049
  this.parseConfigElement(config, "renderType", 0);
20048
20050
  this.parseConfigElement(config, "isForceDisabledAudio", false);
20049
20051
  this.parseConfigElement(config, "maxParallelDownloads", 16);
20052
+ this.parseConfigElement(config, "canvas");
20053
+ this.parseConfigElement(config, "isSkipTicker");
20054
+ this.parseConfigElement(config, "scaleMode");
20055
+ this.parseConfigElement(config, "fullScreenScaleMode");
20056
+ this.parseConfigElement(config, "fullScreenTarget");
20050
20057
  if (config.parent !== void 0) this.parent = config.parent;
20051
20058
  this.state = new SceneManager(this, config.state ?? null);
20052
20059
  }