@awayjs/scene 0.13.244 → 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.
- package/bundle/awayjs-scene.umd.js +42 -75
- package/bundle/awayjs-scene.umd.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map +1 -1
- package/bundle/awayjs-scene.umd.min.js.map.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/managers/DefaultFontManager.d.ts.map +1 -1
- package/dist/lib/managers/DefaultFontManager.js +3 -4
- package/dist/lib/text/HTMLTextProcessor.js +1 -1
- package/dist/lib/text/TextFormat.d.ts +3 -3
- package/dist/lib/text/TextFormat.d.ts.map +1 -1
- package/dist/lib/text/TextFormat.js +37 -69
- package/index.ts +1 -1
- package/lib/managers/DefaultFontManager.ts +3 -6
- package/lib/text/HTMLTextProcessor.ts +1 -1
- package/lib/text/TextFormat.ts +43 -75
- package/package.json +1 -1
|
@@ -10049,11 +10049,10 @@ var DefaultFontManager = /** @class */ (function () {
|
|
|
10049
10049
|
this._registered_fonts_by_className[className] = font;
|
|
10050
10050
|
};
|
|
10051
10051
|
DefaultFontManager.getFont = function (fontName, namespace) {
|
|
10052
|
-
//console.log('[DefaultFontManager] - getFont', fontName);
|
|
10053
10052
|
if (namespace === void 0) { namespace = undefined; }
|
|
10054
|
-
if
|
|
10055
|
-
|
|
10056
|
-
|
|
10053
|
+
// return null if no fontName supplied
|
|
10054
|
+
if (!fontName)
|
|
10055
|
+
return null;
|
|
10057
10056
|
// hack for dynamic fonts: first check if reguested font-name is a classname that was registered
|
|
10058
10057
|
if (this._registered_fonts_by_className[fontName]) {
|
|
10059
10058
|
return this._registered_fonts_by_className[fontName];
|
|
@@ -10129,7 +10128,7 @@ var PUBLIC_FIELDS = [
|
|
|
10129
10128
|
'size', 'color',
|
|
10130
10129
|
'bold', 'italic',
|
|
10131
10130
|
'underline', 'leading',
|
|
10132
|
-
'letterSpacing'
|
|
10131
|
+
'letterSpacing'
|
|
10133
10132
|
];
|
|
10134
10133
|
var TextFormat = /** @class */ (function (_super) {
|
|
10135
10134
|
__extends(TextFormat, _super);
|
|
@@ -10187,9 +10186,10 @@ var TextFormat = /** @class */ (function (_super) {
|
|
|
10187
10186
|
if (indent === void 0) { indent = null; }
|
|
10188
10187
|
if (leading === void 0) { leading = null; }
|
|
10189
10188
|
var _this = _super.call(this) || this;
|
|
10189
|
+
_this.fontLookUpMode = exports.FontLookUpMode.DEFAULT;
|
|
10190
10190
|
// flag marked that format is changed.
|
|
10191
10191
|
_this._updateID = 0;
|
|
10192
|
-
_this.
|
|
10192
|
+
_this._fontTableDirty = true;
|
|
10193
10193
|
/**
|
|
10194
10194
|
* Specifies custom tab stops as an array of non-negative integers. Each tab
|
|
10195
10195
|
* stop is specified in pixels. If custom tab stops are not specified
|
|
@@ -10197,7 +10197,6 @@ var TextFormat = /** @class */ (function (_super) {
|
|
|
10197
10197
|
*/
|
|
10198
10198
|
//todo: not used with in tesselated-font-table yet
|
|
10199
10199
|
_this.tabStops = [];
|
|
10200
|
-
_this.fontLookUpMode = exports.FontLookUpMode.DEFAULT;
|
|
10201
10200
|
_this._size = size;
|
|
10202
10201
|
_this._color = color;
|
|
10203
10202
|
_this._bold = bold;
|
|
@@ -10210,15 +10209,11 @@ var TextFormat = /** @class */ (function (_super) {
|
|
|
10210
10209
|
_this._rightMargin = rightMargin;
|
|
10211
10210
|
_this._indent = indent;
|
|
10212
10211
|
_this._leading = leading;
|
|
10213
|
-
_this._letterSpacing = null;
|
|
10214
|
-
_this._font_table = null;
|
|
10215
10212
|
if (typeof font === 'string') {
|
|
10216
|
-
_this.
|
|
10217
|
-
return _this;
|
|
10213
|
+
_this.font_name = font;
|
|
10218
10214
|
}
|
|
10219
|
-
else
|
|
10220
|
-
_this.
|
|
10221
|
-
_this._textFormatDirty = true;
|
|
10215
|
+
else {
|
|
10216
|
+
_this.font = font;
|
|
10222
10217
|
}
|
|
10223
10218
|
return _this;
|
|
10224
10219
|
}
|
|
@@ -10376,7 +10371,7 @@ var TextFormat = /** @class */ (function (_super) {
|
|
|
10376
10371
|
this._updateID++;
|
|
10377
10372
|
}
|
|
10378
10373
|
this._bold = value;
|
|
10379
|
-
this.
|
|
10374
|
+
this._fontTableDirty = true;
|
|
10380
10375
|
},
|
|
10381
10376
|
enumerable: true,
|
|
10382
10377
|
configurable: true
|
|
@@ -10390,7 +10385,7 @@ var TextFormat = /** @class */ (function (_super) {
|
|
|
10390
10385
|
this._updateID++;
|
|
10391
10386
|
}
|
|
10392
10387
|
this._italic = value;
|
|
10393
|
-
this.
|
|
10388
|
+
this._fontTableDirty = true;
|
|
10394
10389
|
},
|
|
10395
10390
|
enumerable: true,
|
|
10396
10391
|
configurable: true
|
|
@@ -10410,10 +10405,8 @@ var TextFormat = /** @class */ (function (_super) {
|
|
|
10410
10405
|
});
|
|
10411
10406
|
Object.defineProperty(TextFormat.prototype, "font_table", {
|
|
10412
10407
|
get: function () {
|
|
10413
|
-
if (!this._font_table || this.
|
|
10414
|
-
this.font; // getter makes sure a font exists !
|
|
10408
|
+
if (!this._font_table || this._fontTableDirty)
|
|
10415
10409
|
this.update_font_table();
|
|
10416
|
-
}
|
|
10417
10410
|
return this._font_table;
|
|
10418
10411
|
},
|
|
10419
10412
|
set: function (value) {
|
|
@@ -10421,7 +10414,7 @@ var TextFormat = /** @class */ (function (_super) {
|
|
|
10421
10414
|
// font_table is only ever set in parser or when using label-data
|
|
10422
10415
|
// after using "bold" or "itaic" font_table should never be set directly
|
|
10423
10416
|
this._font_table = value;
|
|
10424
|
-
this.
|
|
10417
|
+
this._fontTableDirty = false;
|
|
10425
10418
|
},
|
|
10426
10419
|
enumerable: true,
|
|
10427
10420
|
configurable: true
|
|
@@ -10431,11 +10424,27 @@ var TextFormat = /** @class */ (function (_super) {
|
|
|
10431
10424
|
var _a;
|
|
10432
10425
|
return (_a = this.font) === null || _a === void 0 ? void 0 : _a.name;
|
|
10433
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
|
+
},
|
|
10434
10443
|
enumerable: true,
|
|
10435
10444
|
configurable: true
|
|
10436
10445
|
});
|
|
10437
10446
|
TextFormat.prototype.update_font_table = function () {
|
|
10438
|
-
this.
|
|
10447
|
+
this._fontTableDirty = false;
|
|
10439
10448
|
var stylename = exports.FontStyleName.STANDART;
|
|
10440
10449
|
if (this._italic && !this._bold)
|
|
10441
10450
|
stylename = exports.FontStyleName.ITALIC;
|
|
@@ -10444,73 +10453,31 @@ var TextFormat = /** @class */ (function (_super) {
|
|
|
10444
10453
|
else if (this._italic && this._bold)
|
|
10445
10454
|
stylename = exports.FontStyleName.BOLDITALIC;
|
|
10446
10455
|
if (this._font) {
|
|
10447
|
-
var
|
|
10448
|
-
if
|
|
10449
|
-
|
|
10450
|
-
|
|
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)
|
|
10451
10460
|
return;
|
|
10452
|
-
|
|
10453
|
-
this._font_table = newFontTable ? newFontTable : Font.emptyFontTable;
|
|
10454
|
-
return;
|
|
10461
|
+
this._font_table = font_table ? font_table : Font.emptyFontTable;
|
|
10455
10462
|
}
|
|
10456
10463
|
};
|
|
10457
10464
|
Object.defineProperty(TextFormat.prototype, "font", {
|
|
10458
10465
|
get: function () {
|
|
10459
|
-
if (this._font) {
|
|
10460
|
-
return this._font;
|
|
10461
|
-
}
|
|
10462
|
-
if (this.fontLookUpMode == exports.FontLookUpMode.DEFAULT) {
|
|
10463
|
-
this._font = DefaultFontManager.getFont(null);
|
|
10464
|
-
}
|
|
10465
|
-
else if (this.fontLookUpMode == exports.FontLookUpMode.DEVICE) {
|
|
10466
|
-
this._font = DeviceFontManager.getDeviceFont(null);
|
|
10467
|
-
}
|
|
10468
|
-
else if (this.fontLookUpMode == exports.FontLookUpMode.EMBED_CFF) {
|
|
10469
|
-
this._font = DefaultFontManager.getFont_CFF(null);
|
|
10470
|
-
}
|
|
10471
|
-
else {
|
|
10472
|
-
console.warn('[TextFormat] - unsupported FontLookUpMode', this.fontLookUpMode);
|
|
10473
|
-
}
|
|
10474
|
-
this._font_table = null;
|
|
10475
|
-
this._textFormatDirty = true;
|
|
10476
10466
|
return this._font;
|
|
10477
10467
|
},
|
|
10478
10468
|
set: function (value) {
|
|
10479
|
-
this.
|
|
10480
|
-
if (typeof value === 'string') {
|
|
10481
|
-
this._setFontFromString(value);
|
|
10469
|
+
if (this._font == value)
|
|
10482
10470
|
return;
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
}
|
|
10487
|
-
if (value) {
|
|
10488
|
-
this._font = value;
|
|
10489
|
-
return;
|
|
10490
|
-
}
|
|
10491
|
-
this._font = null;
|
|
10492
|
-
this._font_table = null;
|
|
10471
|
+
this._font = value;
|
|
10472
|
+
this._fontTableDirty = true;
|
|
10473
|
+
this._updateID++;
|
|
10493
10474
|
},
|
|
10494
10475
|
enumerable: true,
|
|
10495
10476
|
configurable: true
|
|
10496
10477
|
});
|
|
10497
|
-
TextFormat.prototype._setFontFromString = function (font_name) {
|
|
10498
|
-
var asset;
|
|
10499
|
-
if (this.fontLookUpMode == exports.FontLookUpMode.DEFAULT) {
|
|
10500
|
-
asset = DefaultFontManager.getFont(font_name);
|
|
10501
|
-
}
|
|
10502
|
-
else if (this.fontLookUpMode == exports.FontLookUpMode.DEVICE) {
|
|
10503
|
-
asset = DeviceFontManager.getDeviceFont(font_name);
|
|
10504
|
-
}
|
|
10505
|
-
else if (this.fontLookUpMode == exports.FontLookUpMode.EMBED_CFF) {
|
|
10506
|
-
asset = DefaultFontManager.getFont_CFF(font_name);
|
|
10507
|
-
}
|
|
10508
|
-
this.font = asset;
|
|
10509
|
-
this._textFormatDirty = true;
|
|
10510
|
-
};
|
|
10511
10478
|
TextFormat.prototype.clone = function () {
|
|
10512
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);
|
|
10513
|
-
clonedFormat.font_table = this._font_table;
|
|
10480
|
+
clonedFormat.font_table = this._font_table; //investigate why this needs to be copied
|
|
10514
10481
|
return clonedFormat;
|
|
10515
10482
|
};
|
|
10516
10483
|
TextFormat.prototype.equal = function (format) {
|
|
@@ -11093,7 +11060,7 @@ var HTMLTextProcessor = /** @class */ (function () {
|
|
|
11093
11060
|
var value = myChild.attributes.face ?
|
|
11094
11061
|
myChild.attributes.face : myChild.attributes.FACE;
|
|
11095
11062
|
newProps_values[newProps_values.length] = value;
|
|
11096
|
-
newProps_names[newProps_names.length] = '
|
|
11063
|
+
newProps_names[newProps_names.length] = 'font_name';
|
|
11097
11064
|
}
|
|
11098
11065
|
}
|
|
11099
11066
|
// step2: collect the textformat-properties provided by this child.tagName
|
|
@@ -18358,7 +18325,7 @@ var Scene = /** @class */ (function () {
|
|
|
18358
18325
|
_awayjs_graphics.MaterialManager.materialClass = _awayjs_materials.MethodMaterial;
|
|
18359
18326
|
_awayjs_graphics.MaterialManager.textureClass = _awayjs_renderer.ImageTexture2D;
|
|
18360
18327
|
|
|
18361
|
-
console.debug('AwayJS - Scene - 0.13.
|
|
18328
|
+
console.debug('AwayJS - Scene - 0.13.245');
|
|
18362
18329
|
|
|
18363
18330
|
exports.Timeline = Timeline;
|
|
18364
18331
|
exports.ControllerBase = ControllerBase;
|