@eva/plugin-renderer-text 1.1.1-fix.0 → 1.1.1-fix.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("pixi.js"),e=require("@eva/eva.js"),n=require("@eva/plugin-renderer"),r=require("@eva/renderer-adapter"),o=function(t,e){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("pixi.js"),e=require("@eva/eva.js"),n=require("@eva/plugin-renderer"),r=require("@eva/renderer-adapter"),o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},o(t,e)};function i(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,e,n,r){var o,i=arguments.length,s=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(i<3?o(s):i>3?o(e,n,s):o(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function a(t,e){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var c=function(n){function r(){var t=null!==n&&n.apply(this,arguments)||this;return t.text="",t.style={},t}return i(r,n),r.prototype.init=function(e){var n=new t.TextStyle({fontSize:20}),r={};for(var o in n)0===o.indexOf("_")&&(r[o.substring(1)]=n[o]);this.style=r,e&&(this.text=e.text,Object.assign(this.style,e.style))},r.componentName="Text",s([e.decorators.IDEProp],r.prototype,"text",void 0),s([e.decorators.IDEProp],r.prototype,"style",void 0),r}(e.Component),p=c,u=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Text",e.texts={},e}return i(o,t),o.prototype.init=function(){this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.componentChanged=function(t){return n=this,o=void 0,s=function(){var n,o;return a(this,(function(i){return"Text"!==t.componentName||(t.type===e.OBSERVER_TYPE.ADD?(n=t.component,o=new r.Text(n.text,n.style),this.containerManager.getContainer(t.gameObject.id).addChildAt(o,0),this.texts[t.gameObject.id]={text:o,component:t.component},this.setSize(t)):t.type===e.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]):(this.change(t),this.setSize(t))),[2]}))},new((i=void 0)||(i=Promise))((function(t,e){function r(t){try{c(s.next(t))}catch(t){e(t)}}function a(t){try{c(s.throw(t))}catch(t){e(t)}}function c(e){e.done?t(e.value):new i((function(t){t(e.value)})).then(r,a)}c((s=s.apply(n,o||[])).next())}));var n,o,i,s},o.prototype.change=function(t){var e=this.texts[t.gameObject.id],n=e.text,r=e.component;"text"===t.prop.prop[0]?n.text=r.text:"style"===t.prop.prop[0]&&Object.assign(n.style,t.component.style)},o.prototype.setSize=function(t){var e=t.gameObject.transform;e&&(e.size.width=this.texts[t.gameObject.id].text.width,e.size.height=this.texts[t.gameObject.id].text.height)},o.systemName="Text",o=s([e.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],o)}(n.Renderer);exports.Text=p,exports.TextSystem=u;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-text",
|
|
3
|
-
"version": "1.1.1-fix.
|
|
3
|
+
"version": "1.1.1-fix.1",
|
|
4
4
|
"description": "@eva/plugin-renderer-text",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/plugin-renderer-text.esm.js",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@eva/plugin-renderer": "1.1.1-fix.
|
|
22
|
-
"@eva/renderer-adapter": "1.1.1-fix.
|
|
23
|
-
"@eva/eva.js": "1.1.1-fix.
|
|
21
|
+
"@eva/plugin-renderer": "1.1.1-fix.1",
|
|
22
|
+
"@eva/renderer-adapter": "1.1.1-fix.1",
|
|
23
|
+
"@eva/eva.js": "1.1.1-fix.1",
|
|
24
24
|
"pixi.js": "^4.8.7"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('pixi.js'), require('@eva/eva.js'), require('@eva/plugin-renderer'), require('@eva/renderer-adapter')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'pixi.js', '@eva/eva.js', '@eva/plugin-renderer', '@eva/renderer-adapter'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.EVA = global.EVA || {}, global.EVA.plugin = global.EVA.plugin || {}, global.EVA.plugin.renderer = global.EVA.plugin.renderer || {}, global.EVA.plugin.renderer.text = {}), global.PIXI, global.EVA, global.EVA.plugin.renderer, global.EVA.rendererAdapter));
|
|
5
|
-
}(this, (function (exports, pixi_js, eva_js, pluginRenderer, rendererAdapter) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/*! *****************************************************************************
|
|
8
|
-
Copyright (c) Microsoft Corporation.
|
|
9
|
-
|
|
10
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
-
purpose with or without fee is hereby granted.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
-
***************************************************************************** */
|
|
21
|
-
/* global Reflect, Promise */
|
|
22
|
-
|
|
23
|
-
var extendStatics = function(d, b) {
|
|
24
|
-
extendStatics = Object.setPrototypeOf ||
|
|
25
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
26
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
27
|
-
return extendStatics(d, b);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function __extends(d, b) {
|
|
31
|
-
extendStatics(d, b);
|
|
32
|
-
function __() { this.constructor = d; }
|
|
33
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function __decorate(decorators, target, key, desc) {
|
|
37
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
38
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
39
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
40
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
44
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
45
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
46
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
47
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
48
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
49
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function __generator(thisArg, body) {
|
|
54
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
55
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
56
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
57
|
-
function step(op) {
|
|
58
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
59
|
-
while (_) try {
|
|
60
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
61
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
62
|
-
switch (op[0]) {
|
|
63
|
-
case 0: case 1: t = op; break;
|
|
64
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
65
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
66
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
67
|
-
default:
|
|
68
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
69
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
70
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
71
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
72
|
-
if (t[2]) _.ops.pop();
|
|
73
|
-
_.trys.pop(); continue;
|
|
74
|
-
}
|
|
75
|
-
op = body.call(thisArg, _);
|
|
76
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
77
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
var Text$2 = (function (_super) {
|
|
82
|
-
__extends(Text, _super);
|
|
83
|
-
function Text() {
|
|
84
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
85
|
-
_this.text = '';
|
|
86
|
-
_this.style = {};
|
|
87
|
-
return _this;
|
|
88
|
-
}
|
|
89
|
-
Text.prototype.init = function (obj) {
|
|
90
|
-
var style = new pixi_js.TextStyle({
|
|
91
|
-
fontSize: 20,
|
|
92
|
-
});
|
|
93
|
-
var newStyle = {};
|
|
94
|
-
for (var key in style) {
|
|
95
|
-
if (key.indexOf('_') === 0) {
|
|
96
|
-
newStyle[key.substring(1)] = style[key];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
this.style = newStyle;
|
|
100
|
-
if (obj) {
|
|
101
|
-
this.text = obj.text;
|
|
102
|
-
Object.assign(this.style, obj.style);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
Text.componentName = 'Text';
|
|
106
|
-
__decorate([
|
|
107
|
-
eva_js.decorators.IDEProp
|
|
108
|
-
], Text.prototype, "text", void 0);
|
|
109
|
-
__decorate([
|
|
110
|
-
eva_js.decorators.IDEProp
|
|
111
|
-
], Text.prototype, "style", void 0);
|
|
112
|
-
return Text;
|
|
113
|
-
}(eva_js.Component));
|
|
114
|
-
var Text$3 = Text$2;
|
|
115
|
-
|
|
116
|
-
var Text = (function (_super) {
|
|
117
|
-
__extends(Text, _super);
|
|
118
|
-
function Text() {
|
|
119
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
120
|
-
_this.name = 'Text';
|
|
121
|
-
_this.texts = {};
|
|
122
|
-
return _this;
|
|
123
|
-
}
|
|
124
|
-
Text.prototype.init = function () {
|
|
125
|
-
this.renderSystem = this.game.getSystem(pluginRenderer.RendererSystem);
|
|
126
|
-
this.renderSystem.rendererManager.register(this);
|
|
127
|
-
};
|
|
128
|
-
Text.prototype.componentChanged = function (changed) {
|
|
129
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
-
var component, text;
|
|
131
|
-
return __generator(this, function (_a) {
|
|
132
|
-
if (changed.componentName !== 'Text')
|
|
133
|
-
return [2];
|
|
134
|
-
if (changed.type === eva_js.OBSERVER_TYPE.ADD) {
|
|
135
|
-
component = changed.component;
|
|
136
|
-
text = new rendererAdapter.Text(component.text, component.style);
|
|
137
|
-
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
138
|
-
this.texts[changed.gameObject.id] = {
|
|
139
|
-
text: text,
|
|
140
|
-
component: changed.component,
|
|
141
|
-
};
|
|
142
|
-
this.setSize(changed);
|
|
143
|
-
}
|
|
144
|
-
else if (changed.type === eva_js.OBSERVER_TYPE.REMOVE) {
|
|
145
|
-
this.containerManager.getContainer(changed.gameObject.id).removeChild(this.texts[changed.gameObject.id].text);
|
|
146
|
-
this.texts[changed.gameObject.id].text.destroy({ children: true });
|
|
147
|
-
delete this.texts[changed.gameObject.id];
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
this.change(changed);
|
|
151
|
-
this.setSize(changed);
|
|
152
|
-
}
|
|
153
|
-
return [2];
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
Text.prototype.change = function (changed) {
|
|
158
|
-
var _a = this.texts[changed.gameObject.id], text = _a.text, component = _a.component;
|
|
159
|
-
if (changed.prop.prop[0] === 'text') {
|
|
160
|
-
text.text = component.text;
|
|
161
|
-
}
|
|
162
|
-
else if (changed.prop.prop[0] === 'style') {
|
|
163
|
-
Object.assign(text.style, changed.component.style);
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
Text.prototype.setSize = function (changed) {
|
|
167
|
-
var transform = changed.gameObject.transform;
|
|
168
|
-
if (!transform)
|
|
169
|
-
return;
|
|
170
|
-
transform.size.width = this.texts[changed.gameObject.id].text.width;
|
|
171
|
-
transform.size.height = this.texts[changed.gameObject.id].text.height;
|
|
172
|
-
};
|
|
173
|
-
Text.systemName = 'Text';
|
|
174
|
-
Text = __decorate([
|
|
175
|
-
eva_js.decorators.componentObserver({
|
|
176
|
-
Text: ['text', { prop: ['style'], deep: true }],
|
|
177
|
-
})
|
|
178
|
-
], Text);
|
|
179
|
-
return Text;
|
|
180
|
-
}(pluginRenderer.Renderer));
|
|
181
|
-
var Text$1 = Text;
|
|
182
|
-
|
|
183
|
-
exports.Text = Text$3;
|
|
184
|
-
exports.TextSystem = Text$1;
|
|
185
|
-
|
|
186
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
187
|
-
|
|
188
|
-
})));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e,t;e=this,t=function(e,t,n,r,o){"use strict";var i=function(e,t){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function a(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function s(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function c(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function s(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function p(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var u=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.text="",t.style={},t}return a(r,e),r.prototype.init=function(e){var n=new t.TextStyle({fontSize:20}),r={};for(var o in n)0===o.indexOf("_")&&(r[o.substring(1)]=n[o]);this.style=r,e&&(this.text=e.text,Object.assign(this.style,e.style))},r.componentName="Text",s([n.decorators.IDEProp],r.prototype,"text",void 0),s([n.decorators.IDEProp],r.prototype,"style",void 0),r}(n.Component),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Text",t.texts={},t}return a(t,e),t.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},t.prototype.componentChanged=function(e){return c(this,void 0,void 0,(function(){var t,r;return p(this,(function(i){return"Text"!==e.componentName||(e.type===n.OBSERVER_TYPE.ADD?(t=e.component,r=new o.Text(t.text,t.style),this.containerManager.getContainer(e.gameObject.id).addChildAt(r,0),this.texts[e.gameObject.id]={text:r,component:e.component},this.setSize(e)):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]):(this.change(e),this.setSize(e))),[2]}))}))},t.prototype.change=function(e){var t=this.texts[e.gameObject.id],n=t.text,r=t.component;"text"===e.prop.prop[0]?n.text=r.text:"style"===e.prop.prop[0]&&Object.assign(n.style,e.component.style)},t.prototype.setSize=function(e){var t=e.gameObject.transform;t&&(t.size.width=this.texts[e.gameObject.id].text.width,t.size.height=this.texts[e.gameObject.id].text.height)},t.systemName="Text",t=s([n.decorators.componentObserver({Text:["text",{prop:["style"],deep:!0}]})],t)}(r.Renderer);e.Text=u,e.TextSystem=l,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("pixi.js"),require("@eva/eva.js"),require("@eva/plugin-renderer"),require("@eva/renderer-adapter")):"function"==typeof define&&define.amd?define(["exports","pixi.js","@eva/eva.js","@eva/plugin-renderer","@eva/renderer-adapter"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).EVA=e.EVA||{},e.EVA.plugin=e.EVA.plugin||{},e.EVA.plugin.renderer=e.EVA.plugin.renderer||{},e.EVA.plugin.renderer.text={}),e.PIXI,e.EVA,e.EVA.plugin.renderer,e.EVA.rendererAdapter);
|
package/dist/miniprogram.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { __extends, __decorate, __awaiter, __generator } from 'tslib';
|
|
2
|
-
import { TextStyle } from '@eva/miniprogram-pixi';
|
|
3
|
-
import { Component, OBSERVER_TYPE, decorators } from '@eva/eva.js/dist/miniprogram';
|
|
4
|
-
import { type } from '@eva/inspector-decorator/dist/miniprogram';
|
|
5
|
-
import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
|
|
6
|
-
import { Text as Text$4 } from '@eva/renderer-adapter/dist/miniprogram';
|
|
7
|
-
|
|
8
|
-
var Text$2 = (function (_super) {
|
|
9
|
-
__extends(Text, _super);
|
|
10
|
-
function Text() {
|
|
11
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
12
|
-
_this.text = '';
|
|
13
|
-
_this.style = {};
|
|
14
|
-
return _this;
|
|
15
|
-
}
|
|
16
|
-
Text.prototype.init = function (obj) {
|
|
17
|
-
var style = new TextStyle({
|
|
18
|
-
fontSize: 20,
|
|
19
|
-
});
|
|
20
|
-
var newStyle = {};
|
|
21
|
-
for (var key in style) {
|
|
22
|
-
if (key.indexOf('_') === 0) {
|
|
23
|
-
newStyle[key.substring(1)] = style[key];
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
this.style = newStyle;
|
|
27
|
-
if (obj) {
|
|
28
|
-
this.text = obj.text;
|
|
29
|
-
Object.assign(this.style, obj.style);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
Text.componentName = 'Text';
|
|
33
|
-
__decorate([
|
|
34
|
-
type('string')
|
|
35
|
-
], Text.prototype, "text", void 0);
|
|
36
|
-
return Text;
|
|
37
|
-
}(Component));
|
|
38
|
-
var Text$3 = Text$2;
|
|
39
|
-
|
|
40
|
-
var Text = (function (_super) {
|
|
41
|
-
__extends(Text, _super);
|
|
42
|
-
function Text() {
|
|
43
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
44
|
-
_this.name = 'Text';
|
|
45
|
-
_this.texts = {};
|
|
46
|
-
return _this;
|
|
47
|
-
}
|
|
48
|
-
Text.prototype.init = function () {
|
|
49
|
-
this.renderSystem = this.game.getSystem(RendererSystem);
|
|
50
|
-
this.renderSystem.rendererManager.register(this);
|
|
51
|
-
};
|
|
52
|
-
Text.prototype.componentChanged = function (changed) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var component, text;
|
|
55
|
-
return __generator(this, function (_a) {
|
|
56
|
-
if (changed.componentName !== 'Text')
|
|
57
|
-
return [2];
|
|
58
|
-
if (changed.type === OBSERVER_TYPE.ADD) {
|
|
59
|
-
component = changed.component;
|
|
60
|
-
text = new Text$4(component.text, component.style);
|
|
61
|
-
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
62
|
-
this.texts[changed.gameObject.id] = {
|
|
63
|
-
text: text,
|
|
64
|
-
component: changed.component,
|
|
65
|
-
};
|
|
66
|
-
this.setSize(changed);
|
|
67
|
-
}
|
|
68
|
-
else if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
69
|
-
this.containerManager.getContainer(changed.gameObject.id).removeChild(this.texts[changed.gameObject.id].text);
|
|
70
|
-
this.texts[changed.gameObject.id].text.destroy({ children: true });
|
|
71
|
-
delete this.texts[changed.gameObject.id];
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
this.change(changed);
|
|
75
|
-
this.setSize(changed);
|
|
76
|
-
}
|
|
77
|
-
return [2];
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
Text.prototype.change = function (changed) {
|
|
82
|
-
var _a = this.texts[changed.gameObject.id], text = _a.text, component = _a.component;
|
|
83
|
-
if (changed.prop.prop[0] === 'text') {
|
|
84
|
-
text.text = component.text;
|
|
85
|
-
}
|
|
86
|
-
else if (changed.prop.prop[0] === 'style') {
|
|
87
|
-
Object.assign(text.style, changed.component.style);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
Text.prototype.setSize = function (changed) {
|
|
91
|
-
var transform = changed.gameObject.transform;
|
|
92
|
-
if (!transform)
|
|
93
|
-
return;
|
|
94
|
-
transform.size.width = this.texts[changed.gameObject.id].text.width;
|
|
95
|
-
transform.size.height = this.texts[changed.gameObject.id].text.height;
|
|
96
|
-
};
|
|
97
|
-
Text.systemName = 'Text';
|
|
98
|
-
Text = __decorate([
|
|
99
|
-
decorators.componentObserver({
|
|
100
|
-
Text: ['text', { prop: ['style'], deep: true }],
|
|
101
|
-
})
|
|
102
|
-
], Text);
|
|
103
|
-
return Text;
|
|
104
|
-
}(Renderer));
|
|
105
|
-
var Text$1 = Text;
|
|
106
|
-
|
|
107
|
-
export { Text$3 as Text, Text$1 as TextSystem };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Component } from '@eva/eva.js';
|
|
2
|
-
import { ComponentChanged } from '@eva/eva.js';
|
|
3
|
-
import { ContainerManager } from '@eva/plugin-renderer';
|
|
4
|
-
import { Renderer } from '@eva/plugin-renderer';
|
|
5
|
-
import { RendererManager } from '@eva/plugin-renderer';
|
|
6
|
-
import { RendererSystem } from '@eva/plugin-renderer';
|
|
7
|
-
import { Text as Text_3 } from '@eva/renderer-adapter';
|
|
8
|
-
|
|
9
|
-
declare class Text_2 extends Component<TextParams> {
|
|
10
|
-
static componentName: string;
|
|
11
|
-
text: string;
|
|
12
|
-
style: TextParams['style'];
|
|
13
|
-
init(obj?: TextParams): void;
|
|
14
|
-
}
|
|
15
|
-
export { Text_2 as Text }
|
|
16
|
-
|
|
17
|
-
export declare interface TextParams {
|
|
18
|
-
text: string;
|
|
19
|
-
style?: {
|
|
20
|
-
align?: string;
|
|
21
|
-
breakWords?: boolean;
|
|
22
|
-
dropShadow?: boolean;
|
|
23
|
-
dropShadowAlpha?: number;
|
|
24
|
-
dropShadowAngle?: number;
|
|
25
|
-
dropShadowBlur?: number;
|
|
26
|
-
dropShadowColor?: string | number;
|
|
27
|
-
dropShadowDistance?: number;
|
|
28
|
-
fill?: string | string[] | number | number[] | CanvasGradient | CanvasPattern;
|
|
29
|
-
fillGradientType?: number;
|
|
30
|
-
fillGradientStops?: number[];
|
|
31
|
-
fontFamily?: string | string[];
|
|
32
|
-
fontSize?: number | string;
|
|
33
|
-
fontStyle?: string;
|
|
34
|
-
fontVariant?: string;
|
|
35
|
-
fontWeight?: string;
|
|
36
|
-
letterSpacing?: number;
|
|
37
|
-
lineHeight?: number;
|
|
38
|
-
lineJoin?: string;
|
|
39
|
-
miterLimit?: number;
|
|
40
|
-
padding?: number;
|
|
41
|
-
stroke?: string | number;
|
|
42
|
-
strokeThickness?: number;
|
|
43
|
-
textBaseline?: string;
|
|
44
|
-
trim?: boolean;
|
|
45
|
-
whiteSpace?: string;
|
|
46
|
-
wordWrap?: boolean;
|
|
47
|
-
wordWrapWidth?: number;
|
|
48
|
-
leading?: number;
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export declare class TextSystem extends Renderer {
|
|
53
|
-
static systemName: string;
|
|
54
|
-
name: string;
|
|
55
|
-
texts: {
|
|
56
|
-
[propName: number]: {
|
|
57
|
-
text: Text_3;
|
|
58
|
-
component: Text_2;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
renderSystem: RendererSystem;
|
|
62
|
-
rendererManager: RendererManager;
|
|
63
|
-
containerManager: ContainerManager;
|
|
64
|
-
init(): void;
|
|
65
|
-
componentChanged(changed: ComponentChanged): Promise<void>;
|
|
66
|
-
change(changed: ComponentChanged): void;
|
|
67
|
-
setSize(changed: ComponentChanged): void;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { }
|