@eva/plugin-renderer-text 1.2.7 → 1.2.8-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.
- package/package.json +4 -4
- package/dist/miniprogram.js +0 -128
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/plugin-renderer-text",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8-fix.1",
|
|
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": "1.2.
|
|
23
|
-
"@eva/renderer-adapter": "1.2.
|
|
24
|
-
"@eva/eva.js": "1.2.
|
|
22
|
+
"@eva/plugin-renderer": "1.2.8-fix.1",
|
|
23
|
+
"@eva/renderer-adapter": "1.2.8-fix.1",
|
|
24
|
+
"@eva/eva.js": "1.2.8-fix.1",
|
|
25
25
|
"pixi.js": "^4.8.7"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/dist/miniprogram.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
import { __extends, __decorate, __awaiter, __generator } from 'tslib';
|
|
4
|
-
import { TextStyle } from '@eva/miniprogram-pixi';
|
|
5
|
-
import { Component, OBSERVER_TYPE, decorators } from '@eva/eva.js/dist/miniprogram';
|
|
6
|
-
import { type } from '@eva/inspector-decorator';
|
|
7
|
-
import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
|
|
8
|
-
import { Text as Text$4 } from '@eva/renderer-adapter/dist/miniprogram';
|
|
9
|
-
|
|
10
|
-
var Text$2 = function (_super) {
|
|
11
|
-
__extends(Text, _super);
|
|
12
|
-
|
|
13
|
-
function Text() {
|
|
14
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
15
|
-
|
|
16
|
-
_this.text = '';
|
|
17
|
-
_this.style = {};
|
|
18
|
-
return _this;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
Text.prototype.init = function (obj) {
|
|
22
|
-
var style = new TextStyle({
|
|
23
|
-
fontSize: 20
|
|
24
|
-
});
|
|
25
|
-
var newStyle = {};
|
|
26
|
-
|
|
27
|
-
for (var key in style) {
|
|
28
|
-
if (key.indexOf('_') === 0) {
|
|
29
|
-
newStyle[key.substring(1)] = style[key];
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
this.style = newStyle;
|
|
34
|
-
|
|
35
|
-
if (obj) {
|
|
36
|
-
this.text = obj.text;
|
|
37
|
-
|
|
38
|
-
_extends(this.style, obj.style);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
Text.componentName = 'Text';
|
|
43
|
-
|
|
44
|
-
__decorate([type('string')], Text.prototype, "text", void 0);
|
|
45
|
-
|
|
46
|
-
return Text;
|
|
47
|
-
}(Component);
|
|
48
|
-
|
|
49
|
-
var Text$3 = Text$2;
|
|
50
|
-
|
|
51
|
-
var Text = function (_super) {
|
|
52
|
-
__extends(Text, _super);
|
|
53
|
-
|
|
54
|
-
function Text() {
|
|
55
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
56
|
-
|
|
57
|
-
_this.name = 'Text';
|
|
58
|
-
_this.texts = {};
|
|
59
|
-
return _this;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
Text.prototype.init = function () {
|
|
63
|
-
this.renderSystem = this.game.getSystem(RendererSystem);
|
|
64
|
-
this.renderSystem.rendererManager.register(this);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
Text.prototype.componentChanged = function (changed) {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var component, text;
|
|
70
|
-
return __generator(this, function (_a) {
|
|
71
|
-
if (changed.componentName !== 'Text') return [2];
|
|
72
|
-
|
|
73
|
-
if (changed.type === OBSERVER_TYPE.ADD) {
|
|
74
|
-
component = changed.component;
|
|
75
|
-
text = new Text$4(component.text, component.style);
|
|
76
|
-
this.containerManager.getContainer(changed.gameObject.id).addChildAt(text, 0);
|
|
77
|
-
this.texts[changed.gameObject.id] = {
|
|
78
|
-
text: text,
|
|
79
|
-
component: changed.component
|
|
80
|
-
};
|
|
81
|
-
this.setSize(changed);
|
|
82
|
-
} else if (changed.type === OBSERVER_TYPE.REMOVE) {
|
|
83
|
-
this.containerManager.getContainer(changed.gameObject.id).removeChild(this.texts[changed.gameObject.id].text);
|
|
84
|
-
this.texts[changed.gameObject.id].text.destroy({
|
|
85
|
-
children: true
|
|
86
|
-
});
|
|
87
|
-
delete this.texts[changed.gameObject.id];
|
|
88
|
-
} else {
|
|
89
|
-
this.change(changed);
|
|
90
|
-
this.setSize(changed);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return [2];
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
Text.prototype.change = function (changed) {
|
|
99
|
-
var _a = this.texts[changed.gameObject.id],
|
|
100
|
-
text = _a.text,
|
|
101
|
-
component = _a.component;
|
|
102
|
-
|
|
103
|
-
if (changed.prop.prop[0] === 'text') {
|
|
104
|
-
text.text = component.text;
|
|
105
|
-
} else if (changed.prop.prop[0] === 'style') {
|
|
106
|
-
_extends(text.style, changed.component.style);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
Text.prototype.setSize = function (changed) {
|
|
111
|
-
var transform = changed.gameObject.transform;
|
|
112
|
-
if (!transform) return;
|
|
113
|
-
transform.size.width = this.texts[changed.gameObject.id].text.width;
|
|
114
|
-
transform.size.height = this.texts[changed.gameObject.id].text.height;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
Text.systemName = 'Text';
|
|
118
|
-
Text = __decorate([decorators.componentObserver({
|
|
119
|
-
Text: ['text', {
|
|
120
|
-
prop: ['style'],
|
|
121
|
-
deep: true
|
|
122
|
-
}]
|
|
123
|
-
})], Text);
|
|
124
|
-
return Text;
|
|
125
|
-
}(Renderer);
|
|
126
|
-
|
|
127
|
-
var Text$1 = Text;
|
|
128
|
-
export { Text$3 as Text, Text$1 as TextSystem };
|