38 lines
1.6 KiB
JavaScript
38 lines
1.6 KiB
JavaScript
shadow$provide.module$node_modules$pixi_DOT_js$lib$scene$text$utils$generateTextStyleKey = function(global, require, module, exports) {
|
|
function addFillStyleKey(fillStyle, key, index) {
|
|
if (!fillStyle) {
|
|
return index;
|
|
}
|
|
key[index++] = fillStyle.color;
|
|
key[index++] = fillStyle.alpha;
|
|
key[index++] = fillStyle.fill?.styleKey;
|
|
return index;
|
|
}
|
|
var Color = require("module$node_modules$pixi_DOT_js$lib$color$Color");
|
|
"use strict";
|
|
const valuesToIterateForKeys = "align breakWords cssOverrides fontVariant fontWeight leading letterSpacing lineHeight padding textBaseline trim whiteSpace wordWrap wordWrapWidth fontFamily fontStyle fontSize".split(" ");
|
|
exports.generateTextStyleKey = function(style) {
|
|
const key = [];
|
|
var index = 0;
|
|
for (var i = 0; i < valuesToIterateForKeys.length; i++) {
|
|
const prop = `_${valuesToIterateForKeys[i]}`;
|
|
key[index++] = style[prop];
|
|
}
|
|
index = addFillStyleKey(style._fill, key, index);
|
|
if (i = style._stroke) {
|
|
index = addFillStyleKey(i, key, index), key[index++] = i.width, key[index++] = i.alignment, key[index++] = i.cap, key[index++] = i.join, key[index++] = i.miterLimit;
|
|
}
|
|
if (i = style.dropShadow) {
|
|
key[index++] = i.alpha, key[index++] = i.angle, key[index++] = i.blur, key[index++] = i.distance, key[index++] = Color.Color.shared.setValue(i.color).toNumber();
|
|
}
|
|
if (style = style.filters) {
|
|
for (const filter of style) {
|
|
key[index++] = filter.uid;
|
|
}
|
|
}
|
|
return key.join("-");
|
|
};
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$scene$text$utils$generateTextStyleKey.js.map
|