@eva/renderer-adapter 1.3.0-alpha.1 → 2.0.0-beta.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,100 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
this.EVA.rendererAdapter = function (exports, pixi_js) {
|
|
1
|
+
window.EVA = window.EVA || {};
|
|
2
|
+
var _EVA_IIFE_rendererAdapter = function (exports, pixi_js) {
|
|
4
3
|
'use strict';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
_extendStatics = Object.setPrototypeOf || {
|
|
4
|
+
var extendStatics = function (d, b) {
|
|
5
|
+
extendStatics = Object.setPrototypeOf || {
|
|
8
6
|
__proto__: []
|
|
9
7
|
} instanceof Array && function (d, b) {
|
|
10
8
|
d.__proto__ = b;
|
|
11
9
|
} || function (d, b) {
|
|
12
|
-
for (var p in b)
|
|
13
|
-
if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
14
|
-
}
|
|
10
|
+
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
|
15
11
|
};
|
|
16
|
-
|
|
17
|
-
return _extendStatics(d, b);
|
|
12
|
+
return extendStatics(d, b);
|
|
18
13
|
};
|
|
19
|
-
|
|
20
14
|
function __extends(d, b) {
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
extendStatics(d, b);
|
|
23
16
|
function __() {
|
|
24
17
|
this.constructor = d;
|
|
25
18
|
}
|
|
26
|
-
|
|
27
19
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
var Application = function (_super) {
|
|
31
|
-
__extends(Application, _super);
|
|
32
|
-
|
|
33
|
-
function Application(params) {
|
|
34
|
-
var _this = this;
|
|
35
|
-
|
|
36
|
-
params.autoStart = false;
|
|
37
|
-
_this = _super.call(this, params) || this;
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return Application;
|
|
42
|
-
}(pixi_js.Application);
|
|
43
|
-
|
|
44
|
-
var Application$1 = Application;
|
|
45
|
-
|
|
46
21
|
var Container = function (_super) {
|
|
47
22
|
__extends(Container, _super);
|
|
48
|
-
|
|
49
23
|
function Container() {
|
|
50
24
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
51
25
|
}
|
|
52
|
-
|
|
53
26
|
return Container;
|
|
54
27
|
}(pixi_js.Container);
|
|
55
|
-
|
|
56
28
|
var Container$1 = Container;
|
|
57
|
-
|
|
58
29
|
var Graphics = function (_super) {
|
|
59
30
|
__extends(Graphics, _super);
|
|
60
|
-
|
|
61
31
|
function Graphics() {
|
|
62
32
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
63
33
|
}
|
|
64
|
-
|
|
65
34
|
return Graphics;
|
|
66
35
|
}(pixi_js.Graphics);
|
|
67
|
-
|
|
68
36
|
var Graphics$1 = Graphics;
|
|
69
|
-
|
|
70
37
|
var NinePatch = function (_super) {
|
|
71
38
|
__extends(NinePatch, _super);
|
|
72
|
-
|
|
73
39
|
function NinePatch(img, leftWidth, topHeight, rightWidth, bottomHeight) {
|
|
74
40
|
var _this = this;
|
|
75
|
-
|
|
76
41
|
var texture;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
texture = pixi_js.Texture.fromFrame(img);
|
|
42
|
+
if (img instanceof pixi_js.Texture) {
|
|
43
|
+
texture = img;
|
|
80
44
|
} else {
|
|
81
45
|
texture = pixi_js.Texture.from(img);
|
|
82
46
|
}
|
|
83
|
-
|
|
84
|
-
|
|
47
|
+
_this = _super.call(this, {
|
|
48
|
+
texture: texture,
|
|
49
|
+
leftWidth: leftWidth,
|
|
50
|
+
topHeight: topHeight,
|
|
51
|
+
rightWidth: rightWidth,
|
|
52
|
+
bottomHeight: bottomHeight
|
|
53
|
+
}) || this;
|
|
85
54
|
return _this;
|
|
86
55
|
}
|
|
87
|
-
|
|
88
56
|
return NinePatch;
|
|
89
|
-
}(pixi_js.
|
|
90
|
-
|
|
57
|
+
}(pixi_js.NineSliceSprite);
|
|
91
58
|
var NinePatch$1 = NinePatch;
|
|
92
|
-
|
|
93
59
|
var Sprite = function () {
|
|
94
60
|
function Sprite(image) {
|
|
95
61
|
this._image = null;
|
|
96
62
|
this._image = image;
|
|
97
|
-
|
|
98
63
|
if (image) {
|
|
99
64
|
if (image instanceof HTMLImageElement) {
|
|
100
65
|
this.sprite = pixi_js.Sprite.from(image);
|
|
@@ -105,23 +70,20 @@ this.EVA.rendererAdapter = function (exports, pixi_js) {
|
|
|
105
70
|
this.sprite = new pixi_js.Sprite();
|
|
106
71
|
}
|
|
107
72
|
}
|
|
108
|
-
|
|
109
73
|
Object.defineProperty(Sprite.prototype, "image", {
|
|
110
|
-
get: function
|
|
74
|
+
get: function () {
|
|
111
75
|
return this._image;
|
|
112
76
|
},
|
|
113
|
-
set: function
|
|
77
|
+
set: function (val) {
|
|
114
78
|
if (this._image === val) {
|
|
115
79
|
return;
|
|
116
80
|
}
|
|
117
|
-
|
|
118
81
|
if (val instanceof HTMLImageElement) {
|
|
119
82
|
this.sprite.texture && this.sprite.texture.destroy(false);
|
|
120
83
|
this.sprite.texture = pixi_js.Texture.from(val);
|
|
121
84
|
} else if (val instanceof pixi_js.Texture) {
|
|
122
85
|
this.sprite.texture = val;
|
|
123
86
|
}
|
|
124
|
-
|
|
125
87
|
this._image = val;
|
|
126
88
|
},
|
|
127
89
|
enumerable: false,
|
|
@@ -129,36 +91,29 @@ this.EVA.rendererAdapter = function (exports, pixi_js) {
|
|
|
129
91
|
});
|
|
130
92
|
return Sprite;
|
|
131
93
|
}();
|
|
132
|
-
|
|
133
94
|
var Sprite$1 = Sprite;
|
|
134
|
-
|
|
135
95
|
var SpriteAnimation = function () {
|
|
136
96
|
function SpriteAnimation(_a) {
|
|
137
97
|
var frames = _a.frames;
|
|
138
|
-
this.animatedSprite = new pixi_js.
|
|
98
|
+
this.animatedSprite = new pixi_js.AnimatedSprite(frames);
|
|
139
99
|
}
|
|
140
|
-
|
|
141
100
|
SpriteAnimation.prototype.play = function () {
|
|
142
101
|
this.animatedSprite.play();
|
|
143
102
|
};
|
|
144
|
-
|
|
145
103
|
SpriteAnimation.prototype.stop = function () {
|
|
146
104
|
this.animatedSprite.stop();
|
|
147
105
|
};
|
|
148
|
-
|
|
149
106
|
SpriteAnimation.prototype.gotoAndPlay = function (frameNumber) {
|
|
150
107
|
this.animatedSprite.gotoAndPlay(frameNumber);
|
|
151
108
|
};
|
|
152
|
-
|
|
153
109
|
SpriteAnimation.prototype.gotoAndStop = function (frameNumber) {
|
|
154
110
|
this.animatedSprite.gotoAndStop(frameNumber);
|
|
155
111
|
};
|
|
156
|
-
|
|
157
112
|
Object.defineProperty(SpriteAnimation.prototype, "speed", {
|
|
158
|
-
get: function
|
|
113
|
+
get: function () {
|
|
159
114
|
return this.animatedSprite.animationSpeed;
|
|
160
115
|
},
|
|
161
|
-
set: function
|
|
116
|
+
set: function (val) {
|
|
162
117
|
this.animatedSprite.animationSpeed = val;
|
|
163
118
|
},
|
|
164
119
|
enumerable: false,
|
|
@@ -166,53 +121,81 @@ this.EVA.rendererAdapter = function (exports, pixi_js) {
|
|
|
166
121
|
});
|
|
167
122
|
return SpriteAnimation;
|
|
168
123
|
}();
|
|
169
|
-
|
|
170
124
|
var SpriteAnimation$1 = SpriteAnimation;
|
|
171
|
-
|
|
172
125
|
var Text = function (_super) {
|
|
173
126
|
__extends(Text, _super);
|
|
174
|
-
|
|
175
127
|
function Text(text, style) {
|
|
176
|
-
|
|
128
|
+
var _this = this;
|
|
129
|
+
if (style.strokeThickness) {
|
|
130
|
+
var color = style.stroke;
|
|
131
|
+
style.stroke = {
|
|
132
|
+
color: color,
|
|
133
|
+
width: style.strokeThickness
|
|
134
|
+
};
|
|
135
|
+
delete style['strokeThickness'];
|
|
136
|
+
}
|
|
137
|
+
if (Array.isArray(style.fill)) {
|
|
138
|
+
console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.');
|
|
139
|
+
style.fill = style.fill[0];
|
|
140
|
+
}
|
|
141
|
+
if (Array.isArray(style.fillGradientStops)) {
|
|
142
|
+
var fontSize = void 0;
|
|
143
|
+
if (style.fontSize == null) {
|
|
144
|
+
style.fontSize = pixi_js.TextStyle.defaultTextStyle.fontSize;
|
|
145
|
+
} else if (typeof style.fontSize === 'string') {
|
|
146
|
+
fontSize = parseInt(style.fontSize, 10);
|
|
147
|
+
} else {
|
|
148
|
+
fontSize = style.fontSize;
|
|
149
|
+
}
|
|
150
|
+
var gradientFill_1 = new pixi_js.FillGradient(0, 0, 0, fontSize * 1.7);
|
|
151
|
+
var fills_1 = style.fillGradientStops.map(function (color) {
|
|
152
|
+
return pixi_js.Color.shared.setValue(color).toNumber();
|
|
153
|
+
});
|
|
154
|
+
fills_1.forEach(function (number, index) {
|
|
155
|
+
var ratio = index / (fills_1.length - 1);
|
|
156
|
+
gradientFill_1.addColorStop(ratio, number);
|
|
157
|
+
});
|
|
158
|
+
style.fill = {
|
|
159
|
+
fill: gradientFill_1
|
|
160
|
+
};
|
|
161
|
+
delete style['fillGradientStops'];
|
|
162
|
+
}
|
|
163
|
+
_this = _super.call(this, {
|
|
164
|
+
text: text,
|
|
165
|
+
style: style
|
|
166
|
+
}) || this;
|
|
167
|
+
return _this;
|
|
177
168
|
}
|
|
178
|
-
|
|
179
169
|
return Text;
|
|
180
170
|
}(pixi_js.Text);
|
|
181
|
-
|
|
182
171
|
var Text$1 = Text;
|
|
183
|
-
var PIXITilingSprite = pixi_js.extras.TilingSprite;
|
|
184
|
-
|
|
185
172
|
var TilingSprite = function () {
|
|
186
173
|
function TilingSprite(image) {
|
|
187
174
|
this._image = null;
|
|
188
175
|
this._image = image;
|
|
189
|
-
|
|
190
176
|
if (image) {
|
|
191
177
|
if (image instanceof HTMLImageElement) {
|
|
192
|
-
this.tilingSprite = new
|
|
178
|
+
this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.from(image));
|
|
193
179
|
} else if (image instanceof pixi_js.Texture) {
|
|
194
|
-
this.tilingSprite = new
|
|
180
|
+
this.tilingSprite = new pixi_js.TilingSprite(image);
|
|
195
181
|
}
|
|
196
182
|
} else {
|
|
197
|
-
this.tilingSprite = new
|
|
183
|
+
this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.EMPTY);
|
|
198
184
|
}
|
|
199
185
|
}
|
|
200
|
-
|
|
201
186
|
Object.defineProperty(TilingSprite.prototype, "image", {
|
|
202
|
-
get: function
|
|
187
|
+
get: function () {
|
|
203
188
|
return this._image;
|
|
204
189
|
},
|
|
205
|
-
set: function
|
|
190
|
+
set: function (val) {
|
|
206
191
|
if (this._image === val) {
|
|
207
192
|
return;
|
|
208
193
|
}
|
|
209
|
-
|
|
210
194
|
if (val instanceof HTMLImageElement) {
|
|
211
195
|
this.tilingSprite.texture = pixi_js.Texture.from(val);
|
|
212
196
|
} else if (val instanceof pixi_js.Texture) {
|
|
213
197
|
this.tilingSprite.texture = val;
|
|
214
198
|
}
|
|
215
|
-
|
|
216
199
|
this._image = val;
|
|
217
200
|
},
|
|
218
201
|
enumerable: false,
|
|
@@ -220,9 +203,8 @@ this.EVA.rendererAdapter = function (exports, pixi_js) {
|
|
|
220
203
|
});
|
|
221
204
|
return TilingSprite;
|
|
222
205
|
}();
|
|
223
|
-
|
|
224
206
|
var TilingSprite$1 = TilingSprite;
|
|
225
|
-
exports.Application = Application
|
|
207
|
+
exports.Application = pixi_js.Application;
|
|
226
208
|
exports.Container = Container$1;
|
|
227
209
|
exports.Graphics = Graphics$1;
|
|
228
210
|
exports.NinePatch = NinePatch$1;
|
|
@@ -235,3 +217,4 @@ this.EVA.rendererAdapter = function (exports, pixi_js) {
|
|
|
235
217
|
});
|
|
236
218
|
return exports;
|
|
237
219
|
}({}, PIXI);
|
|
220
|
+
window.EVA.rendererAdapter = window.EVA.rendererAdapter || _EVA_IIFE_rendererAdapter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
window.EVA=window.EVA||{};var _EVA_IIFE_rendererAdapter=function(t,e){"use strict";var i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},i(t,e)};function n(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(e.Container),o=r,a=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return n(e,t),e}(e.Graphics),s=a,p=function(t){function i(i,n,r,o,a){var s;return s=i instanceof e.Texture?i:e.Texture.from(i),t.call(this,{texture:s,leftWidth:n,topHeight:r,rightWidth:o,bottomHeight:a})||this}return n(i,t),i}(e.NineSliceSprite),u=function(){function t(t){this._image=null,this._image=t,t?t instanceof HTMLImageElement?this.sprite=e.Sprite.from(t):t instanceof e.Texture&&(this.sprite=new e.Sprite(t)):this.sprite=new e.Sprite}return Object.defineProperty(t.prototype,"image",{get:function(){return this._image},set:function(t){this._image!==t&&(t instanceof HTMLImageElement?(this.sprite.texture&&this.sprite.texture.destroy(!1),this.sprite.texture=e.Texture.from(t)):t instanceof e.Texture&&(this.sprite.texture=t),this._image=t)},enumerable:!1,configurable:!0}),t}(),l=function(){function t(t){var i=t.frames;this.animatedSprite=new e.AnimatedSprite(i)}return t.prototype.play=function(){this.animatedSprite.play()},t.prototype.stop=function(){this.animatedSprite.stop()},t.prototype.gotoAndPlay=function(t){this.animatedSprite.gotoAndPlay(t)},t.prototype.gotoAndStop=function(t){this.animatedSprite.gotoAndStop(t)},Object.defineProperty(t.prototype,"speed",{get:function(){return this.animatedSprite.animationSpeed},set:function(t){this.animatedSprite.animationSpeed=t},enumerable:!1,configurable:!0}),t}(),f=function(t){function i(i,n){if(n.strokeThickness){var r=n.stroke;n.stroke={color:r,width:n.strokeThickness},delete n.strokeThickness}if(Array.isArray(n.fill)&&(console.warn("Eva.js Deprecation Warning: fill array is not supported in Eva.js v2."),n.fill=n.fill[0]),Array.isArray(n.fillGradientStops)){var o=void 0;null==n.fontSize?n.fontSize=e.TextStyle.defaultTextStyle.fontSize:o="string"==typeof n.fontSize?parseInt(n.fontSize,10):n.fontSize;var a=new e.FillGradient(0,0,0,1.7*o),s=n.fillGradientStops.map((function(t){return e.Color.shared.setValue(t).toNumber()}));s.forEach((function(t,e){var i=e/(s.length-1);a.addColorStop(i,t)})),n.fill={fill:a},delete n.fillGradientStops}return t.call(this,{text:i,style:n})||this}return n(i,t),i}(e.Text),c=function(){function t(t){this._image=null,this._image=t,t?t instanceof HTMLImageElement?this.tilingSprite=new e.TilingSprite(e.Texture.from(t)):t instanceof e.Texture&&(this.tilingSprite=new e.TilingSprite(t)):this.tilingSprite=new e.TilingSprite(e.Texture.EMPTY)}return Object.defineProperty(t.prototype,"image",{get:function(){return this._image},set:function(t){this._image!==t&&(t instanceof HTMLImageElement?this.tilingSprite.texture=e.Texture.from(t):t instanceof e.Texture&&(this.tilingSprite.texture=t),this._image=t)},enumerable:!1,configurable:!0}),t}();return t.Application=e.Application,t.Container=o,t.Graphics=s,t.NinePatch=p,t.Sprite=u,t.SpriteAnimation=l,t.Text=f,t.TilingSprite=c,Object.defineProperty(t,"__esModule",{value:!0}),t}({},PIXI);window.EVA.rendererAdapter=window.EVA.rendererAdapter||_EVA_IIFE_rendererAdapter;
|
|
@@ -33,18 +33,6 @@ function __extends(d, b) {
|
|
|
33
33
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
var Application = (function (_super) {
|
|
37
|
-
__extends(Application, _super);
|
|
38
|
-
function Application(params) {
|
|
39
|
-
var _this = this;
|
|
40
|
-
params.autoStart = false;
|
|
41
|
-
_this = _super.call(this, params) || this;
|
|
42
|
-
return _this;
|
|
43
|
-
}
|
|
44
|
-
return Application;
|
|
45
|
-
}(pixi_js.Application));
|
|
46
|
-
var Application$1 = Application;
|
|
47
|
-
|
|
48
36
|
var Container = (function (_super) {
|
|
49
37
|
__extends(Container, _super);
|
|
50
38
|
function Container() {
|
|
@@ -68,17 +56,23 @@ var NinePatch = (function (_super) {
|
|
|
68
56
|
function NinePatch(img, leftWidth, topHeight, rightWidth, bottomHeight) {
|
|
69
57
|
var _this = this;
|
|
70
58
|
var texture;
|
|
71
|
-
if (img
|
|
72
|
-
texture =
|
|
59
|
+
if (img instanceof pixi_js.Texture) {
|
|
60
|
+
texture = img;
|
|
73
61
|
}
|
|
74
62
|
else {
|
|
75
63
|
texture = pixi_js.Texture.from(img);
|
|
76
64
|
}
|
|
77
|
-
_this = _super.call(this,
|
|
65
|
+
_this = _super.call(this, {
|
|
66
|
+
texture: texture,
|
|
67
|
+
leftWidth: leftWidth,
|
|
68
|
+
topHeight: topHeight,
|
|
69
|
+
rightWidth: rightWidth,
|
|
70
|
+
bottomHeight: bottomHeight,
|
|
71
|
+
}) || this;
|
|
78
72
|
return _this;
|
|
79
73
|
}
|
|
80
74
|
return NinePatch;
|
|
81
|
-
}(pixi_js.
|
|
75
|
+
}(pixi_js.NineSliceSprite));
|
|
82
76
|
var NinePatch$1 = NinePatch;
|
|
83
77
|
|
|
84
78
|
var Sprite = (function () {
|
|
@@ -124,7 +118,7 @@ var Sprite$1 = Sprite;
|
|
|
124
118
|
var SpriteAnimation = (function () {
|
|
125
119
|
function SpriteAnimation(_a) {
|
|
126
120
|
var frames = _a.frames;
|
|
127
|
-
this.animatedSprite = new pixi_js.
|
|
121
|
+
this.animatedSprite = new pixi_js.AnimatedSprite(frames);
|
|
128
122
|
}
|
|
129
123
|
SpriteAnimation.prototype.play = function () {
|
|
130
124
|
this.animatedSprite.play();
|
|
@@ -155,27 +149,65 @@ var SpriteAnimation$1 = SpriteAnimation;
|
|
|
155
149
|
var Text = (function (_super) {
|
|
156
150
|
__extends(Text, _super);
|
|
157
151
|
function Text(text, style) {
|
|
158
|
-
|
|
152
|
+
var _this = this;
|
|
153
|
+
if (style.strokeThickness) {
|
|
154
|
+
var color = style.stroke;
|
|
155
|
+
style.stroke = {
|
|
156
|
+
color: color,
|
|
157
|
+
width: style.strokeThickness,
|
|
158
|
+
};
|
|
159
|
+
delete style['strokeThickness'];
|
|
160
|
+
}
|
|
161
|
+
if (Array.isArray(style.fill)) {
|
|
162
|
+
console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.');
|
|
163
|
+
style.fill = style.fill[0];
|
|
164
|
+
}
|
|
165
|
+
if (Array.isArray(style.fillGradientStops)) {
|
|
166
|
+
var fontSize = void 0;
|
|
167
|
+
if (style.fontSize == null) {
|
|
168
|
+
style.fontSize = pixi_js.TextStyle.defaultTextStyle.fontSize;
|
|
169
|
+
}
|
|
170
|
+
else if (typeof style.fontSize === 'string') {
|
|
171
|
+
fontSize = parseInt(style.fontSize, 10);
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
fontSize = style.fontSize;
|
|
175
|
+
}
|
|
176
|
+
var gradientFill_1 = new pixi_js.FillGradient(0, 0, 0, fontSize * 1.7);
|
|
177
|
+
var fills_1 = style.fillGradientStops.map(function (color) { return pixi_js.Color.shared.setValue(color).toNumber(); });
|
|
178
|
+
fills_1.forEach(function (number, index) {
|
|
179
|
+
var ratio = index / (fills_1.length - 1);
|
|
180
|
+
gradientFill_1.addColorStop(ratio, number);
|
|
181
|
+
});
|
|
182
|
+
style.fill = {
|
|
183
|
+
fill: gradientFill_1,
|
|
184
|
+
};
|
|
185
|
+
delete style['fillGradientStops'];
|
|
186
|
+
}
|
|
187
|
+
_this = _super.call(this, {
|
|
188
|
+
text: text,
|
|
189
|
+
style: style,
|
|
190
|
+
}) || this;
|
|
191
|
+
return _this;
|
|
159
192
|
}
|
|
160
193
|
return Text;
|
|
161
194
|
}(pixi_js.Text));
|
|
162
195
|
var Text$1 = Text;
|
|
163
196
|
|
|
164
|
-
var PIXITilingSprite = pixi_js.extras.TilingSprite;
|
|
165
197
|
var TilingSprite = (function () {
|
|
166
198
|
function TilingSprite(image) {
|
|
167
199
|
this._image = null;
|
|
168
200
|
this._image = image;
|
|
169
201
|
if (image) {
|
|
170
202
|
if (image instanceof HTMLImageElement) {
|
|
171
|
-
this.tilingSprite = new
|
|
203
|
+
this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.from(image));
|
|
172
204
|
}
|
|
173
205
|
else if (image instanceof pixi_js.Texture) {
|
|
174
|
-
this.tilingSprite = new
|
|
206
|
+
this.tilingSprite = new pixi_js.TilingSprite(image);
|
|
175
207
|
}
|
|
176
208
|
}
|
|
177
209
|
else {
|
|
178
|
-
this.tilingSprite = new
|
|
210
|
+
this.tilingSprite = new pixi_js.TilingSprite(pixi_js.Texture.EMPTY);
|
|
179
211
|
}
|
|
180
212
|
}
|
|
181
213
|
Object.defineProperty(TilingSprite.prototype, "image", {
|
|
@@ -201,7 +233,7 @@ var TilingSprite = (function () {
|
|
|
201
233
|
}());
|
|
202
234
|
var TilingSprite$1 = TilingSprite;
|
|
203
235
|
|
|
204
|
-
exports.Application = Application
|
|
236
|
+
exports.Application = pixi_js.Application;
|
|
205
237
|
exports.Container = Container$1;
|
|
206
238
|
exports.Graphics = Graphics$1;
|
|
207
239
|
exports.NinePatch = NinePatch$1;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("pixi.js"),e=function(t,i){return
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("pixi.js"),e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])},e(t,i)};
|
|
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
|
|
@@ -12,4 +12,4 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
12
12
|
|
|
13
13
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
14
14
|
and limitations under the License.
|
|
15
|
-
***************************************************************************** */function i(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n=function(t){function e(
|
|
15
|
+
***************************************************************************** */function i(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var n=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(t.Container),r=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e}(t.Graphics),o=function(e){function n(i,n,r,o,s){var a;return a=i instanceof t.Texture?i:t.Texture.from(i),e.call(this,{texture:a,leftWidth:n,topHeight:r,rightWidth:o,bottomHeight:s})||this}return i(n,e),n}(t.NineSliceSprite),s=function(){function e(e){this._image=null,this._image=e,e?e instanceof HTMLImageElement?this.sprite=t.Sprite.from(e):e instanceof t.Texture&&(this.sprite=new t.Sprite(e)):this.sprite=new t.Sprite}return Object.defineProperty(e.prototype,"image",{get:function(){return this._image},set:function(e){this._image!==e&&(e instanceof HTMLImageElement?(this.sprite.texture&&this.sprite.texture.destroy(!1),this.sprite.texture=t.Texture.from(e)):e instanceof t.Texture&&(this.sprite.texture=e),this._image=e)},enumerable:!1,configurable:!0}),e}(),a=function(){function e(e){var i=e.frames;this.animatedSprite=new t.AnimatedSprite(i)}return e.prototype.play=function(){this.animatedSprite.play()},e.prototype.stop=function(){this.animatedSprite.stop()},e.prototype.gotoAndPlay=function(t){this.animatedSprite.gotoAndPlay(t)},e.prototype.gotoAndStop=function(t){this.animatedSprite.gotoAndStop(t)},Object.defineProperty(e.prototype,"speed",{get:function(){return this.animatedSprite.animationSpeed},set:function(t){this.animatedSprite.animationSpeed=t},enumerable:!1,configurable:!0}),e}(),p=function(e){function n(i,n){if(n.strokeThickness){var r=n.stroke;n.stroke={color:r,width:n.strokeThickness},delete n.strokeThickness}if(Array.isArray(n.fill)&&(console.warn("Eva.js Deprecation Warning: fill array is not supported in Eva.js v2."),n.fill=n.fill[0]),Array.isArray(n.fillGradientStops)){var o=void 0;null==n.fontSize?n.fontSize=t.TextStyle.defaultTextStyle.fontSize:o="string"==typeof n.fontSize?parseInt(n.fontSize,10):n.fontSize;var s=new t.FillGradient(0,0,0,1.7*o),a=n.fillGradientStops.map((function(e){return t.Color.shared.setValue(e).toNumber()}));a.forEach((function(t,e){var i=e/(a.length-1);s.addColorStop(i,t)})),n.fill={fill:s},delete n.fillGradientStops}return e.call(this,{text:i,style:n})||this}return i(n,e),n}(t.Text),u=function(){function e(e){this._image=null,this._image=e,e?e instanceof HTMLImageElement?this.tilingSprite=new t.TilingSprite(t.Texture.from(e)):e instanceof t.Texture&&(this.tilingSprite=new t.TilingSprite(e)):this.tilingSprite=new t.TilingSprite(t.Texture.EMPTY)}return Object.defineProperty(e.prototype,"image",{get:function(){return this._image},set:function(e){this._image!==e&&(e instanceof HTMLImageElement?this.tilingSprite.texture=t.Texture.from(e):e instanceof t.Texture&&(this.tilingSprite.texture=e),this._image=e)},enumerable:!1,configurable:!0}),e}();exports.Application=t.Application,exports.Container=n,exports.Graphics=r,exports.NinePatch=o,exports.Sprite=s,exports.SpriteAnimation=a,exports.Text=p,exports.TilingSprite=u;
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { AnimatedSprite } from 'pixi.js';
|
|
2
|
+
import { Application } from 'pixi.js';
|
|
3
3
|
import { Container as Container_2 } from 'pixi.js';
|
|
4
|
-
import { extras } from 'pixi.js';
|
|
5
4
|
import { Graphics as Graphics_2 } from 'pixi.js';
|
|
6
|
-
import {
|
|
5
|
+
import { NineSliceSprite } from 'pixi.js';
|
|
7
6
|
import { Sprite as Sprite_2 } from 'pixi.js';
|
|
8
7
|
import { Text as Text_3 } from 'pixi.js';
|
|
9
8
|
import type { TextStyleOptions } from 'pixi.js';
|
|
10
9
|
import { Texture } from 'pixi.js';
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
constructor(params: ApplicationOptions);
|
|
14
|
-
[propName: string]: any;
|
|
15
|
-
}
|
|
10
|
+
import { TilingSprite as TilingSprite_2 } from 'pixi.js';
|
|
11
|
+
export { Application }
|
|
16
12
|
|
|
17
13
|
export declare class Container extends Container_2 {
|
|
18
14
|
[propName: string]: any;
|
|
@@ -22,7 +18,7 @@ export declare class Graphics extends Graphics_2 {
|
|
|
22
18
|
[propName: string]: any;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
export declare class NinePatch extends
|
|
21
|
+
export declare class NinePatch extends NineSliceSprite {
|
|
26
22
|
constructor(img: any, leftWidth: any, topHeight: any, rightWidth: any, bottomHeight: any);
|
|
27
23
|
}
|
|
28
24
|
|
|
@@ -35,7 +31,7 @@ export declare class Sprite {
|
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
export declare class SpriteAnimation {
|
|
38
|
-
animatedSprite:
|
|
34
|
+
animatedSprite: AnimatedSprite;
|
|
39
35
|
constructor({ frames }: {
|
|
40
36
|
frames: any;
|
|
41
37
|
});
|
|
@@ -54,10 +50,10 @@ export { Text_2 as Text }
|
|
|
54
50
|
|
|
55
51
|
export declare class TilingSprite {
|
|
56
52
|
_image: HTMLImageElement | Texture;
|
|
57
|
-
tilingSprite:
|
|
53
|
+
tilingSprite: TilingSprite_2;
|
|
58
54
|
constructor(image: HTMLImageElement | Texture);
|
|
59
|
-
set image(val:
|
|
60
|
-
get image():
|
|
55
|
+
set image(val: Texture | HTMLImageElement);
|
|
56
|
+
get image(): Texture | HTMLImageElement;
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
export { }
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Container as Container$2, Graphics as Graphics$2, Texture, NineSliceSprite, Sprite as Sprite$2, AnimatedSprite, TextStyle, FillGradient, Color, Text as Text$2, TilingSprite as TilingSprite$2 } from 'pixi.js';
|
|
2
|
+
export { Application } from 'pixi.js';
|
|
2
3
|
|
|
3
4
|
/*! *****************************************************************************
|
|
4
5
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -29,18 +30,6 @@ function __extends(d, b) {
|
|
|
29
30
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
var Application = (function (_super) {
|
|
33
|
-
__extends(Application, _super);
|
|
34
|
-
function Application(params) {
|
|
35
|
-
var _this = this;
|
|
36
|
-
params.autoStart = false;
|
|
37
|
-
_this = _super.call(this, params) || this;
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
return Application;
|
|
41
|
-
}(Application$2));
|
|
42
|
-
var Application$1 = Application;
|
|
43
|
-
|
|
44
33
|
var Container = (function (_super) {
|
|
45
34
|
__extends(Container, _super);
|
|
46
35
|
function Container() {
|
|
@@ -64,17 +53,23 @@ var NinePatch = (function (_super) {
|
|
|
64
53
|
function NinePatch(img, leftWidth, topHeight, rightWidth, bottomHeight) {
|
|
65
54
|
var _this = this;
|
|
66
55
|
var texture;
|
|
67
|
-
if (img
|
|
68
|
-
texture =
|
|
56
|
+
if (img instanceof Texture) {
|
|
57
|
+
texture = img;
|
|
69
58
|
}
|
|
70
59
|
else {
|
|
71
60
|
texture = Texture.from(img);
|
|
72
61
|
}
|
|
73
|
-
_this = _super.call(this,
|
|
62
|
+
_this = _super.call(this, {
|
|
63
|
+
texture: texture,
|
|
64
|
+
leftWidth: leftWidth,
|
|
65
|
+
topHeight: topHeight,
|
|
66
|
+
rightWidth: rightWidth,
|
|
67
|
+
bottomHeight: bottomHeight,
|
|
68
|
+
}) || this;
|
|
74
69
|
return _this;
|
|
75
70
|
}
|
|
76
71
|
return NinePatch;
|
|
77
|
-
}(
|
|
72
|
+
}(NineSliceSprite));
|
|
78
73
|
var NinePatch$1 = NinePatch;
|
|
79
74
|
|
|
80
75
|
var Sprite = (function () {
|
|
@@ -120,7 +115,7 @@ var Sprite$1 = Sprite;
|
|
|
120
115
|
var SpriteAnimation = (function () {
|
|
121
116
|
function SpriteAnimation(_a) {
|
|
122
117
|
var frames = _a.frames;
|
|
123
|
-
this.animatedSprite = new
|
|
118
|
+
this.animatedSprite = new AnimatedSprite(frames);
|
|
124
119
|
}
|
|
125
120
|
SpriteAnimation.prototype.play = function () {
|
|
126
121
|
this.animatedSprite.play();
|
|
@@ -151,27 +146,65 @@ var SpriteAnimation$1 = SpriteAnimation;
|
|
|
151
146
|
var Text = (function (_super) {
|
|
152
147
|
__extends(Text, _super);
|
|
153
148
|
function Text(text, style) {
|
|
154
|
-
|
|
149
|
+
var _this = this;
|
|
150
|
+
if (style.strokeThickness) {
|
|
151
|
+
var color = style.stroke;
|
|
152
|
+
style.stroke = {
|
|
153
|
+
color: color,
|
|
154
|
+
width: style.strokeThickness,
|
|
155
|
+
};
|
|
156
|
+
delete style['strokeThickness'];
|
|
157
|
+
}
|
|
158
|
+
if (Array.isArray(style.fill)) {
|
|
159
|
+
console.warn('Eva.js Deprecation Warning: fill array is not supported in Eva.js v2.');
|
|
160
|
+
style.fill = style.fill[0];
|
|
161
|
+
}
|
|
162
|
+
if (Array.isArray(style.fillGradientStops)) {
|
|
163
|
+
var fontSize = void 0;
|
|
164
|
+
if (style.fontSize == null) {
|
|
165
|
+
style.fontSize = TextStyle.defaultTextStyle.fontSize;
|
|
166
|
+
}
|
|
167
|
+
else if (typeof style.fontSize === 'string') {
|
|
168
|
+
fontSize = parseInt(style.fontSize, 10);
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
fontSize = style.fontSize;
|
|
172
|
+
}
|
|
173
|
+
var gradientFill_1 = new FillGradient(0, 0, 0, fontSize * 1.7);
|
|
174
|
+
var fills_1 = style.fillGradientStops.map(function (color) { return Color.shared.setValue(color).toNumber(); });
|
|
175
|
+
fills_1.forEach(function (number, index) {
|
|
176
|
+
var ratio = index / (fills_1.length - 1);
|
|
177
|
+
gradientFill_1.addColorStop(ratio, number);
|
|
178
|
+
});
|
|
179
|
+
style.fill = {
|
|
180
|
+
fill: gradientFill_1,
|
|
181
|
+
};
|
|
182
|
+
delete style['fillGradientStops'];
|
|
183
|
+
}
|
|
184
|
+
_this = _super.call(this, {
|
|
185
|
+
text: text,
|
|
186
|
+
style: style,
|
|
187
|
+
}) || this;
|
|
188
|
+
return _this;
|
|
155
189
|
}
|
|
156
190
|
return Text;
|
|
157
191
|
}(Text$2));
|
|
158
192
|
var Text$1 = Text;
|
|
159
193
|
|
|
160
|
-
var PIXITilingSprite = extras.TilingSprite;
|
|
161
194
|
var TilingSprite = (function () {
|
|
162
195
|
function TilingSprite(image) {
|
|
163
196
|
this._image = null;
|
|
164
197
|
this._image = image;
|
|
165
198
|
if (image) {
|
|
166
199
|
if (image instanceof HTMLImageElement) {
|
|
167
|
-
this.tilingSprite = new
|
|
200
|
+
this.tilingSprite = new TilingSprite$2(Texture.from(image));
|
|
168
201
|
}
|
|
169
202
|
else if (image instanceof Texture) {
|
|
170
|
-
this.tilingSprite = new
|
|
203
|
+
this.tilingSprite = new TilingSprite$2(image);
|
|
171
204
|
}
|
|
172
205
|
}
|
|
173
206
|
else {
|
|
174
|
-
this.tilingSprite = new
|
|
207
|
+
this.tilingSprite = new TilingSprite$2(Texture.EMPTY);
|
|
175
208
|
}
|
|
176
209
|
}
|
|
177
210
|
Object.defineProperty(TilingSprite.prototype, "image", {
|
|
@@ -197,4 +230,4 @@ var TilingSprite = (function () {
|
|
|
197
230
|
}());
|
|
198
231
|
var TilingSprite$1 = TilingSprite;
|
|
199
232
|
|
|
200
|
-
export {
|
|
233
|
+
export { Container$1 as Container, Graphics$1 as Graphics, NinePatch$1 as NinePatch, Sprite$1 as Sprite, SpriteAnimation$1 as SpriteAnimation, Text$1 as Text, TilingSprite$1 as TilingSprite };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eva/renderer-adapter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"description": "@eva/renderer-adapter",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/renderer-adapter.esm.js",
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"homepage": "https://eva.js.org",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"
|
|
22
|
-
"pixi.js": "^4.8.9"
|
|
21
|
+
"pixi.js": "^8.6.3"
|
|
23
22
|
}
|
|
24
23
|
}
|