@awayjs/scene 0.13.243 → 0.13.245

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.
@@ -1429,6 +1429,7 @@ var DisplayObject = /** @class */ (function (_super) {
1429
1429
  //global debug bounding boxes:
1430
1430
  //this._boundsVisible=true;
1431
1431
  _this._onInvalidatePropertiesDelegate = function (event) { return _this._onInvalidateProperties(event); };
1432
+ _this._onInvalidateImagesDelegate = function (event) { return _this._onInvalidateImages(event); };
1432
1433
  //creation of associated transform object
1433
1434
  _this._transform = new _awayjs_core.Transform(null);
1434
1435
  //setup transform listeners
@@ -2219,11 +2220,15 @@ var DisplayObject = /** @class */ (function (_super) {
2219
2220
  set: function (value) {
2220
2221
  if (this._style == value)
2221
2222
  return;
2222
- if (this._style)
2223
+ if (this._style) {
2223
2224
  this._style.removeEventListener(_awayjs_renderer.StyleEvent.INVALIDATE_PROPERTIES, this._onInvalidatePropertiesDelegate);
2225
+ this._style.removeEventListener(_awayjs_renderer.StyleEvent.INVALIDATE_IMAGES, this._onInvalidateImagesDelegate);
2226
+ }
2224
2227
  this._style = value;
2225
- if (this._style)
2228
+ if (this._style) {
2226
2229
  this._style.addEventListener(_awayjs_renderer.StyleEvent.INVALIDATE_PROPERTIES, this._onInvalidatePropertiesDelegate);
2230
+ this._style.addEventListener(_awayjs_renderer.StyleEvent.INVALIDATE_IMAGES, this._onInvalidateImagesDelegate);
2231
+ }
2227
2232
  this._invalidateStyle();
2228
2233
  },
2229
2234
  enumerable: true,
@@ -2729,6 +2734,10 @@ var DisplayObject = /** @class */ (function (_super) {
2729
2734
  if (_event === void 0) { _event = null; }
2730
2735
  this._invalidateStyle();
2731
2736
  };
2737
+ DisplayObject.prototype._onInvalidateImages = function (_event) {
2738
+ if (_event === void 0) { _event = null; }
2739
+ this.invalidate();
2740
+ };
2732
2741
  DisplayObject.prototype._getDefaultBoundingVolume = function () {
2733
2742
  return _awayjs_view.BoundingVolumeType.BOX_BOUNDS_FAST;
2734
2743
  };
@@ -10040,11 +10049,10 @@ var DefaultFontManager = /** @class */ (function () {
10040
10049
  this._registered_fonts_by_className[className] = font;
10041
10050
  };
10042
10051
  DefaultFontManager.getFont = function (fontName, namespace) {
10043
- //console.log('[DefaultFontManager] - getFont', fontName);
10044
10052
  if (namespace === void 0) { namespace = undefined; }
10045
- if (!fontName) {
10046
- return DeviceFontManager.getDeviceFont(fontName);
10047
- }
10053
+ // return null if no fontName supplied
10054
+ if (!fontName)
10055
+ return null;
10048
10056
  // hack for dynamic fonts: first check if reguested font-name is a classname that was registered
10049
10057
  if (this._registered_fonts_by_className[fontName]) {
10050
10058
  return this._registered_fonts_by_className[fontName];
@@ -10120,7 +10128,7 @@ var PUBLIC_FIELDS = [
10120
10128
  'size', 'color',
10121
10129
  'bold', 'italic',
10122
10130
  'underline', 'leading',
10123
- 'letterSpacing', 'font_table'
10131
+ 'letterSpacing'
10124
10132
  ];
10125
10133
  var TextFormat = /** @class */ (function (_super) {
10126
10134
  __extends(TextFormat, _super);
@@ -10178,9 +10186,10 @@ var TextFormat = /** @class */ (function (_super) {
10178
10186
  if (indent === void 0) { indent = null; }
10179
10187
  if (leading === void 0) { leading = null; }
10180
10188
  var _this = _super.call(this) || this;
10189
+ _this.fontLookUpMode = exports.FontLookUpMode.DEFAULT;
10181
10190
  // flag marked that format is changed.
10182
10191
  _this._updateID = 0;
10183
- _this._textFormatDirty = false;
10192
+ _this._fontTableDirty = true;
10184
10193
  /**
10185
10194
  * Specifies custom tab stops as an array of non-negative integers. Each tab
10186
10195
  * stop is specified in pixels. If custom tab stops are not specified
@@ -10188,7 +10197,6 @@ var TextFormat = /** @class */ (function (_super) {
10188
10197
  */
10189
10198
  //todo: not used with in tesselated-font-table yet
10190
10199
  _this.tabStops = [];
10191
- _this.fontLookUpMode = exports.FontLookUpMode.DEFAULT;
10192
10200
  _this._size = size;
10193
10201
  _this._color = color;
10194
10202
  _this._bold = bold;
@@ -10201,15 +10209,11 @@ var TextFormat = /** @class */ (function (_super) {
10201
10209
  _this._rightMargin = rightMargin;
10202
10210
  _this._indent = indent;
10203
10211
  _this._leading = leading;
10204
- _this._letterSpacing = null;
10205
- _this._font_table = null;
10206
10212
  if (typeof font === 'string') {
10207
- _this._setFontFromString(font);
10208
- return _this;
10213
+ _this.font_name = font;
10209
10214
  }
10210
- else if (font) {
10211
- _this._font = font;
10212
- _this._textFormatDirty = true;
10215
+ else {
10216
+ _this.font = font;
10213
10217
  }
10214
10218
  return _this;
10215
10219
  }
@@ -10367,7 +10371,7 @@ var TextFormat = /** @class */ (function (_super) {
10367
10371
  this._updateID++;
10368
10372
  }
10369
10373
  this._bold = value;
10370
- this._textFormatDirty = true;
10374
+ this._fontTableDirty = true;
10371
10375
  },
10372
10376
  enumerable: true,
10373
10377
  configurable: true
@@ -10381,7 +10385,7 @@ var TextFormat = /** @class */ (function (_super) {
10381
10385
  this._updateID++;
10382
10386
  }
10383
10387
  this._italic = value;
10384
- this._textFormatDirty = true;
10388
+ this._fontTableDirty = true;
10385
10389
  },
10386
10390
  enumerable: true,
10387
10391
  configurable: true
@@ -10401,10 +10405,8 @@ var TextFormat = /** @class */ (function (_super) {
10401
10405
  });
10402
10406
  Object.defineProperty(TextFormat.prototype, "font_table", {
10403
10407
  get: function () {
10404
- if (!this._font_table || this._textFormatDirty) {
10405
- this.font; // getter makes sure a font exists !
10408
+ if (!this._font_table || this._fontTableDirty)
10406
10409
  this.update_font_table();
10407
- }
10408
10410
  return this._font_table;
10409
10411
  },
10410
10412
  set: function (value) {
@@ -10412,7 +10414,7 @@ var TextFormat = /** @class */ (function (_super) {
10412
10414
  // font_table is only ever set in parser or when using label-data
10413
10415
  // after using "bold" or "itaic" font_table should never be set directly
10414
10416
  this._font_table = value;
10415
- this._textFormatDirty = false;
10417
+ this._fontTableDirty = false;
10416
10418
  },
10417
10419
  enumerable: true,
10418
10420
  configurable: true
@@ -10422,11 +10424,27 @@ var TextFormat = /** @class */ (function (_super) {
10422
10424
  var _a;
10423
10425
  return (_a = this.font) === null || _a === void 0 ? void 0 : _a.name;
10424
10426
  },
10427
+ set: function (value) {
10428
+ var _a;
10429
+ if (((_a = this.font) === null || _a === void 0 ? void 0 : _a.name) == value)
10430
+ return;
10431
+ if (this.fontLookUpMode == exports.FontLookUpMode.DEFAULT) {
10432
+ this._font = DefaultFontManager.getFont(value);
10433
+ }
10434
+ else if (this.fontLookUpMode == exports.FontLookUpMode.DEVICE) {
10435
+ this._font = DeviceFontManager.getDeviceFont(value);
10436
+ }
10437
+ else if (this.fontLookUpMode == exports.FontLookUpMode.EMBED_CFF) {
10438
+ this._font = DefaultFontManager.getFont_CFF(value);
10439
+ }
10440
+ this._fontTableDirty = true;
10441
+ this._updateID++;
10442
+ },
10425
10443
  enumerable: true,
10426
10444
  configurable: true
10427
10445
  });
10428
10446
  TextFormat.prototype.update_font_table = function () {
10429
- this._textFormatDirty = false;
10447
+ this._fontTableDirty = false;
10430
10448
  var stylename = exports.FontStyleName.STANDART;
10431
10449
  if (this._italic && !this._bold)
10432
10450
  stylename = exports.FontStyleName.ITALIC;
@@ -10435,73 +10453,31 @@ var TextFormat = /** @class */ (function (_super) {
10435
10453
  else if (this._italic && this._bold)
10436
10454
  stylename = exports.FontStyleName.BOLDITALIC;
10437
10455
  if (this._font) {
10438
- var newFontTable = this.font.get_font_table(stylename, TesselatedFontTable.assetType, null, true);
10439
- if (this._font_table && !newFontTable) {
10440
- // if we have a font-table, and we switch to invalid style,
10441
- // we just keep the existing font-table
10456
+ var font_table = this._font.get_font_table(stylename, TesselatedFontTable.assetType, null, true);
10457
+ // if we have a font-table, and we switch to invalid style,
10458
+ // we just keep the existing font-table
10459
+ if (this._font_table && !font_table)
10442
10460
  return;
10443
- }
10444
- this._font_table = newFontTable ? newFontTable : Font.emptyFontTable;
10445
- return;
10461
+ this._font_table = font_table ? font_table : Font.emptyFontTable;
10446
10462
  }
10447
10463
  };
10448
10464
  Object.defineProperty(TextFormat.prototype, "font", {
10449
10465
  get: function () {
10450
- if (this._font) {
10451
- return this._font;
10452
- }
10453
- if (this.fontLookUpMode == exports.FontLookUpMode.DEFAULT) {
10454
- this._font = DefaultFontManager.getFont(null);
10455
- }
10456
- else if (this.fontLookUpMode == exports.FontLookUpMode.DEVICE) {
10457
- this._font = DeviceFontManager.getDeviceFont(null);
10458
- }
10459
- else if (this.fontLookUpMode == exports.FontLookUpMode.EMBED_CFF) {
10460
- this._font = DefaultFontManager.getFont_CFF(null);
10461
- }
10462
- else {
10463
- console.warn('[TextFormat] - unsupported FontLookUpMode', this.fontLookUpMode);
10464
- }
10465
- this._font_table = null;
10466
- this._textFormatDirty = true;
10467
10466
  return this._font;
10468
10467
  },
10469
10468
  set: function (value) {
10470
- this._textFormatDirty = true;
10471
- if (typeof value === 'string') {
10472
- this._setFontFromString(value);
10469
+ if (this._font == value)
10473
10470
  return;
10474
- }
10475
- if (value !== this._font) {
10476
- this._updateID++;
10477
- }
10478
- if (value) {
10479
- this._font = value;
10480
- return;
10481
- }
10482
- this._font = null;
10483
- this._font_table = null;
10471
+ this._font = value;
10472
+ this._fontTableDirty = true;
10473
+ this._updateID++;
10484
10474
  },
10485
10475
  enumerable: true,
10486
10476
  configurable: true
10487
10477
  });
10488
- TextFormat.prototype._setFontFromString = function (font_name) {
10489
- var asset;
10490
- if (this.fontLookUpMode == exports.FontLookUpMode.DEFAULT) {
10491
- asset = DefaultFontManager.getFont(font_name);
10492
- }
10493
- else if (this.fontLookUpMode == exports.FontLookUpMode.DEVICE) {
10494
- asset = DeviceFontManager.getDeviceFont(font_name);
10495
- }
10496
- else if (this.fontLookUpMode == exports.FontLookUpMode.EMBED_CFF) {
10497
- asset = DefaultFontManager.getFont_CFF(font_name);
10498
- }
10499
- this.font = asset;
10500
- this._textFormatDirty = true;
10501
- };
10502
10478
  TextFormat.prototype.clone = function () {
10503
10479
  var clonedFormat = new TextFormat(this._font, this._size, this._color, this._bold, this._italic, this._underline, this.url, this.link_target, this._align, this._leftMargin, this._rightMargin, this._indent, this._leading);
10504
- clonedFormat.font_table = this._font_table;
10480
+ clonedFormat.font_table = this._font_table; //investigate why this needs to be copied
10505
10481
  return clonedFormat;
10506
10482
  };
10507
10483
  TextFormat.prototype.equal = function (format) {
@@ -11084,7 +11060,7 @@ var HTMLTextProcessor = /** @class */ (function () {
11084
11060
  var value = myChild.attributes.face ?
11085
11061
  myChild.attributes.face : myChild.attributes.FACE;
11086
11062
  newProps_values[newProps_values.length] = value;
11087
- newProps_names[newProps_names.length] = 'font';
11063
+ newProps_names[newProps_names.length] = 'font_name';
11088
11064
  }
11089
11065
  }
11090
11066
  // step2: collect the textformat-properties provided by this child.tagName
@@ -14933,6 +14909,7 @@ var SceneImage2D = /** @class */ (function (_super) {
14933
14909
  }
14934
14910
  this._lastUsedFill = null;
14935
14911
  this._imageDataDirty = true;
14912
+ this.invalidate();
14936
14913
  };
14937
14914
  SceneImage2D._mapSupportedBlendMode = function (blendMode) {
14938
14915
  if (blendMode === void 0) { blendMode = ''; }
@@ -18348,7 +18325,7 @@ var Scene = /** @class */ (function () {
18348
18325
  _awayjs_graphics.MaterialManager.materialClass = _awayjs_materials.MethodMaterial;
18349
18326
  _awayjs_graphics.MaterialManager.textureClass = _awayjs_renderer.ImageTexture2D;
18350
18327
 
18351
- console.debug('AwayJS - Scene - 0.13.243');
18328
+ console.debug('AwayJS - Scene - 0.13.245');
18352
18329
 
18353
18330
  exports.Timeline = Timeline;
18354
18331
  exports.ControllerBase = ControllerBase;