@urso/core 0.7.19 → 0.7.21
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/package.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* @param isStroke - Is this drawing for the outside stroke of the
|
|
13
13
|
* text? If not, it's for the inside fill
|
|
14
14
|
*/
|
|
15
|
+
|
|
15
16
|
PIXI.Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) {
|
|
16
17
|
if (isStroke === void 0) { isStroke = false; }
|
|
17
18
|
var style = this._style;
|
|
@@ -21,8 +22,9 @@ PIXI.Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) {
|
|
|
21
22
|
// https://developer.chrome.com/origintrials/#/view_trial/3585991203293757441
|
|
22
23
|
// note: this is unstable API, Chrome less 94 use a `textLetterSpacing`, newest use a letterSpacing
|
|
23
24
|
// eslint-disable-next-line max-len
|
|
24
|
-
var supportLetterSpacing =
|
|
25
|
-
|
|
25
|
+
var supportLetterSpacing = PIXI.Text.experimentalLetterSpacing
|
|
26
|
+
&& ('letterSpacing' in CanvasRenderingContext2D.prototype
|
|
27
|
+
|| 'textLetterSpacing' in CanvasRenderingContext2D.prototype);
|
|
26
28
|
|
|
27
29
|
if ((letterSpacing === 0 || supportLetterSpacing) && (!this.fillCustomColors || this.fillCustomColors.length === 0)) { //colors patch in if state
|
|
28
30
|
if (supportLetterSpacing) {
|
|
@@ -37,11 +39,13 @@ PIXI.Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) {
|
|
|
37
39
|
}
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
42
|
+
|
|
40
43
|
var currentPosition = x;
|
|
41
44
|
|
|
42
45
|
var textIndexOffset = this.text.indexOf(text); //colors patch block
|
|
43
46
|
var allTextLength = this.text.length;
|
|
44
47
|
var customColors = new Array(allTextLength);
|
|
48
|
+
|
|
45
49
|
if (this.fillCustomColors) {
|
|
46
50
|
for (var k in this.fillCustomColors) {
|
|
47
51
|
var colorsParams = this.fillCustomColors[k];
|
|
@@ -59,6 +63,7 @@ PIXI.Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) {
|
|
|
59
63
|
var stringArray = Array.from ? Array.from(text) : text.split('');
|
|
60
64
|
var previousWidth = this.context.measureText(text).width;
|
|
61
65
|
var currentWidth = 0;
|
|
66
|
+
|
|
62
67
|
for (var i = 0; i < stringArray.length; ++i) {
|
|
63
68
|
var currentChar = stringArray[i];
|
|
64
69
|
|
|
@@ -72,6 +77,7 @@ PIXI.Text.prototype.drawLetterSpacing = function (text, x, y, isStroke) {
|
|
|
72
77
|
|
|
73
78
|
this.context.fillText(currentChar, currentPosition, y);
|
|
74
79
|
}
|
|
80
|
+
|
|
75
81
|
currentWidth = this.context.measureText(text.substring(i + 1)).width;
|
|
76
82
|
currentPosition += previousWidth - currentWidth + letterSpacing;
|
|
77
83
|
previousWidth = currentWidth;
|
|
@@ -280,9 +280,9 @@ class ModulesObjectsProxy {
|
|
|
280
280
|
'dropShadowDistance': 'style.dropShadowDistance',
|
|
281
281
|
'wordWrap': 'style.wordWrap',
|
|
282
282
|
'wordWrapWidth': 'style.wordWrapWidth',
|
|
283
|
-
'leading
|
|
284
|
-
'letterSpacing
|
|
285
|
-
'textAlign
|
|
283
|
+
'leading': 'style.leading',
|
|
284
|
+
'letterSpacing': 'style.letterSpacing',
|
|
285
|
+
'textAlign': 'style.align',
|
|
286
286
|
'enabled': 'input.enabled',
|
|
287
287
|
'cacheAsBitmap': 'cacheAsBitmap',
|
|
288
288
|
'ignoreParentMask': 'ignoreParentMask',
|