@awayjs/scene 0.13.247 → 0.13.248

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.
@@ -2689,9 +2689,6 @@ var DisplayObject = /** @class */ (function (_super) {
2689
2689
  DisplayObject.prototype._invalidateHierarchicalProperty = function (propDirty) {
2690
2690
  this.dispatchEvent(new _awayjs_view.HeirarchicalEvent(_awayjs_view.HeirarchicalEvent.INVALIDATE_PROPERTY, propDirty));
2691
2691
  };
2692
- DisplayObject.prototype._updateEntity = function () {
2693
- this.dispatchEvent(new _awayjs_view.ContainerEvent(_awayjs_view.ContainerEvent.UPDATE_ENTITY, this));
2694
- };
2695
2692
  /**
2696
2693
  *
2697
2694
  */
@@ -2709,7 +2706,6 @@ var DisplayObject = /** @class */ (function (_super) {
2709
2706
  enumerable: true,
2710
2707
  configurable: true
2711
2708
  });
2712
- DisplayObject.prototype._acceptTraverser = function (_traverser) { };
2713
2709
  DisplayObject.prototype._setScaleX = function (val) {
2714
2710
  if (this.scaleX == val)
2715
2711
  return;
@@ -3270,8 +3266,7 @@ var Sprite = /** @class */ (function (_super) {
3270
3266
  if (graphics === void 0) { graphics = null; }
3271
3267
  if (material === void 0) { material = null; }
3272
3268
  var _this = _super.call(this) || this;
3273
- _this._onGraphicsInvalidateDelegate = function (event) { return _this._onGraphicsInvalidate(event); };
3274
- _this.graphics = graphics || _awayjs_graphics.Graphics.getGraphics();
3269
+ _this.graphics = graphics;
3275
3270
  _this.material = material;
3276
3271
  return _this;
3277
3272
  // this.dropBitmapCache = this.dropBitmapCache.bind(this);
@@ -3282,7 +3277,7 @@ var Sprite = /** @class */ (function (_super) {
3282
3277
  if (material === void 0) { material = null; }
3283
3278
  if (Sprite._sprites.length) {
3284
3279
  var sprite = Sprite._sprites.pop();
3285
- sprite.graphics = graphics || _awayjs_graphics.Graphics.getGraphics();
3280
+ sprite.graphics = graphics;
3286
3281
  sprite.material = material;
3287
3282
  return sprite;
3288
3283
  }
@@ -3307,44 +3302,31 @@ var Sprite = /** @class */ (function (_super) {
3307
3302
  * drawing commands can occur.
3308
3303
  */
3309
3304
  get: function () {
3310
- if (this._iSourcePrefab)
3311
- this._iSourcePrefab._iValidate();
3305
+ //create new graphics object if none exists
3306
+ if (!this._graphics) {
3307
+ this.graphics = _awayjs_graphics.Graphics.getGraphics();
3308
+ this.invalidate();
3309
+ }
3312
3310
  return this._graphics;
3313
3311
  },
3314
3312
  set: function (value) {
3315
- if (value == null)
3316
- throw new Error('Cannot have graphics set to null');
3317
- this._setGraphics(value);
3313
+ if (this._graphics == value)
3314
+ return;
3315
+ if (this._graphics) {
3316
+ this._graphics.usages--;
3317
+ //if (!this._graphics.usages)
3318
+ // this.graphics.dispose();
3319
+ }
3320
+ this._graphics = value;
3321
+ if (this._graphics)
3322
+ this._graphics.usages++;
3323
+ this.invalidate();
3318
3324
  },
3319
3325
  enumerable: true,
3320
3326
  configurable: true
3321
3327
  });
3322
- Sprite.prototype._setGraphics = function (value) {
3323
- if (this._graphics == value)
3324
- return;
3325
- if (this._graphics) {
3326
- this._graphics.removeEventListener(_awayjs_core.AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
3327
- this._graphics.usages--;
3328
- //if (!this._graphics.usages)
3329
- // this.graphics.dispose();
3330
- }
3331
- this._graphics = value;
3332
- this._graphics.usages++;
3333
- this.invalidate();
3334
- };
3335
- Sprite.prototype._setParent = function (parent) {
3336
- _super.prototype._setParent.call(this, parent);
3337
- if (parent)
3338
- this._graphics.addEventListener(_awayjs_core.AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
3339
- else
3340
- this._graphics.removeEventListener(_awayjs_core.AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
3341
- // if (this._requestCacheAsBitmap) {
3342
- // this.set_cacheAsBitmapInternal(true);
3343
- // console.log('Restore cache');
3344
- // }
3345
- };
3346
3328
  Sprite.prototype.getEntity = function () {
3347
- return (this._graphics.count > 0) ? this : null;
3329
+ return this._graphics;
3348
3330
  };
3349
3331
  /**
3350
3332
  * @inheritDoc
@@ -3384,33 +3366,16 @@ var Sprite = /** @class */ (function (_super) {
3384
3366
  if (cloneShapes === void 0) { cloneShapes = false; }
3385
3367
  _super.prototype.copyTo.call(this, sprite);
3386
3368
  sprite._iSourcePrefab = this._iSourcePrefab;
3387
- this._graphics.copyTo(sprite._graphics, cloneShapes);
3369
+ if (this._graphics)
3370
+ this._graphics.copyTo(sprite.graphics, cloneShapes);
3388
3371
  };
3389
3372
  /**
3390
3373
  *
3391
3374
  */
3392
3375
  Sprite.prototype._iInternalUpdate = function () {
3393
3376
  _super.prototype._iInternalUpdate.call(this);
3394
- // if(this.parent)
3395
- // this._graphics.updateScale(view);
3396
- };
3397
- /**
3398
- * //TODO
3399
- *
3400
- * @private
3401
- */
3402
- Sprite.prototype._onGraphicsInvalidate = function (_event) {
3403
- this.invalidate();
3404
- };
3405
- /**
3406
- *
3407
- * @param renderer
3408
- *
3409
- * @internal
3410
- */
3411
- Sprite.prototype._acceptTraverser = function (traverser) {
3412
- _super.prototype._acceptTraverser.call(this, traverser);
3413
- this.graphics._acceptTraverser(traverser);
3377
+ if (this._iSourcePrefab)
3378
+ this._iSourcePrefab._iValidate();
3414
3379
  };
3415
3380
  /**
3416
3381
  *
@@ -3422,8 +3387,7 @@ var Sprite = /** @class */ (function (_super) {
3422
3387
  Sprite._sprites = new Array();
3423
3388
  Sprite.assetType = '[asset Sprite]';
3424
3389
  return Sprite;
3425
- }(DisplayObjectContainer));
3426
- _awayjs_view.PartitionBase.registerAbstraction(_awayjs_view.EntityNode, Sprite);
3390
+ }(DisplayObjectContainer));
3427
3391
 
3428
3392
  var ONCE_EMIT_MORPH_ERROR = Object.create(null);
3429
3393
  function once(obj, error) {
@@ -3453,20 +3417,6 @@ var MorphSprite = /** @class */ (function (_super) {
3453
3417
  }
3454
3418
  return new MorphSprite(graphics, material);
3455
3419
  };
3456
- MorphSprite.prototype._setGraphics = function (value) {
3457
- if (this._graphics == value) {
3458
- return;
3459
- }
3460
- if (this._graphics) {
3461
- this._graphics.removeEventListener(_awayjs_core.AssetEvent.INVALIDATE, this._onGraphicsInvalidateDelegate);
3462
- this._graphics.usages--;
3463
- //if (!this._graphics.usages)
3464
- // this.graphics.dispose();
3465
- }
3466
- if (!this._graphics)
3467
- this._graphics = _awayjs_graphics.Graphics.getGraphics();
3468
- this._graphics.copyFrom(value);
3469
- };
3470
3420
  Object.defineProperty(MorphSprite.prototype, "assetType", {
3471
3421
  get: function () {
3472
3422
  return MorphSprite.assetType;
@@ -3687,8 +3637,7 @@ var MorphSprite = /** @class */ (function (_super) {
3687
3637
  MorphSprite.assetType = '[asset MorphSprite]';
3688
3638
  MorphSprite._morphSprites = new Array();
3689
3639
  return MorphSprite;
3690
- }(Sprite));
3691
- _awayjs_view.PartitionBase.registerAbstraction(_awayjs_view.EntityNode, MorphSprite);
3640
+ }(Sprite));
3692
3641
 
3693
3642
  var _a;
3694
3643
  var BLEND_MODES = [
@@ -6935,7 +6884,6 @@ var MovieClip = /** @class */ (function (_super) {
6935
6884
  if (MovieClip._movieClips.length) {
6936
6885
  var movieClip = MovieClip._movieClips.pop();
6937
6886
  movieClip.timeline = timeline;
6938
- movieClip.graphics = _awayjs_graphics.Graphics.getGraphics();
6939
6887
  return movieClip;
6940
6888
  }
6941
6889
  return new MovieClip(timeline);
@@ -7315,7 +7263,8 @@ var MovieClip = /** @class */ (function (_super) {
7315
7263
  this.constructedKeyFrameIndex = -1;
7316
7264
  for (var i = this.numChildren - 1; i >= 0; i--)
7317
7265
  this.removeChildAt(i);
7318
- this.graphics.clear();
7266
+ if (this._graphics)
7267
+ this._graphics.clear();
7319
7268
  if (fireScripts) {
7320
7269
  var numFrames = this._timeline.keyframe_indices.length;
7321
7270
  this._isPlaying = Boolean(numFrames > 1);
@@ -10621,14 +10570,14 @@ var TextSprite = /** @class */ (function (_super) {
10621
10570
  function TextSprite() {
10622
10571
  return _super !== null && _super.apply(this, arguments) || this;
10623
10572
  }
10624
- TextSprite.prototype._acceptTraverser = function (traverser) {
10573
+ TextSprite.prototype._iInternalUpdate = function () {
10574
+ _super.prototype._iInternalUpdate.call(this);
10625
10575
  var tf = this.parentTextField;
10626
10576
  //tf.reConstruct(true);
10627
10577
  if (tf._textFormat && !tf._textFormat.font_table.isAsset(TesselatedFontTable) && !tf._textFormat.material) {
10628
10578
  this.transform.colorTransform.color = (tf.textColor != null) ? tf.textColor : tf._textFormat.color;
10629
10579
  this._invalidateHierarchicalProperty(_awayjs_view.HierarchicalProperty.COLOR_TRANSFORM);
10630
10580
  }
10631
- this._graphics._acceptTraverser(traverser);
10632
10581
  };
10633
10582
  return TextSprite;
10634
10583
  }(Sprite));
@@ -11342,7 +11291,6 @@ var TextField = /** @class */ (function (_super) {
11342
11291
  _this.startSelectionByMouseDelegate = function (event) { return _this.startSelectionByMouse(event); };
11343
11292
  _this.stopSelectionByMouseDelegate = function (event) { return _this.stopSelectionByMouse(event); };
11344
11293
  _this.updateSelectionByMouseDelegate = function (event) { return _this.updateSelectionByMouse(event); };
11345
- _this._onGraphicsInvalidateDelegate = function (event) { return _this._onGraphicsInvalidate(event); };
11346
11294
  _this._onClipboardPasteDelegate = function (event) { return _this.onClipboardPaste(event); };
11347
11295
  _this.cursorIntervalID = -1;
11348
11296
  _this._tabEnabled = true;
@@ -11373,7 +11321,6 @@ var TextField = /** @class */ (function (_super) {
11373
11321
  _this._scrollV = 0;
11374
11322
  _this._textFormats = [];
11375
11323
  _this._graphics = _awayjs_graphics.Graphics.getGraphics(); //unique graphics object for each TextField
11376
- _this._graphics.addEventListener(_awayjs_core.AssetEvent.INVALIDATE, _this._onGraphicsInvalidateDelegate);
11377
11324
  _this.mouseEnabled = _this._selectable;
11378
11325
  return _this;
11379
11326
  }
@@ -11465,7 +11412,7 @@ var TextField = /** @class */ (function (_super) {
11465
11412
  // }
11466
11413
  this.setSelection(0, 0);
11467
11414
  this._glyphsDirty = true;
11468
- this._updateEntity();
11415
+ this.invalidate();
11469
11416
  };
11470
11417
  TextField.prototype.enableInput = function (enable) {
11471
11418
  if (enable === void 0) { enable = true; }
@@ -11831,14 +11778,6 @@ var TextField = /** @class */ (function (_super) {
11831
11778
  // this._internalScale=scale;
11832
11779
  // this._glyphsDirty=true;
11833
11780
  };
11834
- /**
11835
- * //TODO
11836
- *
11837
- * @private
11838
- */
11839
- TextField.prototype._onGraphicsInvalidate = function (event) {
11840
- this.invalidate();
11841
- };
11842
11781
  Object.defineProperty(TextField.prototype, "assetType", {
11843
11782
  /**
11844
11783
  *
@@ -11976,11 +11915,8 @@ var TextField = /** @class */ (function (_super) {
11976
11915
  this._iTextWoLineBreaks = processedText.replace(/(\r\n|\n|\\n|\r)/gm, '');
11977
11916
  this._textDirty = true;
11978
11917
  //console.log("set text", value, "on" , this);
11979
- if (this._autoSize != TextFieldAutoSize.NONE)
11980
- this.invalidate();
11981
- else
11982
- this._updateEntity();
11983
11918
  this.newTextFormat = this._textFormats[this._textFormats.length - 1];
11919
+ this.invalidate();
11984
11920
  },
11985
11921
  enumerable: true,
11986
11922
  configurable: true
@@ -12210,10 +12146,7 @@ var TextField = /** @class */ (function (_super) {
12210
12146
  this._textFormatsIdx = [this._iText.length];
12211
12147
  this._textDirty = true;
12212
12148
  //console.log("set text", value, "on" , this);
12213
- if (this._autoSize != TextFieldAutoSize.NONE)
12214
- this.invalidate();
12215
- else
12216
- this._updateEntity();
12149
+ this.invalidate();
12217
12150
  },
12218
12151
  enumerable: true,
12219
12152
  configurable: true
@@ -12226,10 +12159,7 @@ var TextField = /** @class */ (function (_super) {
12226
12159
  this._textDirty = false;
12227
12160
  this._positionsDirty = false;
12228
12161
  this._glyphsDirty = true;
12229
- if (this._autoSize != TextFieldAutoSize.NONE)
12230
- this.invalidate();
12231
- else
12232
- this._updateEntity();
12162
+ this.invalidate();
12233
12163
  };
12234
12164
  Object.defineProperty(TextField.prototype, "newTextFormat", {
12235
12165
  get: function () {
@@ -12267,34 +12197,11 @@ var TextField = /** @class */ (function (_super) {
12267
12197
  // this._shapesDirty = true;
12268
12198
  this._textDirty = true;
12269
12199
  //this.reConstruct();
12270
- if (this._autoSize != TextFieldAutoSize.NONE)
12271
- this.invalidate();
12272
- else
12273
- this._updateEntity();
12200
+ this.invalidate();
12274
12201
  },
12275
12202
  enumerable: true,
12276
12203
  configurable: true
12277
12204
  });
12278
- /**
12279
- *
12280
- * @param renderer
12281
- *
12282
- * @internal
12283
- */
12284
- TextField.prototype._acceptTraverser = function (traverser) {
12285
- if (!this.maskMode) {
12286
- //if(!this.cursorBlinking && this._isInFocus && this.cursorShape && this._type==TextFieldType.INPUT){
12287
- // traverser[this.cursorShape.elements.traverseName](this.cursorShape);
12288
- //}
12289
- this._graphics._acceptTraverser(traverser);
12290
- //if(this.showSelection && this._isInFocus && this.bgShapeSelect){
12291
- // traverser[this.bgShapeSelect.elements.traverseName](this.bgShapeSelect);
12292
- //}
12293
- //if(this.bgShape){// && this.background){
12294
- // traverser[this.bgShape.elements.traverseName](this.bgShape);
12295
- //}
12296
- }
12297
- };
12298
12205
  Object.defineProperty(TextField.prototype, "scaleX", {
12299
12206
  /**
12300
12207
  * Indicates the horizontal scale(percentage) of the object as applied from
@@ -12372,7 +12279,7 @@ var TextField = /** @class */ (function (_super) {
12372
12279
  this._implicitPartition.invalidateEntity(this);
12373
12280
  //}*/
12374
12281
  this._glyphsDirty = true;
12375
- this._updateEntity();
12282
+ this.invalidate();
12376
12283
  },
12377
12284
  enumerable: true,
12378
12285
  configurable: true
@@ -12429,12 +12336,10 @@ var TextField = /** @class */ (function (_super) {
12429
12336
  return this._type;
12430
12337
  },
12431
12338
  set: function (value) {
12432
- if (this._type == value) {
12339
+ if (this._type == value)
12433
12340
  return;
12434
- }
12435
12341
  this._type = value;
12436
12342
  this._textDirty = true;
12437
- this._updateEntity();
12438
12343
  if (value == TextFieldType.INPUT) {
12439
12344
  //this._selectable=true;
12440
12345
  this.enableInput(true);
@@ -12444,6 +12349,7 @@ var TextField = /** @class */ (function (_super) {
12444
12349
  this.enableInput(false);
12445
12350
  this.removeEventListener(KeyboardEvent.KEYDOWN, this.onKeyDelegate);
12446
12351
  }
12352
+ this.invalidate();
12447
12353
  },
12448
12354
  enumerable: true,
12449
12355
  configurable: true
@@ -12510,7 +12416,7 @@ var TextField = /** @class */ (function (_super) {
12510
12416
  //override for textfield
12511
12417
  };
12512
12418
  TextField.prototype.getEntity = function () {
12513
- return this;
12419
+ return this._graphics;
12514
12420
  };
12515
12421
  TextField.prototype.clear = function () {
12516
12422
  _super.prototype.clear.call(this);
@@ -13125,7 +13031,6 @@ var TextField = /** @class */ (function (_super) {
13125
13031
  }
13126
13032
  }
13127
13033
  }
13128
- this.updateMaskMode();
13129
13034
  };
13130
13035
  TextField.prototype.buildGlyphsForLabelData = function () {
13131
13036
  this._clearTextShapes();
@@ -13401,10 +13306,7 @@ var TextField = /** @class */ (function (_super) {
13401
13306
  }
13402
13307
  this._iText += newText;
13403
13308
  this._textDirty = true;
13404
- if (this._autoSize != TextFieldAutoSize.NONE)
13405
- this.invalidate();
13406
- else
13407
- this._updateEntity();
13309
+ this.invalidate();
13408
13310
  };
13409
13311
  /**
13410
13312
  * *tells the Textfield that a paragraph is defined completly.
@@ -13413,10 +13315,7 @@ var TextField = /** @class */ (function (_super) {
13413
13315
  TextField.prototype.closeParagraph = function () {
13414
13316
  this._iText += '\n';
13415
13317
  this._textDirty = true;
13416
- if (this._autoSize != TextFieldAutoSize.NONE)
13417
- this.invalidate();
13418
- else
13419
- this._updateEntity();
13318
+ this.invalidate();
13420
13319
  };
13421
13320
  /**
13422
13321
  * Returns a rectangle that is the bounding box of the character.
@@ -14256,8 +14155,7 @@ var TextField = /** @class */ (function (_super) {
14256
14155
  TextField.assetType = '[asset TextField]';
14257
14156
  TextField._onChangedEvent = new TextfieldEvent(TextfieldEvent.CHANGED);
14258
14157
  return TextField;
14259
- }(DisplayObjectContainer));
14260
- _awayjs_view.PartitionBase.registerAbstraction(_awayjs_view.EntityNode, TextField);
14158
+ }(DisplayObjectContainer));
14261
14159
 
14262
14160
  var CastError = /** @class */ (function (_super) {
14263
14161
  __extends(CastError, _super);
@@ -18299,7 +18197,7 @@ var Scene = /** @class */ (function () {
18299
18197
  _awayjs_graphics.MaterialManager.materialClass = _awayjs_materials.MethodMaterial;
18300
18198
  _awayjs_graphics.MaterialManager.textureClass = _awayjs_renderer.ImageTexture2D;
18301
18199
 
18302
- console.debug('AwayJS - Scene - 0.13.247');
18200
+ console.debug('AwayJS - Scene - 0.13.248');
18303
18201
 
18304
18202
  exports.Timeline = Timeline;
18305
18203
  exports.ControllerBase = ControllerBase;