@eva/plugin-renderer-text 2.0.1-beta.17 → 2.0.1-beta.19
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/dist/EVA.plugin.renderer.text.js +31 -22
- package/dist/EVA.plugin.renderer.text.min.js +1 -1
- package/dist/plugin-renderer-text.cjs.js +31 -23
- package/dist/plugin-renderer-text.cjs.prod.js +2 -2
- package/dist/plugin-renderer-text.d.ts +1 -2
- package/dist/plugin-renderer-text.esm.js +32 -24
- package/package.json +4 -4
|
@@ -96,13 +96,19 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
96
96
|
if (changed.componentName !== 'Text') return;
|
|
97
97
|
if (changed.type === eva_js.OBSERVER_TYPE.ADD) {
|
|
98
98
|
const component = changed.component;
|
|
99
|
-
const
|
|
99
|
+
const styleWithoutFont = _extends({}, component.style);
|
|
100
|
+
const fontFamily = styleWithoutFont.fontFamily;
|
|
101
|
+
delete styleWithoutFont.fontFamily;
|
|
102
|
+
const text = new rendererAdapter.Text(component.text, styleWithoutFont);
|
|
100
103
|
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
101
104
|
this.texts[changed.gameObject.id] = {
|
|
102
105
|
text,
|
|
103
106
|
component: changed.component
|
|
104
107
|
};
|
|
105
108
|
this.setSize(changed);
|
|
109
|
+
if (fontFamily) {
|
|
110
|
+
yield this.waitForFontResource(text, changed, fontFamily);
|
|
111
|
+
}
|
|
106
112
|
} else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
|
|
107
113
|
this.containerManager.getContainer(changed.gameObject.id).removeChild(this.texts[changed.gameObject.id].text);
|
|
108
114
|
this.texts[changed.gameObject.id].text.destroy({
|
|
@@ -112,6 +118,30 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
112
118
|
} else {
|
|
113
119
|
this.change(changed);
|
|
114
120
|
this.setSize(changed);
|
|
121
|
+
const component = changed.component;
|
|
122
|
+
if (changed.prop.prop[0] === 'style' && component.style && component.style.fontFamily) {
|
|
123
|
+
const {
|
|
124
|
+
text
|
|
125
|
+
} = this.texts[changed.gameObject.id];
|
|
126
|
+
yield this.waitForFontResource(text, changed, component.style.fontFamily);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
waitForFontResource(text, changed, fontFamily) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
if (!fontFamily) {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
try {
|
|
137
|
+
const fontName = Array.isArray(fontFamily) ? fontFamily[0] : fontFamily;
|
|
138
|
+
const asyncId = this.increaseAsyncId(changed.gameObject.id);
|
|
139
|
+
yield eva_js.resource.getResource(fontName);
|
|
140
|
+
if (!this.validateAsyncId(changed.gameObject.id, asyncId)) return;
|
|
141
|
+
text.style.fontFamily = fontFamily;
|
|
142
|
+
this.setSize(changed);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.warn(`字体资源 ${fontFamily} 加载失败:`, error);
|
|
115
145
|
}
|
|
116
146
|
});
|
|
117
147
|
}
|
|
@@ -126,27 +156,6 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
126
156
|
_extends(text.style, changed.component.style);
|
|
127
157
|
}
|
|
128
158
|
}
|
|
129
|
-
asyncChangeTextStyle(text, textStyle) {
|
|
130
|
-
if (textStyle.fontFamily) {
|
|
131
|
-
const fontFamily = textStyle.fontFamily;
|
|
132
|
-
textStyle.fontFamily = '';
|
|
133
|
-
this.asyncUpdateFontFamily(text, fontFamily);
|
|
134
|
-
}
|
|
135
|
-
_extends(text.style, textStyle);
|
|
136
|
-
}
|
|
137
|
-
asyncUpdateFontFamily(text, fontFamily) {
|
|
138
|
-
if (fontFamily) {
|
|
139
|
-
if (Array.isArray(fontFamily)) {
|
|
140
|
-
Promise.all(fontFamily.map(font => eva_js.resource.getResource(font))).finally(() => {
|
|
141
|
-
text.style.fontFamily = fontFamily;
|
|
142
|
-
});
|
|
143
|
-
} else {
|
|
144
|
-
eva_js.resource.getResource(fontFamily).finally(() => {
|
|
145
|
-
text.style.fontFamily = fontFamily;
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
159
|
setSize(changed) {
|
|
151
160
|
const {
|
|
152
161
|
transform
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_text=function(e,t,n,r,s){"use strict";function
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_extends.apply(null,arguments)}globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_text=function(e,t,n,r,s){"use strict";function i(e,t,n,r){var s,i=arguments.length,o=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(o=(i<3?s(o):i>3?s(t,n,o):s(t,n))||o);return i>3&&o&&Object.defineProperty(t,n,o),o}function o(e,t,n,r){return new(n||(n=Promise))((function(s,i){function o(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,c)}a((r=r.apply(e,t||[])).next())}))}class c extends n.Component{constructor(){super(...arguments),this.text="",this.style={}}init(e){const n=new t.TextStyle({fontSize:20}),r={};for(const e in n)0===e.indexOf("_")&&(r[e.substring(1)]=n[e]);delete r.styleKey,this.style=r,e&&(this.text=e.text,_extends(this.style,e.style))}}c.componentName="Text",i([function(e){return function(t,n){var r=function(e,t){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[t]||(e.constructor.IDEProps[t]={}),e.constructor.IDEProps[t]}(t,n);r.key=n,r.type=e}}("string")],c.prototype,"text",void 0);let a=class extends r.Renderer{constructor(){super(...arguments),this.name="Text",this.texts={}}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){return o(this,void 0,void 0,(function*(){if("Text"===e.componentName)if(e.type===n.OBSERVER_TYPE.ADD){const t=e.component,n=_extends({},t.style),r=n.fontFamily;delete n.fontFamily;const i=new s.Text(t.text,n);this.containerManager.getContainer(e.gameObject.id).addChildAt(i,0),this.texts[e.gameObject.id]={text:i,component:e.component},this.setSize(e),r&&(yield this.waitForFontResource(i,e,r))}else if(e.type===n.OBSERVER_TYPE.REMOVE)this.containerManager.getContainer(e.gameObject.id).removeChild(this.texts[e.gameObject.id].text),this.texts[e.gameObject.id].text.destroy({children:!0}),delete this.texts[e.gameObject.id];else{this.change(e),this.setSize(e);const t=e.component;if("style"===e.prop.prop[0]&&t.style&&t.style.fontFamily){const{text:n}=this.texts[e.gameObject.id];yield this.waitForFontResource(n,e,t.style.fontFamily)}}}))}waitForFontResource(e,t,r){return o(this,void 0,void 0,(function*(){if(r)try{const s=Array.isArray(r)?r[0]:r,i=this.increaseAsyncId(t.gameObject.id);if(yield n.resource.getResource(s),!this.validateAsyncId(t.gameObject.id,i))return;e.style.fontFamily=r,this.setSize(t)}catch(e){console.warn(`字体资源 ${r} 加载失败:`,e)}}))}change(e){const{text:t,component:n}=this.texts[e.gameObject.id];"text"===e.prop.prop[0]?t.text=n.text:"style"===e.prop.prop[0]&&_extends(t.style,e.component.style)}setSize(e){const{transform:t}=e.gameObject;t&&(t.size.width=this.texts[e.gameObject.id].text.width,t.size.height=this.texts[e.gameObject.id].text.height)}};a.systemName="Text",a=i([n.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],a);var l=a;return e.Text=c,e.TextSystem=l,Object.defineProperty(e,"__esModule",{value:!0}),e}({},PIXI,EVA,EVA.plugin.renderer,EVA.rendererAdapter);globalThis.EVA.plugin.renderer.text=globalThis.EVA.plugin.renderer.text||_EVA_IIFE_text;
|
|
@@ -84,13 +84,19 @@ let Text = class Text extends pluginRenderer.Renderer {
|
|
|
84
84
|
return;
|
|
85
85
|
if (changed.type === eva_js.OBSERVER_TYPE.ADD) {
|
|
86
86
|
const component = changed.component;
|
|
87
|
-
const
|
|
87
|
+
const styleWithoutFont = Object.assign({}, component.style);
|
|
88
|
+
const fontFamily = styleWithoutFont.fontFamily;
|
|
89
|
+
delete styleWithoutFont.fontFamily;
|
|
90
|
+
const text = new rendererAdapter.Text(component.text, styleWithoutFont);
|
|
88
91
|
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
89
92
|
this.texts[changed.gameObject.id] = {
|
|
90
93
|
text,
|
|
91
94
|
component: changed.component,
|
|
92
95
|
};
|
|
93
96
|
this.setSize(changed);
|
|
97
|
+
if (fontFamily) {
|
|
98
|
+
yield this.waitForFontResource(text, changed, fontFamily);
|
|
99
|
+
}
|
|
94
100
|
}
|
|
95
101
|
else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
|
|
96
102
|
this.containerManager.getContainer(changed.gameObject.id).removeChild(this.texts[changed.gameObject.id].text);
|
|
@@ -100,6 +106,30 @@ let Text = class Text extends pluginRenderer.Renderer {
|
|
|
100
106
|
else {
|
|
101
107
|
this.change(changed);
|
|
102
108
|
this.setSize(changed);
|
|
109
|
+
const component = changed.component;
|
|
110
|
+
if (changed.prop.prop[0] === 'style' && component.style && component.style.fontFamily) {
|
|
111
|
+
const { text } = this.texts[changed.gameObject.id];
|
|
112
|
+
yield this.waitForFontResource(text, changed, component.style.fontFamily);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
waitForFontResource(text, changed, fontFamily) {
|
|
118
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
119
|
+
if (!fontFamily) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
const fontName = Array.isArray(fontFamily) ? fontFamily[0] : fontFamily;
|
|
124
|
+
const asyncId = this.increaseAsyncId(changed.gameObject.id);
|
|
125
|
+
yield eva_js.resource.getResource(fontName);
|
|
126
|
+
if (!this.validateAsyncId(changed.gameObject.id, asyncId))
|
|
127
|
+
return;
|
|
128
|
+
text.style.fontFamily = fontFamily;
|
|
129
|
+
this.setSize(changed);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
console.warn(`字体资源 ${fontFamily} 加载失败:`, error);
|
|
103
133
|
}
|
|
104
134
|
});
|
|
105
135
|
}
|
|
@@ -112,28 +142,6 @@ let Text = class Text extends pluginRenderer.Renderer {
|
|
|
112
142
|
Object.assign(text.style, changed.component.style);
|
|
113
143
|
}
|
|
114
144
|
}
|
|
115
|
-
asyncChangeTextStyle(text, textStyle) {
|
|
116
|
-
if (textStyle.fontFamily) {
|
|
117
|
-
const fontFamily = textStyle.fontFamily;
|
|
118
|
-
textStyle.fontFamily = '';
|
|
119
|
-
this.asyncUpdateFontFamily(text, fontFamily);
|
|
120
|
-
}
|
|
121
|
-
Object.assign(text.style, textStyle);
|
|
122
|
-
}
|
|
123
|
-
asyncUpdateFontFamily(text, fontFamily) {
|
|
124
|
-
if (fontFamily) {
|
|
125
|
-
if (Array.isArray(fontFamily)) {
|
|
126
|
-
Promise.all(fontFamily.map(font => eva_js.resource.getResource(font))).finally(() => {
|
|
127
|
-
text.style.fontFamily = fontFamily;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
eva_js.resource.getResource(fontFamily).finally(() => {
|
|
132
|
-
text.style.fontFamily = fontFamily;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
145
|
setSize(changed) {
|
|
138
146
|
const { transform } = changed.gameObject;
|
|
139
147
|
if (!transform)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("pixi.js"),t=require("@eva/eva.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("pixi.js"),t=require("@eva/eva.js"),s=require("@eva/inspector-decorator"),i=require("@eva/plugin-renderer"),n=require("@eva/renderer-adapter");
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
@@ -13,4 +13,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
13
13
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
14
|
and limitations under the License.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function r(e,t,
|
|
16
|
+
function r(e,t,s,i){var n,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,s,i);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(o=(r<3?n(o):r>3?n(t,s,o):n(t,s))||o);return r>3&&o&&Object.defineProperty(t,s,o),o}function o(e,t,s,i){return new(s||(s=Promise))((function(n,r){function o(e){try{a(i.next(e))}catch(e){r(e)}}function c(e){try{a(i.throw(e))}catch(e){r(e)}}function a(e){e.done?n(e.value):new s((function(t){t(e.value)})).then(o,c)}a((i=i.apply(e,t||[])).next())}))}class c extends t.Component{constructor(){super(...arguments),this.text="",this.style={}}init(t){const s=new e.TextStyle({fontSize:20}),i={};for(const e in s)0===e.indexOf("_")&&(i[e.substring(1)]=s[e]);delete i.styleKey,this.style=i,t&&(this.text=t.text,Object.assign(this.style,t.style))}}c.componentName="Text",r([s.type("string")],c.prototype,"text",void 0);let a=class extends i.Renderer{constructor(){super(...arguments),this.name="Text",this.texts={}}init(){this.renderSystem=this.game.getSystem(i.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){return o(this,void 0,void 0,(function*(){if("Text"===e.componentName)if(e.type===t.OBSERVER_TYPE.ADD){const t=e.component,s=Object.assign({},t.style),i=s.fontFamily;delete s.fontFamily;const r=new n.Text(t.text,s);this.containerManager.getContainer(e.gameObject.id).addChildAt(r,0),this.texts[e.gameObject.id]={text:r,component:e.component},this.setSize(e),i&&(yield this.waitForFontResource(r,e,i))}else if(e.type===t.OBSERVER_TYPE.REMOVE)this.containerManager.getContainer(e.gameObject.id).removeChild(this.texts[e.gameObject.id].text),this.texts[e.gameObject.id].text.destroy({children:!0}),delete this.texts[e.gameObject.id];else{this.change(e),this.setSize(e);const t=e.component;if("style"===e.prop.prop[0]&&t.style&&t.style.fontFamily){const{text:s}=this.texts[e.gameObject.id];yield this.waitForFontResource(s,e,t.style.fontFamily)}}}))}waitForFontResource(e,s,i){return o(this,void 0,void 0,(function*(){if(i)try{const n=Array.isArray(i)?i[0]:i,r=this.increaseAsyncId(s.gameObject.id);if(yield t.resource.getResource(n),!this.validateAsyncId(s.gameObject.id,r))return;e.style.fontFamily=i,this.setSize(s)}catch(e){console.warn(`字体资源 ${i} 加载失败:`,e)}}))}change(e){const{text:t,component:s}=this.texts[e.gameObject.id];"text"===e.prop.prop[0]?t.text=s.text:"style"===e.prop.prop[0]&&Object.assign(t.style,e.component.style)}setSize(e){const{transform:t}=e.gameObject;t&&(t.size.width=this.texts[e.gameObject.id].text.width,t.size.height=this.texts[e.gameObject.id].text.height)}};a.systemName="Text",a=r([t.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],a);var d=a;exports.Text=c,exports.TextSystem=d;
|
|
@@ -69,9 +69,8 @@ export declare class TextSystem extends Renderer {
|
|
|
69
69
|
containerManager: ContainerManager;
|
|
70
70
|
init(): void;
|
|
71
71
|
componentChanged(changed: ComponentChanged): Promise<void>;
|
|
72
|
+
private waitForFontResource;
|
|
72
73
|
change(changed: ComponentChanged): void;
|
|
73
|
-
asyncChangeTextStyle(text: Text_3, textStyle: TextParams['style']): void;
|
|
74
|
-
asyncUpdateFontFamily(text: Text_3, fontFamily: string | string[] | undefined): void;
|
|
75
74
|
setSize(changed: ComponentChanged): void;
|
|
76
75
|
}
|
|
77
76
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextStyle } from 'pixi.js';
|
|
2
|
-
import { Component,
|
|
2
|
+
import { Component, decorators, OBSERVER_TYPE, resource } from '@eva/eva.js';
|
|
3
3
|
import { type } from '@eva/inspector-decorator';
|
|
4
4
|
import { Renderer, RendererSystem } from '@eva/plugin-renderer';
|
|
5
5
|
import { Text as Text$3 } from '@eva/renderer-adapter';
|
|
@@ -80,13 +80,19 @@ let Text = class Text extends Renderer {
|
|
|
80
80
|
return;
|
|
81
81
|
if (changed.type === OBSERVER_TYPE.ADD) {
|
|
82
82
|
const component = changed.component;
|
|
83
|
-
const
|
|
83
|
+
const styleWithoutFont = Object.assign({}, component.style);
|
|
84
|
+
const fontFamily = styleWithoutFont.fontFamily;
|
|
85
|
+
delete styleWithoutFont.fontFamily;
|
|
86
|
+
const text = new Text$3(component.text, styleWithoutFont);
|
|
84
87
|
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
85
88
|
this.texts[changed.gameObject.id] = {
|
|
86
89
|
text,
|
|
87
90
|
component: changed.component,
|
|
88
91
|
};
|
|
89
92
|
this.setSize(changed);
|
|
93
|
+
if (fontFamily) {
|
|
94
|
+
yield this.waitForFontResource(text, changed, fontFamily);
|
|
95
|
+
}
|
|
90
96
|
}
|
|
91
97
|
else if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
92
98
|
this.containerManager.getContainer(changed.gameObject.id).removeChild(this.texts[changed.gameObject.id].text);
|
|
@@ -96,6 +102,30 @@ let Text = class Text extends Renderer {
|
|
|
96
102
|
else {
|
|
97
103
|
this.change(changed);
|
|
98
104
|
this.setSize(changed);
|
|
105
|
+
const component = changed.component;
|
|
106
|
+
if (changed.prop.prop[0] === 'style' && component.style && component.style.fontFamily) {
|
|
107
|
+
const { text } = this.texts[changed.gameObject.id];
|
|
108
|
+
yield this.waitForFontResource(text, changed, component.style.fontFamily);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
waitForFontResource(text, changed, fontFamily) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
if (!fontFamily) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
const fontName = Array.isArray(fontFamily) ? fontFamily[0] : fontFamily;
|
|
120
|
+
const asyncId = this.increaseAsyncId(changed.gameObject.id);
|
|
121
|
+
yield resource.getResource(fontName);
|
|
122
|
+
if (!this.validateAsyncId(changed.gameObject.id, asyncId))
|
|
123
|
+
return;
|
|
124
|
+
text.style.fontFamily = fontFamily;
|
|
125
|
+
this.setSize(changed);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
console.warn(`字体资源 ${fontFamily} 加载失败:`, error);
|
|
99
129
|
}
|
|
100
130
|
});
|
|
101
131
|
}
|
|
@@ -108,28 +138,6 @@ let Text = class Text extends Renderer {
|
|
|
108
138
|
Object.assign(text.style, changed.component.style);
|
|
109
139
|
}
|
|
110
140
|
}
|
|
111
|
-
asyncChangeTextStyle(text, textStyle) {
|
|
112
|
-
if (textStyle.fontFamily) {
|
|
113
|
-
const fontFamily = textStyle.fontFamily;
|
|
114
|
-
textStyle.fontFamily = '';
|
|
115
|
-
this.asyncUpdateFontFamily(text, fontFamily);
|
|
116
|
-
}
|
|
117
|
-
Object.assign(text.style, textStyle);
|
|
118
|
-
}
|
|
119
|
-
asyncUpdateFontFamily(text, fontFamily) {
|
|
120
|
-
if (fontFamily) {
|
|
121
|
-
if (Array.isArray(fontFamily)) {
|
|
122
|
-
Promise.all(fontFamily.map(font => resource.getResource(font))).finally(() => {
|
|
123
|
-
text.style.fontFamily = fontFamily;
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
resource.getResource(fontFamily).finally(() => {
|
|
128
|
-
text.style.fontFamily = fontFamily;
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
141
|
setSize(changed) {
|
|
134
142
|
const { transform } = changed.gameObject;
|
|
135
143
|
if (!transform)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-text",
|
|
3
|
-
"version": "2.0.1-beta.
|
|
3
|
+
"version": "2.0.1-beta.19",
|
|
4
4
|
"description": "@eva/plugin-renderer-text",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-text.esm.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@eva/inspector-decorator": "^0.0.5",
|
|
22
|
-
"@eva/plugin-renderer": "2.0.1-beta.
|
|
23
|
-
"@eva/renderer-adapter": "2.0.1-beta.
|
|
24
|
-
"@eva/eva.js": "2.0.1-beta.
|
|
22
|
+
"@eva/plugin-renderer": "2.0.1-beta.19",
|
|
23
|
+
"@eva/renderer-adapter": "2.0.1-beta.19",
|
|
24
|
+
"@eva/eva.js": "2.0.1-beta.19",
|
|
25
25
|
"pixi.js": "^8.8.1"
|
|
26
26
|
}
|
|
27
27
|
}
|