@eva/plugin-renderer-text 2.0.1-beta.21 → 2.0.1-beta.22
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.
|
@@ -146,12 +146,13 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
addTextComponent(changed) {
|
|
149
|
-
var _a;
|
|
150
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
150
|
const component = changed.component;
|
|
152
|
-
const
|
|
151
|
+
const styleWithoutFont = _extends({}, component.style);
|
|
152
|
+
const fontFamily = styleWithoutFont.fontFamily;
|
|
153
|
+
delete styleWithoutFont.fontFamily;
|
|
153
154
|
const initialText = fontFamily ? '' : component.text;
|
|
154
|
-
const text = new rendererAdapter.Text(initialText,
|
|
155
|
+
const text = new rendererAdapter.Text(initialText, styleWithoutFont);
|
|
155
156
|
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
156
157
|
this.texts[changed.gameObject.id] = {
|
|
157
158
|
text,
|
|
@@ -164,14 +165,15 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
167
|
addHTMLTextComponent(changed) {
|
|
167
|
-
var _a;
|
|
168
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
169
169
|
const component = changed.component;
|
|
170
|
-
const
|
|
170
|
+
const styleWithoutFont = _extends({}, component.style);
|
|
171
|
+
const fontFamily = styleWithoutFont.fontFamily;
|
|
172
|
+
delete styleWithoutFont.fontFamily;
|
|
171
173
|
const initialText = fontFamily ? '' : component.text;
|
|
172
174
|
const htmlText = new rendererAdapter.HTMLText(_extends({
|
|
173
175
|
text: initialText,
|
|
174
|
-
style:
|
|
176
|
+
style: styleWithoutFont
|
|
175
177
|
}, component.textureStyle && {
|
|
176
178
|
textureStyle: component.textureStyle
|
|
177
179
|
}));
|
|
@@ -197,6 +199,7 @@ var _EVA_IIFE_text = function (exports, pixi_js, eva_js, pluginRenderer, rendere
|
|
|
197
199
|
yield eva_js.resource.getResource(fontName);
|
|
198
200
|
if (!this.validateAsyncId(changed.gameObject.id, asyncId)) return;
|
|
199
201
|
const component = this.texts[changed.gameObject.id].component;
|
|
202
|
+
text.style.fontFamily = fontFamily;
|
|
200
203
|
text.text = component.text;
|
|
201
204
|
this.setSize(changed);
|
|
202
205
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},_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(t,e,n,i,o){"use strict";function s(t,e,n,i){var o,s=arguments.length,r=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r}function r(t,e,n,i){return new(n||(n=Promise))((function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function c(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,c)}l((i=i.apply(t,e||[])).next())}))}function c(t){return function(e,n){var i=function(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}(e,n);i.key=n,i.type=t}}class l extends n.Component{constructor(){super(...arguments),this.text="",this.style={}}init(t){const n=new e.TextStyle({fontSize:20}),i={};for(const t in n)0===t.indexOf("_")&&(i[t.substring(1)]=n[t]);delete i.styleKey,this.style=i,t&&(this.text=t.text,_extends(this.style,t.style))}}l.componentName="Text",s([c("string")],l.prototype,"text",void 0);class a extends n.Component{constructor(){super(...arguments),this.text="",this.style={},this.textureStyle={}}init(t){this.style=_extends({fontSize:24,fill:"#000000",fontFamily:"Arial"},null==t?void 0:t.style),this.textureStyle=_extends({scaleMode:"linear",resolution:window.devicePixelRatio||1},null==t?void 0:t.textureStyle),t&&(this.text=t.text)}}a.componentName="HTMLText",s([c("string")],a.prototype,"text",void 0);let d=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(t){return r(this,void 0,void 0,(function*(){const e="Text"===t.componentName,i="HTMLText"===t.componentName;if(e||i)if(t.type===n.OBSERVER_TYPE.ADD)e?yield this.addTextComponent(t):yield this.addHTMLTextComponent(t);else if(t.type===n.OBSERVER_TYPE.REMOVE)this.containerManager.getContainer(t.gameObject.id).removeChild(this.texts[t.gameObject.id].text),this.texts[t.gameObject.id].text.destroy({children:!0}),delete this.texts[t.gameObject.id];else{this.change(t),this.setSize(t);const e=t.component;if("style"===t.prop.prop[0]&&e.style&&e.style.fontFamily){const{text:n}=this.texts[t.gameObject.id];yield this.waitForFontResource(n,t,e.style.fontFamily)}}}))}addTextComponent(t){
|
|
1
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)({}).hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},_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(t,e,n,i,o){"use strict";function s(t,e,n,i){var o,s=arguments.length,r=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,n,i);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(r=(s<3?o(r):s>3?o(e,n,r):o(e,n))||r);return s>3&&r&&Object.defineProperty(e,n,r),r}function r(t,e,n,i){return new(n||(n=Promise))((function(o,s){function r(t){try{l(i.next(t))}catch(t){s(t)}}function c(t){try{l(i.throw(t))}catch(t){s(t)}}function l(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,c)}l((i=i.apply(t,e||[])).next())}))}function c(t){return function(e,n){var i=function(t,e){return t.constructor.IDEProps||(t.constructor.IDEProps={}),t.constructor.IDEProps[e]||(t.constructor.IDEProps[e]={}),t.constructor.IDEProps[e]}(e,n);i.key=n,i.type=t}}class l extends n.Component{constructor(){super(...arguments),this.text="",this.style={}}init(t){const n=new e.TextStyle({fontSize:20}),i={};for(const t in n)0===t.indexOf("_")&&(i[t.substring(1)]=n[t]);delete i.styleKey,this.style=i,t&&(this.text=t.text,_extends(this.style,t.style))}}l.componentName="Text",s([c("string")],l.prototype,"text",void 0);class a extends n.Component{constructor(){super(...arguments),this.text="",this.style={},this.textureStyle={}}init(t){this.style=_extends({fontSize:24,fill:"#000000",fontFamily:"Arial"},null==t?void 0:t.style),this.textureStyle=_extends({scaleMode:"linear",resolution:window.devicePixelRatio||1},null==t?void 0:t.textureStyle),t&&(this.text=t.text)}}a.componentName="HTMLText",s([c("string")],a.prototype,"text",void 0);let d=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(t){return r(this,void 0,void 0,(function*(){const e="Text"===t.componentName,i="HTMLText"===t.componentName;if(e||i)if(t.type===n.OBSERVER_TYPE.ADD)e?yield this.addTextComponent(t):yield this.addHTMLTextComponent(t);else if(t.type===n.OBSERVER_TYPE.REMOVE)this.containerManager.getContainer(t.gameObject.id).removeChild(this.texts[t.gameObject.id].text),this.texts[t.gameObject.id].text.destroy({children:!0}),delete this.texts[t.gameObject.id];else{this.change(t),this.setSize(t);const e=t.component;if("style"===t.prop.prop[0]&&e.style&&e.style.fontFamily){const{text:n}=this.texts[t.gameObject.id];yield this.waitForFontResource(n,t,e.style.fontFamily)}}}))}addTextComponent(t){return r(this,void 0,void 0,(function*(){const e=t.component,n=_extends({},e.style),i=n.fontFamily;delete n.fontFamily;const s=i?"":e.text,r=new o.Text(s,n);this.containerManager.getContainer(t.gameObject.id).addChildAt(r,0),this.texts[t.gameObject.id]={text:r,component:e},this.setSize(t),i&&(yield this.waitForFontResource(r,t,i))}))}addHTMLTextComponent(t){return r(this,void 0,void 0,(function*(){const e=t.component,n=_extends({},e.style),i=n.fontFamily;delete n.fontFamily;const s=i?"":e.text,r=new o.HTMLText(_extends({text:s,style:n},e.textureStyle&&{textureStyle:e.textureStyle}));this.containerManager.getContainer(t.gameObject.id).addChildAt(r,0),this.texts[t.gameObject.id]={text:r,component:e},this.setSize(t),i&&(yield this.waitForFontResource(r,t,i))}))}waitForFontResource(t,e,i){return r(this,void 0,void 0,(function*(){if(i)try{const o=Array.isArray(i)?i[0]:i,s=this.increaseAsyncId(e.gameObject.id);if(yield n.resource.getResource(o),!this.validateAsyncId(e.gameObject.id,s))return;const r=this.texts[e.gameObject.id].component;t.style.fontFamily=i,t.text=r.text,this.setSize(e)}catch(t){console.warn(`字体资源 ${i} 加载失败:`,t)}}))}change(t){const{text:e,component:n}=this.texts[t.gameObject.id],i="HTMLText"===t.componentName;if("text"===t.prop.prop[0])e.text=n.text;else if("style"===t.prop.prop[0])_extends(e.style,n.style);else if("textureStyle"===t.prop.prop[0]&&i){const i=n,s=this.containerManager.getContainer(t.gameObject.id),r=s.getChildIndex(e);s.removeChild(e),e.destroy({children:!0});const c=new o.HTMLText({text:i.text,style:i.style,textureStyle:i.textureStyle});s.addChildAt(c,r),this.texts[t.gameObject.id].text=c}}setSize(t){const{transform:e}=t.gameObject;e&&(e.size.width=this.texts[t.gameObject.id].text.width,e.size.height=this.texts[t.gameObject.id].text.height)}};d.systemName="Text",d=s([n.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}],HTMLText:["text",{prop:["style"],deep:!0},{prop:["textureStyle"],deep:!0}]})],d);var x=d;return t.HTMLText=a,t.Text=l,t.TextSystem=x,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI,EVA,EVA.plugin.renderer,EVA.rendererAdapter);globalThis.EVA.plugin.renderer.text=globalThis.EVA.plugin.renderer.text||_EVA_IIFE_text;
|
|
@@ -129,12 +129,13 @@ let Text = class Text extends pluginRenderer.Renderer {
|
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
addTextComponent(changed) {
|
|
132
|
-
var _a;
|
|
133
132
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
133
|
const component = changed.component;
|
|
135
|
-
const
|
|
134
|
+
const styleWithoutFont = Object.assign({}, component.style);
|
|
135
|
+
const fontFamily = styleWithoutFont.fontFamily;
|
|
136
|
+
delete styleWithoutFont.fontFamily;
|
|
136
137
|
const initialText = fontFamily ? '' : component.text;
|
|
137
|
-
const text = new rendererAdapter.Text(initialText,
|
|
138
|
+
const text = new rendererAdapter.Text(initialText, styleWithoutFont);
|
|
138
139
|
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
139
140
|
this.texts[changed.gameObject.id] = {
|
|
140
141
|
text,
|
|
@@ -147,12 +148,13 @@ let Text = class Text extends pluginRenderer.Renderer {
|
|
|
147
148
|
});
|
|
148
149
|
}
|
|
149
150
|
addHTMLTextComponent(changed) {
|
|
150
|
-
var _a;
|
|
151
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
152
152
|
const component = changed.component;
|
|
153
|
-
const
|
|
153
|
+
const styleWithoutFont = Object.assign({}, component.style);
|
|
154
|
+
const fontFamily = styleWithoutFont.fontFamily;
|
|
155
|
+
delete styleWithoutFont.fontFamily;
|
|
154
156
|
const initialText = fontFamily ? '' : component.text;
|
|
155
|
-
const htmlText = new rendererAdapter.HTMLText(Object.assign({ text: initialText, style:
|
|
157
|
+
const htmlText = new rendererAdapter.HTMLText(Object.assign({ text: initialText, style: styleWithoutFont }, (component.textureStyle && { textureStyle: component.textureStyle })));
|
|
156
158
|
this.containerManager.getContainer(changed.gameObject.id).addChildAt(htmlText, 0);
|
|
157
159
|
this.texts[changed.gameObject.id] = {
|
|
158
160
|
text: htmlText,
|
|
@@ -176,6 +178,7 @@ let Text = class Text extends pluginRenderer.Renderer {
|
|
|
176
178
|
if (!this.validateAsyncId(changed.gameObject.id, asyncId))
|
|
177
179
|
return;
|
|
178
180
|
const component = this.texts[changed.gameObject.id].component;
|
|
181
|
+
text.style.fontFamily = fontFamily;
|
|
179
182
|
text.text = component.text;
|
|
180
183
|
this.setSize(changed);
|
|
181
184
|
}
|
|
@@ -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 o(e,t,i,n){var s,o=arguments.length,r=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(r=(o<3?s(r):o>3?s(t,i,r):s(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r}function r(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){e.done?s(e.value):new i((function(t){t(e.value)})).then(r,c)}a((n=n.apply(e,t||[])).next())}))}class c extends t.Component{constructor(){super(...arguments),this.text="",this.style={}}init(t){const i=new e.TextStyle({fontSize:20}),n={};for(const e in i)0===e.indexOf("_")&&(n[e.substring(1)]=i[e]);delete n.styleKey,this.style=n,t&&(this.text=t.text,Object.assign(this.style,t.style))}}c.componentName="Text",o([i.type("string")],c.prototype,"text",void 0);class a extends t.Component{constructor(){super(...arguments),this.text="",this.style={},this.textureStyle={}}init(e){this.style=Object.assign({fontSize:24,fill:"#000000",fontFamily:"Arial"},null==e?void 0:e.style),this.textureStyle=Object.assign({scaleMode:"linear",resolution:window.devicePixelRatio||1},null==e?void 0:e.textureStyle),e&&(this.text=e.text)}}a.componentName="HTMLText",o([i.type("string")],a.prototype,"text",void 0);let d=class extends n.Renderer{constructor(){super(...arguments),this.name="Text",this.texts={}}init(){this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){return r(this,void 0,void 0,(function*(){const i="Text"===e.componentName,n="HTMLText"===e.componentName;if(i||n)if(e.type===t.OBSERVER_TYPE.ADD)i?yield this.addTextComponent(e):yield this.addHTMLTextComponent(e);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:i}=this.texts[e.gameObject.id];yield this.waitForFontResource(i,e,t.style.fontFamily)}}}))}addTextComponent(e){
|
|
16
|
+
function o(e,t,i,n){var s,o=arguments.length,r=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(r=(o<3?s(r):o>3?s(t,i,r):s(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r}function r(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{a(n.next(e))}catch(e){o(e)}}function c(e){try{a(n.throw(e))}catch(e){o(e)}}function a(e){e.done?s(e.value):new i((function(t){t(e.value)})).then(r,c)}a((n=n.apply(e,t||[])).next())}))}class c extends t.Component{constructor(){super(...arguments),this.text="",this.style={}}init(t){const i=new e.TextStyle({fontSize:20}),n={};for(const e in i)0===e.indexOf("_")&&(n[e.substring(1)]=i[e]);delete n.styleKey,this.style=n,t&&(this.text=t.text,Object.assign(this.style,t.style))}}c.componentName="Text",o([i.type("string")],c.prototype,"text",void 0);class a extends t.Component{constructor(){super(...arguments),this.text="",this.style={},this.textureStyle={}}init(e){this.style=Object.assign({fontSize:24,fill:"#000000",fontFamily:"Arial"},null==e?void 0:e.style),this.textureStyle=Object.assign({scaleMode:"linear",resolution:window.devicePixelRatio||1},null==e?void 0:e.textureStyle),e&&(this.text=e.text)}}a.componentName="HTMLText",o([i.type("string")],a.prototype,"text",void 0);let d=class extends n.Renderer{constructor(){super(...arguments),this.name="Text",this.texts={}}init(){this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){return r(this,void 0,void 0,(function*(){const i="Text"===e.componentName,n="HTMLText"===e.componentName;if(i||n)if(e.type===t.OBSERVER_TYPE.ADD)i?yield this.addTextComponent(e):yield this.addHTMLTextComponent(e);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:i}=this.texts[e.gameObject.id];yield this.waitForFontResource(i,e,t.style.fontFamily)}}}))}addTextComponent(e){return r(this,void 0,void 0,(function*(){const t=e.component,i=Object.assign({},t.style),n=i.fontFamily;delete i.fontFamily;const o=n?"":t.text,r=new s.Text(o,i);this.containerManager.getContainer(e.gameObject.id).addChildAt(r,0),this.texts[e.gameObject.id]={text:r,component:t},this.setSize(e),n&&(yield this.waitForFontResource(r,e,n))}))}addHTMLTextComponent(e){return r(this,void 0,void 0,(function*(){const t=e.component,i=Object.assign({},t.style),n=i.fontFamily;delete i.fontFamily;const o=n?"":t.text,r=new s.HTMLText(Object.assign({text:o,style:i},t.textureStyle&&{textureStyle:t.textureStyle}));this.containerManager.getContainer(e.gameObject.id).addChildAt(r,0),this.texts[e.gameObject.id]={text:r,component:t},this.setSize(e),n&&(yield this.waitForFontResource(r,e,n))}))}waitForFontResource(e,i,n){return r(this,void 0,void 0,(function*(){if(n)try{const s=Array.isArray(n)?n[0]:n,o=this.increaseAsyncId(i.gameObject.id);if(yield t.resource.getResource(s),!this.validateAsyncId(i.gameObject.id,o))return;const r=this.texts[i.gameObject.id].component;e.style.fontFamily=n,e.text=r.text,this.setSize(i)}catch(e){console.warn(`字体资源 ${n} 加载失败:`,e)}}))}change(e){const{text:t,component:i}=this.texts[e.gameObject.id],n="HTMLText"===e.componentName;if("text"===e.prop.prop[0])t.text=i.text;else if("style"===e.prop.prop[0])Object.assign(t.style,i.style);else if("textureStyle"===e.prop.prop[0]&&n){const n=i,o=this.containerManager.getContainer(e.gameObject.id),r=o.getChildIndex(t);o.removeChild(t),t.destroy({children:!0});const c=new s.HTMLText({text:n.text,style:n.style,textureStyle:n.textureStyle});o.addChildAt(c,r),this.texts[e.gameObject.id].text=c}}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)}};d.systemName="Text",d=o([t.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}],HTMLText:["text",{prop:["style"],deep:!0},{prop:["textureStyle"],deep:!0}]})],d);var l=d;exports.HTMLText=a,exports.Text=c,exports.TextSystem=l;
|
|
@@ -125,12 +125,13 @@ let Text = class Text extends Renderer {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
addTextComponent(changed) {
|
|
128
|
-
var _a;
|
|
129
128
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
129
|
const component = changed.component;
|
|
131
|
-
const
|
|
130
|
+
const styleWithoutFont = Object.assign({}, component.style);
|
|
131
|
+
const fontFamily = styleWithoutFont.fontFamily;
|
|
132
|
+
delete styleWithoutFont.fontFamily;
|
|
132
133
|
const initialText = fontFamily ? '' : component.text;
|
|
133
|
-
const text = new Text$3(initialText,
|
|
134
|
+
const text = new Text$3(initialText, styleWithoutFont);
|
|
134
135
|
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
135
136
|
this.texts[changed.gameObject.id] = {
|
|
136
137
|
text,
|
|
@@ -143,12 +144,13 @@ let Text = class Text extends Renderer {
|
|
|
143
144
|
});
|
|
144
145
|
}
|
|
145
146
|
addHTMLTextComponent(changed) {
|
|
146
|
-
var _a;
|
|
147
147
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
148
|
const component = changed.component;
|
|
149
|
-
const
|
|
149
|
+
const styleWithoutFont = Object.assign({}, component.style);
|
|
150
|
+
const fontFamily = styleWithoutFont.fontFamily;
|
|
151
|
+
delete styleWithoutFont.fontFamily;
|
|
150
152
|
const initialText = fontFamily ? '' : component.text;
|
|
151
|
-
const htmlText = new HTMLText$1(Object.assign({ text: initialText, style:
|
|
153
|
+
const htmlText = new HTMLText$1(Object.assign({ text: initialText, style: styleWithoutFont }, (component.textureStyle && { textureStyle: component.textureStyle })));
|
|
152
154
|
this.containerManager.getContainer(changed.gameObject.id).addChildAt(htmlText, 0);
|
|
153
155
|
this.texts[changed.gameObject.id] = {
|
|
154
156
|
text: htmlText,
|
|
@@ -172,6 +174,7 @@ let Text = class Text extends Renderer {
|
|
|
172
174
|
if (!this.validateAsyncId(changed.gameObject.id, asyncId))
|
|
173
175
|
return;
|
|
174
176
|
const component = this.texts[changed.gameObject.id].component;
|
|
177
|
+
text.style.fontFamily = fontFamily;
|
|
175
178
|
text.text = component.text;
|
|
176
179
|
this.setSize(changed);
|
|
177
180
|
}
|
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.22",
|
|
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.22",
|
|
23
|
+
"@eva/renderer-adapter": "2.0.1-beta.22",
|
|
24
|
+
"@eva/eva.js": "2.0.1-beta.22",
|
|
25
25
|
"pixi.js": "^8.8.1"
|
|
26
26
|
}
|
|
27
27
|
}
|