@eva/plugin-renderer-mask 1.2.7-editor.9 → 1.2.8-alpha.0

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,4 +1,4 @@
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); }
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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
2
 
3
3
  window.EVA = window.EVA || {};
4
4
  window.EVA.plugin = window.EVA.plugin || {};
@@ -14,7 +14,7 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
14
14
  d.__proto__ = b;
15
15
  } || function (d, b) {
16
16
  for (var p in b) {
17
- if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
17
+ if (b.hasOwnProperty(p)) d[p] = b[p];
18
18
  }
19
19
  };
20
20
 
@@ -22,8 +22,6 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
22
22
  };
23
23
 
24
24
  function __extends(d, b) {
25
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
26
-
27
25
  _extendStatics(d, b);
28
26
 
29
27
  function __() {
@@ -33,22 +31,6 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
33
31
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
32
  }
35
33
 
36
- var _assign = function __assign() {
37
- _assign = Object.assign || function __assign(t) {
38
- for (var s, i = 1, n = arguments.length; i < n; i++) {
39
- s = arguments[i];
40
-
41
- for (var p in s) {
42
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
43
- }
44
- }
45
-
46
- return t;
47
- };
48
-
49
- return _assign.apply(this, arguments);
50
- };
51
-
52
34
  function __decorate(decorators, target, key, desc) {
53
35
  var c = arguments.length,
54
36
  r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
@@ -59,10 +41,6 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
59
41
  return c > 3 && r && Object.defineProperty(target, key, r), r;
60
42
  }
61
43
 
62
- function __metadata(metadataKey, metadataValue) {
63
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
64
- }
65
-
66
44
  function __awaiter(thisArg, _arguments, P, generator) {
67
45
  function adopt(value) {
68
46
  return value instanceof P ? value : new P(function (resolve) {
@@ -258,119 +236,27 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
258
236
  return ar;
259
237
  }
260
238
 
261
- var SymbolKeysNotSupportedError = function (_super) {
262
- __extends(SymbolKeysNotSupportedError, _super);
263
-
264
- function SymbolKeysNotSupportedError() {
265
- var _newTarget = this.constructor;
266
-
267
- var _this = _super.call(this, 'Symbol keys are not supported yet!') || this;
268
-
269
- Object.setPrototypeOf(_this, _newTarget.prototype);
270
- return _this;
271
- }
272
-
273
- return SymbolKeysNotSupportedError;
274
- }(Error);
275
-
276
- (function (_super) {
277
- __extends(StaticGetPropertiesIsNotAFunctionError, _super);
278
-
279
- function StaticGetPropertiesIsNotAFunctionError() {
280
- var _newTarget = this.constructor;
281
-
282
- var _this = _super.call(this, 'getProperties is not a function!') || this;
283
-
284
- Object.setPrototypeOf(_this, _newTarget.prototype);
285
- return _this;
286
- }
287
-
288
- return StaticGetPropertiesIsNotAFunctionError;
289
- })(Error);
290
-
291
- var IDE_PROPERTY_METADATA = 'IDE_PROPERTY_METADATA';
292
-
293
- function transformBasicType(type) {
294
- if (type === String) {
295
- return 'string';
296
- }
297
-
298
- if (type === Number) {
299
- return 'number';
300
- }
301
-
302
- if (type === Boolean) {
303
- return 'boolean';
304
- }
305
-
306
- return 'unknown';
307
- }
308
-
309
- function defineTypes(target, key, options, returnTypeFunction) {
310
- var type = Reflect.getMetadata('design:type', target, key);
311
- var isArray = type === Array;
312
- var str = transformBasicType(type);
313
-
314
- if (str !== 'unknown') {
315
- type = str;
316
- }
317
-
318
- if (returnTypeFunction) {
319
- var returnType = returnTypeFunction();
320
-
321
- if (Array.isArray(returnType)) {
322
- isArray = true;
323
- type = returnType[0];
324
- } else {
325
- type = returnType;
326
- }
239
+ function getIDEPropsPropertyObj(target, propertyKey) {
240
+ if (!target.constructor.IDEProps) {
241
+ target.constructor.IDEProps = {};
327
242
  }
328
243
 
329
- var properties = Reflect.getMetadata(IDE_PROPERTY_METADATA, target.constructor) || {};
330
- properties[key] = _assign({
331
- type: type,
332
- isArray: isArray
333
- }, options);
334
- Reflect.defineMetadata(IDE_PROPERTY_METADATA, properties, target.constructor);
335
- }
336
-
337
- function getTypeDecoratorParams(returnTypeFuncOrOptions, maybeOptions) {
338
- if (typeof returnTypeFuncOrOptions === 'function') {
339
- return {
340
- returnTypeFunc: returnTypeFuncOrOptions,
341
- options: maybeOptions || {}
342
- };
244
+ if (!target.constructor.IDEProps[propertyKey]) {
245
+ target.constructor.IDEProps[propertyKey] = {};
343
246
  }
344
247
 
345
- return {
346
- options: returnTypeFuncOrOptions || {}
347
- };
248
+ var propertyObj = target.constructor.IDEProps[propertyKey];
249
+ return propertyObj;
348
250
  }
349
251
 
350
- function Field(returnTypeFunction, maybeOptions) {
252
+ function type(type) {
351
253
  return function (target, propertyKey) {
352
- if (typeof propertyKey === 'symbol') {
353
- throw new SymbolKeysNotSupportedError();
354
- }
355
-
356
- var _a = getTypeDecoratorParams(returnTypeFunction, maybeOptions),
357
- options = _a.options,
358
- returnTypeFunc = _a.returnTypeFunc;
359
-
360
- defineTypes(target, propertyKey, options, returnTypeFunc);
254
+ var prop = getIDEPropsPropertyObj(target, propertyKey);
255
+ prop.key = propertyKey;
256
+ prop.type = type;
361
257
  };
362
258
  }
363
259
 
364
- var ExecuteMode;
365
-
366
- (function (ExecuteMode) {
367
- ExecuteMode[ExecuteMode["Edit"] = 2] = "Edit";
368
- ExecuteMode[ExecuteMode["Game"] = 4] = "Game";
369
- ExecuteMode[ExecuteMode["All"] = 6] = "All";
370
- })(ExecuteMode || (ExecuteMode = {}));
371
-
372
- var _a;
373
-
374
260
  exports.MASK_TYPE = void 0;
375
261
 
376
262
  (function (MASK_TYPE) {
@@ -383,41 +269,6 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
383
269
  MASK_TYPE["Sprite"] = "Sprite";
384
270
  })(exports.MASK_TYPE || (exports.MASK_TYPE = {}));
385
271
 
386
- var MaskStyle = function () {
387
- function MaskStyle() {}
388
-
389
- __decorate([Field({
390
- step: 1
391
- }), __metadata("design:type", Number)], MaskStyle.prototype, "x", void 0);
392
-
393
- __decorate([Field({
394
- step: 1
395
- }), __metadata("design:type", Number)], MaskStyle.prototype, "y", void 0);
396
-
397
- __decorate([Field({
398
- step: 0.1,
399
- if: function _if(mask) {
400
- return mask.type === exports.MASK_TYPE.Circle || mask.type === exports.MASK_TYPE.RoundedRect;
401
- }
402
- }), __metadata("design:type", Number)], MaskStyle.prototype, "radius", void 0);
403
-
404
- __decorate([Field({
405
- step: 1,
406
- if: function _if(mask) {
407
- return mask.type !== exports.MASK_TYPE.Circle;
408
- }
409
- }), __metadata("design:type", Number)], MaskStyle.prototype, "width", void 0);
410
-
411
- __decorate([Field({
412
- step: 1,
413
- if: function _if(mask) {
414
- return mask.type !== exports.MASK_TYPE.Circle;
415
- }
416
- }), __metadata("design:type", Number)], MaskStyle.prototype, "height", void 0);
417
-
418
- return MaskStyle;
419
- }();
420
-
421
272
  var Mask$2 = function (_super) {
422
273
  __extends(Mask, _super);
423
274
 
@@ -436,23 +287,9 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
436
287
 
437
288
  Mask.componentName = 'Mask';
438
289
 
439
- __decorate([Field({
440
- type: 'selector',
441
- options: (_a = {}, _a[exports.MASK_TYPE.Circle] = exports.MASK_TYPE.Circle, _a[exports.MASK_TYPE.Ellipse] = exports.MASK_TYPE.Ellipse, _a[exports.MASK_TYPE.Img] = exports.MASK_TYPE.Img, _a[exports.MASK_TYPE.Rect] = exports.MASK_TYPE.Rect, _a[exports.MASK_TYPE.RoundedRect] = exports.MASK_TYPE.RoundedRect, _a),
442
- alias: 'type',
443
- default: exports.MASK_TYPE.Circle
444
- }), __metadata("design:type", String)], Mask.prototype, "mask_type", void 0);
445
-
446
- __decorate([Field(function () {
447
- return MaskStyle;
448
- }), __metadata("design:type", Object)], Mask.prototype, "style", void 0);
449
-
450
- __decorate([Field({
451
- type: 'resource',
452
- if: function _if(mask) {
453
- return mask.type === exports.MASK_TYPE.Img || exports.MASK_TYPE.Sprite;
454
- }
455
- }), __metadata("design:type", String)], Mask.prototype, "resource", void 0);
290
+ __decorate([type('string')], Mask.prototype, "resource", void 0);
291
+
292
+ __decorate([type('string')], Mask.prototype, "spriteName", void 0);
456
293
 
457
294
  return Mask;
458
295
  }(eva_js.Component);
@@ -1 +1 @@
1
- function _extends(){return _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_extends.apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_mask=function(e,t,r,n){"use strict";var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},o(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function c(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function p(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}s((n=n.apply(e,t||[])).next())}))}function u(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=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++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.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],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function l(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}var y=function(e){function t(){var t=this.constructor,r=e.call(this,"Symbol keys are not supported yet!")||this;return Object.setPrototypeOf(r,t.prototype),r}return i(t,e),t}(Error);!function(e){function t(){var t=this.constructor,r=e.call(this,"getProperties is not a function!")||this;return Object.setPrototypeOf(r,t.prototype),r}i(t,e)}(Error);var d,f,h="IDE_PROPERTY_METADATA";function g(e,t,r,n){var o=Reflect.getMetadata("design:type",e,t),i=o===Array,c=function(e){return e===String?"string":e===Number?"number":e===Boolean?"boolean":"unknown"}(o);if("unknown"!==c&&(o=c),n){var s=n();Array.isArray(s)?(i=!0,o=s[0]):o=s}var p=Reflect.getMetadata(h,e.constructor)||{};p[t]=a({type:o,isArray:i},r),Reflect.defineMetadata(h,p,e.constructor)}function m(e,t){return function(r,n){if("symbol"==typeof n)throw new y;var o=function(e,t){return"function"==typeof e?{returnTypeFunc:e,options:t||{}}:{options:e||{}}}(e,t);g(r,n,o.options,o.returnTypeFunc)}}!function(e){e[e.Edit=2]="Edit",e[e.Game=4]="Game",e[e.All=6]="All"}(d||(d={})),e.MASK_TYPE=void 0,function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(e.MASK_TYPE||(e.MASK_TYPE={}));var v,w=function(){function t(){}return c([m({step:1}),s("design:type",Number)],t.prototype,"x",void 0),c([m({step:1}),s("design:type",Number)],t.prototype,"y",void 0),c([m({step:.1,if:function(t){return t.type===e.MASK_TYPE.Circle||t.type===e.MASK_TYPE.RoundedRect}}),s("design:type",Number)],t.prototype,"radius",void 0),c([m({step:1,if:function(t){return t.type!==e.MASK_TYPE.Circle}}),s("design:type",Number)],t.prototype,"width",void 0),c([m({step:1,if:function(t){return t.type!==e.MASK_TYPE.Circle}}),s("design:type",Number)],t.prototype,"height",void 0),t}(),E=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.style={},e.resource="",e.spriteName="",e}return i(r,t),r.prototype.init=function(e){_extends(this,e)},r.componentName="Mask",c([m({type:"selector",options:(f={},f[e.MASK_TYPE.Circle]=e.MASK_TYPE.Circle,f[e.MASK_TYPE.Ellipse]=e.MASK_TYPE.Ellipse,f[e.MASK_TYPE.Img]=e.MASK_TYPE.Img,f[e.MASK_TYPE.Rect]=e.MASK_TYPE.Rect,f[e.MASK_TYPE.RoundedRect]=e.MASK_TYPE.RoundedRect,f),alias:"type",default:e.MASK_TYPE.Circle}),s("design:type",String)],r.prototype,"mask_type",void 0),c([m((function(){return w})),s("design:type",Object)],r.prototype,"style",void 0),c([m({type:"resource",if:function(t){return t.type===e.MASK_TYPE.Img||e.MASK_TYPE.Sprite}}),s("design:type",String)],r.prototype,"resource",void 0),r}(t.Component),S=E,b={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]},R={Circle:"drawCircle",Ellipse:"drawEllipse",Rect:"drawRect",RoundedRect:"drawRoundedRect",Polygon:"drawPolygon"};!function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(v||(v={}));var _=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Mask",t.changedCache={},t.maskSpriteCache={},t}return i(o,e),o.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(){this.changedCache={}},o.prototype.componentChanged=function(e){if("Mask"===e.component.name)switch(e.type){case t.OBSERVER_TYPE.ADD:this.add(e);break;case t.OBSERVER_TYPE.REMOVE:this.remove(e);break;case t.OBSERVER_TYPE.CHANGE:this.change(e)}},o.prototype.add=function(e){var t,r=e.component;if(!(r.type in v))throw new Error("no have Mask type: "+r.type);if(!r.style)throw new Error("no have Mask style: "+r.type);switch(r.type){case v.Circle:case v.Ellipse:case v.Rect:case v.RoundedRect:case v.Polygon:t=this.createGraphics(r);break;case v.Img:case v.Sprite:t=this.createSprite(r)}if(!t)throw new Error("no have mask instance, check your mask params: "+r.type);var n=this.containerManager.getContainer(e.gameObject.id);n.mask=t,n.addChild(t)},o.prototype.remove=function(e){var t=this.containerManager.getContainer(e.gameObject.id);t.removeChild(t.mask),t.mask.destroy({children:!0}),t.mask=null,delete this.maskSpriteCache[e.gameObject.id]},o.prototype.change=function(e){if(!this.changedCache[e.gameObject.id]){var t=e.component;"type"===e.prop.prop[0]?(this.changedCache[e.gameObject.id]=!0,[v.Sprite,v.Img].indexOf(t.type)>-1||t._lastType!==t.type?(this.remove(e),this.add(e),t._lastType=t.type):this.redrawGraphics(e)):"style"===e.prop.prop[0]?[v.Sprite,v.Img].indexOf(t.type)>-1?this.changeSpriteStyle(t):this.redrawGraphics(e):("resource"===e.prop.prop[0]||"spriteName"===e.prop.prop[0])&&(this.changedCache[e.gameObject.id]=!0,this.changeSprite(t))}},o.prototype.createGraphics=function(e){var t=new n.Graphics;return this.draw(t,e),t},o.prototype.redrawGraphics=function(e){var t=this.containerManager.getContainer(e.gameObject.id).mask;t.clear(),this.draw(t,e.component)},o.prototype.draw=function(e,t){var r,n,o=[];try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(b[t.type]),a=i.next();!a.done;a=i.next()){var c=a.value;o.push(t.style[c])}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.beginFill(0,1),e[R[t.type]].apply(e,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(l(arguments[t]));return e}(o)),e.endFill()},o.prototype.createSprite=function(e){var t=new n.Sprite(null);return this.maskSpriteCache[e.gameObject.id]=t,this.setSprite(e,t),t.sprite},o.prototype.changeSpriteStyle=function(e){var t=this.maskSpriteCache[e.gameObject.id];t.sprite.width=e.style.width,t.sprite.height=e.style.height,t.sprite.position.x=e.style.x,t.sprite.position.y=e.style.y},o.prototype.changeSprite=function(e){var t=this.maskSpriteCache[e.gameObject.id];this.setSprite(e,t)},o.prototype.setSprite=function(e,r){return p(this,void 0,void 0,(function(){var n,o,i,a;return u(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),o=this.increaseAsyncId(e.gameObject.id),[4,t.resource.getResource(e.resource)];case 1:return n=c.sent(),this.validateAsyncId(e.gameObject.id,o)?[3,3]:[2];case 2:throw c.sent(),new Error("mask resource load error");case 3:return e.type===v.Sprite?(i=e.resource+"_s|r|c_"+e.spriteName,a=n.instance[i],r.image=a):r.image=n.data.image,r.sprite.width=e.style.width,r.sprite.height=e.style.height,r.sprite.position.x=e.style.x,r.sprite.position.y=e.style.y,[2]}}))}))},o.systemName="Mask",o=c([t.decorators.componentObserver({Mask:["type",{prop:["style"],deep:!0},"resource","spriteName"]})],o)}(r.Renderer),A=_;return e.Mask=S,e.MaskSystem=A,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.mask=window.EVA.plugin.renderer.mask||_EVA_IIFE_mask;
1
+ function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_extends.apply(this,arguments)}window.EVA=window.EVA||{},window.EVA.plugin=window.EVA.plugin||{},window.EVA.plugin.renderer=window.EVA.plugin.renderer||{};var _EVA_IIFE_mask=function(e,t,r,n){"use strict";var o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},o(e,t)};function i(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{s(n.next(e))}catch(e){i(e)}}function c(e){try{s(n.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,c)}s((n=n.apply(e,t||[])).next())}))}function s(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=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++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.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],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function p(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function l(e){return function(t,r){var n=function(e,t){return e.constructor.IDEProps||(e.constructor.IDEProps={}),e.constructor.IDEProps[t]||(e.constructor.IDEProps[t]={}),e.constructor.IDEProps[t]}(t,r);n.key=r,n.type=e}}e.MASK_TYPE=void 0,function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(e.MASK_TYPE||(e.MASK_TYPE={}));var u,h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.style={},t.resource="",t.spriteName="",t}return i(t,e),t.prototype.init=function(e){_extends(this,e)},t.componentName="Mask",a([l("string")],t.prototype,"resource",void 0),a([l("string")],t.prototype,"spriteName",void 0),t}(t.Component),d=h,y={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]},f={Circle:"drawCircle",Ellipse:"drawEllipse",Rect:"drawRect",RoundedRect:"drawRoundedRect",Polygon:"drawPolygon"};!function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(u||(u={}));var g=function(e){function o(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Mask",t.changedCache={},t.maskSpriteCache={},t}return i(o,e),o.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(){this.changedCache={}},o.prototype.componentChanged=function(e){if("Mask"===e.component.name)switch(e.type){case t.OBSERVER_TYPE.ADD:this.add(e);break;case t.OBSERVER_TYPE.REMOVE:this.remove(e);break;case t.OBSERVER_TYPE.CHANGE:this.change(e)}},o.prototype.add=function(e){var t,r=e.component;if(!(r.type in u))throw new Error("no have Mask type: "+r.type);if(!r.style)throw new Error("no have Mask style: "+r.type);switch(r.type){case u.Circle:case u.Ellipse:case u.Rect:case u.RoundedRect:case u.Polygon:t=this.createGraphics(r);break;case u.Img:case u.Sprite:t=this.createSprite(r)}if(!t)throw new Error("no have mask instance, check your mask params: "+r.type);var n=this.containerManager.getContainer(e.gameObject.id);n.mask=t,n.addChild(t)},o.prototype.remove=function(e){var t=this.containerManager.getContainer(e.gameObject.id);t.removeChild(t.mask),t.mask.destroy({children:!0}),t.mask=null,delete this.maskSpriteCache[e.gameObject.id]},o.prototype.change=function(e){if(!this.changedCache[e.gameObject.id]){var t=e.component;"type"===e.prop.prop[0]?(this.changedCache[e.gameObject.id]=!0,[u.Sprite,u.Img].indexOf(t.type)>-1||t._lastType!==t.type?(this.remove(e),this.add(e),t._lastType=t.type):this.redrawGraphics(e)):"style"===e.prop.prop[0]?[u.Sprite,u.Img].indexOf(t.type)>-1?this.changeSpriteStyle(t):this.redrawGraphics(e):("resource"===e.prop.prop[0]||"spriteName"===e.prop.prop[0])&&(this.changedCache[e.gameObject.id]=!0,this.changeSprite(t))}},o.prototype.createGraphics=function(e){var t=new n.Graphics;return this.draw(t,e),t},o.prototype.redrawGraphics=function(e){var t=this.containerManager.getContainer(e.gameObject.id).mask;t.clear(),this.draw(t,e.component)},o.prototype.draw=function(e,t){var r,n,o=[];try{for(var i=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(y[t.type]),a=i.next();!a.done;a=i.next()){var c=a.value;o.push(t.style[c])}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.beginFill(0,1),e[f[t.type]].apply(e,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(p(arguments[t]));return e}(o)),e.endFill()},o.prototype.createSprite=function(e){var t=new n.Sprite(null);return this.maskSpriteCache[e.gameObject.id]=t,this.setSprite(e,t),t.sprite},o.prototype.changeSpriteStyle=function(e){var t=this.maskSpriteCache[e.gameObject.id];t.sprite.width=e.style.width,t.sprite.height=e.style.height,t.sprite.position.x=e.style.x,t.sprite.position.y=e.style.y},o.prototype.changeSprite=function(e){var t=this.maskSpriteCache[e.gameObject.id];this.setSprite(e,t)},o.prototype.setSprite=function(e,r){return c(this,void 0,void 0,(function(){var n,o,i,a;return s(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),o=this.increaseAsyncId(e.gameObject.id),[4,t.resource.getResource(e.resource)];case 1:return n=c.sent(),this.validateAsyncId(e.gameObject.id,o)?[3,3]:[2];case 2:throw c.sent(),new Error("mask resource load error");case 3:return e.type===u.Sprite?(i=e.resource+"_s|r|c_"+e.spriteName,a=n.instance[i],r.image=a):r.image=n.data.image,r.sprite.width=e.style.width,r.sprite.height=e.style.height,r.sprite.position.x=e.style.x,r.sprite.position.y=e.style.y,[2]}}))}))},o.systemName="Mask",o=a([t.decorators.componentObserver({Mask:["type",{prop:["style"],deep:!0},"resource","spriteName"]})],o)}(r.Renderer),m=g;return e.Mask=d,e.MaskSystem=m,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,EVA.plugin.renderer,EVA.rendererAdapter);window.EVA.plugin.renderer.mask=window.EVA.plugin.renderer.mask||_EVA_IIFE_mask;
@@ -0,0 +1,314 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : 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, __values, __spread, __awaiter, __generator } from 'tslib';
4
+ import { Component, OBSERVER_TYPE, resource, decorators } from '@eva/eva.js/dist/miniprogram';
5
+ import { type } from '@eva/inspector-decorator';
6
+ import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
7
+ import { Graphics, Sprite } from '@eva/renderer-adapter/dist/miniprogram';
8
+ var MASK_TYPE$1;
9
+
10
+ (function (MASK_TYPE) {
11
+ MASK_TYPE["Circle"] = "Circle";
12
+ MASK_TYPE["Ellipse"] = "Ellipse";
13
+ MASK_TYPE["Rect"] = "Rect";
14
+ MASK_TYPE["RoundedRect"] = "RoundedRect";
15
+ MASK_TYPE["Polygon"] = "Polygon";
16
+ MASK_TYPE["Img"] = "Img";
17
+ MASK_TYPE["Sprite"] = "Sprite";
18
+ })(MASK_TYPE$1 || (MASK_TYPE$1 = {}));
19
+
20
+ var Mask$2 = function (_super) {
21
+ __extends(Mask, _super);
22
+
23
+ function Mask() {
24
+ var _this = _super !== null && _super.apply(this, arguments) || this;
25
+
26
+ _this.style = {};
27
+ _this.resource = '';
28
+ _this.spriteName = '';
29
+ return _this;
30
+ }
31
+
32
+ Mask.prototype.init = function (obj) {
33
+ _extends(this, obj);
34
+ };
35
+
36
+ Mask.componentName = 'Mask';
37
+
38
+ __decorate([type('string')], Mask.prototype, "resource", void 0);
39
+
40
+ __decorate([type('string')], Mask.prototype, "spriteName", void 0);
41
+
42
+ return Mask;
43
+ }(Component);
44
+
45
+ var Mask$3 = Mask$2;
46
+ var resourceKeySplit = '_s|r|c_';
47
+ var propertyForGraphics = {
48
+ Circle: ['x', 'y', 'radius'],
49
+ Ellipse: ['x', 'y', 'width', 'height'],
50
+ Rect: ['x', 'y', 'width', 'height'],
51
+ RoundedRect: ['x', 'y', 'width', 'height', 'radius'],
52
+ Polygon: ['paths']
53
+ };
54
+ var functionForGraphics = {
55
+ Circle: 'drawCircle',
56
+ Ellipse: 'drawEllipse',
57
+ Rect: 'drawRect',
58
+ RoundedRect: 'drawRoundedRect',
59
+ Polygon: 'drawPolygon'
60
+ };
61
+ var MASK_TYPE;
62
+
63
+ (function (MASK_TYPE) {
64
+ MASK_TYPE["Circle"] = "Circle";
65
+ MASK_TYPE["Ellipse"] = "Ellipse";
66
+ MASK_TYPE["Rect"] = "Rect";
67
+ MASK_TYPE["RoundedRect"] = "RoundedRect";
68
+ MASK_TYPE["Polygon"] = "Polygon";
69
+ MASK_TYPE["Img"] = "Img";
70
+ MASK_TYPE["Sprite"] = "Sprite";
71
+ })(MASK_TYPE || (MASK_TYPE = {}));
72
+
73
+ var Mask = function (_super) {
74
+ __extends(Mask, _super);
75
+
76
+ function Mask() {
77
+ var _this = _super !== null && _super.apply(this, arguments) || this;
78
+
79
+ _this.name = 'Mask';
80
+ _this.changedCache = {};
81
+ _this.maskSpriteCache = {};
82
+ return _this;
83
+ }
84
+
85
+ Mask.prototype.init = function () {
86
+ this.renderSystem = this.game.getSystem(RendererSystem);
87
+ this.renderSystem.rendererManager.register(this);
88
+ };
89
+
90
+ Mask.prototype.rendererUpdate = function () {
91
+ this.changedCache = {};
92
+ };
93
+
94
+ Mask.prototype.componentChanged = function (changed) {
95
+ if (changed.component.name !== 'Mask') return;
96
+
97
+ switch (changed.type) {
98
+ case OBSERVER_TYPE.ADD:
99
+ this.add(changed);
100
+ break;
101
+
102
+ case OBSERVER_TYPE.REMOVE:
103
+ this.remove(changed);
104
+ break;
105
+
106
+ case OBSERVER_TYPE.CHANGE:
107
+ this.change(changed);
108
+ break;
109
+ }
110
+ };
111
+
112
+ Mask.prototype.add = function (changed) {
113
+ var component = changed.component;
114
+
115
+ if (!(component.type in MASK_TYPE)) {
116
+ throw new Error('no have Mask type: ' + component.type);
117
+ }
118
+
119
+ if (!component.style) {
120
+ throw new Error('no have Mask style: ' + component.type);
121
+ }
122
+
123
+ var mask;
124
+
125
+ switch (component.type) {
126
+ case MASK_TYPE.Circle:
127
+ mask = this.createGraphics(component);
128
+ break;
129
+
130
+ case MASK_TYPE.Ellipse:
131
+ mask = this.createGraphics(component);
132
+ break;
133
+
134
+ case MASK_TYPE.Rect:
135
+ mask = this.createGraphics(component);
136
+ break;
137
+
138
+ case MASK_TYPE.RoundedRect:
139
+ mask = this.createGraphics(component);
140
+ break;
141
+
142
+ case MASK_TYPE.Polygon:
143
+ mask = this.createGraphics(component);
144
+ break;
145
+
146
+ case MASK_TYPE.Img:
147
+ mask = this.createSprite(component);
148
+ break;
149
+
150
+ case MASK_TYPE.Sprite:
151
+ mask = this.createSprite(component);
152
+ break;
153
+ }
154
+
155
+ if (!mask) {
156
+ throw new Error('no have mask instance, check your mask params: ' + component.type);
157
+ }
158
+
159
+ var container = this.containerManager.getContainer(changed.gameObject.id);
160
+ container.mask = mask;
161
+ container.addChild(mask);
162
+ };
163
+
164
+ Mask.prototype.remove = function (changed) {
165
+ var container = this.containerManager.getContainer(changed.gameObject.id);
166
+ container.removeChild(container.mask);
167
+ container.mask.destroy({
168
+ children: true
169
+ });
170
+ container.mask = null;
171
+ delete this.maskSpriteCache[changed.gameObject.id];
172
+ };
173
+
174
+ Mask.prototype.change = function (changed) {
175
+ if (this.changedCache[changed.gameObject.id]) return;
176
+ var component = changed.component;
177
+
178
+ if (changed.prop.prop[0] === 'type') {
179
+ this.changedCache[changed.gameObject.id] = true;
180
+
181
+ if ([MASK_TYPE.Sprite, MASK_TYPE.Img].indexOf(component.type) > -1 || component._lastType !== component.type) {
182
+ this.remove(changed);
183
+ this.add(changed);
184
+ component._lastType = component.type;
185
+ } else {
186
+ this.redrawGraphics(changed);
187
+ }
188
+ } else if (changed.prop.prop[0] === 'style') {
189
+ if ([MASK_TYPE.Sprite, MASK_TYPE.Img].indexOf(component.type) > -1) {
190
+ this.changeSpriteStyle(component);
191
+ } else {
192
+ this.redrawGraphics(changed);
193
+ }
194
+ } else if (changed.prop.prop[0] === 'resource') {
195
+ this.changedCache[changed.gameObject.id] = true;
196
+ this.changeSprite(component);
197
+ } else if (changed.prop.prop[0] === 'spriteName') {
198
+ this.changedCache[changed.gameObject.id] = true;
199
+ this.changeSprite(component);
200
+ }
201
+ };
202
+
203
+ Mask.prototype.createGraphics = function (component) {
204
+ var graphics = new Graphics();
205
+ this.draw(graphics, component);
206
+ return graphics;
207
+ };
208
+
209
+ Mask.prototype.redrawGraphics = function (changed) {
210
+ var container = this.containerManager.getContainer(changed.gameObject.id);
211
+ var graphics = container.mask;
212
+ graphics.clear();
213
+ this.draw(graphics, changed.component);
214
+ };
215
+
216
+ Mask.prototype.draw = function (graphics, component) {
217
+ var e_1, _a;
218
+
219
+ var params = [];
220
+
221
+ try {
222
+ for (var _b = __values(propertyForGraphics[component.type]), _c = _b.next(); !_c.done; _c = _b.next()) {
223
+ var key = _c.value;
224
+ params.push(component.style[key]);
225
+ }
226
+ } catch (e_1_1) {
227
+ e_1 = {
228
+ error: e_1_1
229
+ };
230
+ } finally {
231
+ try {
232
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
233
+ } finally {
234
+ if (e_1) throw e_1.error;
235
+ }
236
+ }
237
+
238
+ graphics.beginFill(0x000000, 1);
239
+ graphics[functionForGraphics[component.type]].apply(graphics, __spread(params));
240
+ graphics.endFill();
241
+ };
242
+
243
+ Mask.prototype.createSprite = function (component) {
244
+ var sprite = new Sprite(null);
245
+ this.maskSpriteCache[component.gameObject.id] = sprite;
246
+ this.setSprite(component, sprite);
247
+ return sprite.sprite;
248
+ };
249
+
250
+ Mask.prototype.changeSpriteStyle = function (component) {
251
+ var sprite = this.maskSpriteCache[component.gameObject.id];
252
+ sprite.sprite.width = component.style.width;
253
+ sprite.sprite.height = component.style.height;
254
+ sprite.sprite.position.x = component.style.x;
255
+ sprite.sprite.position.y = component.style.y;
256
+ };
257
+
258
+ Mask.prototype.changeSprite = function (component) {
259
+ var sprite = this.maskSpriteCache[component.gameObject.id];
260
+ this.setSprite(component, sprite);
261
+ };
262
+
263
+ Mask.prototype.setSprite = function (component, sprite) {
264
+ return __awaiter(this, void 0, void 0, function () {
265
+ var res, asyncId, img, texture;
266
+ return __generator(this, function (_a) {
267
+ switch (_a.label) {
268
+ case 0:
269
+ _a.trys.push([0, 2,, 3]);
270
+
271
+ asyncId = this.increaseAsyncId(component.gameObject.id);
272
+ return [4, resource.getResource(component.resource)];
273
+
274
+ case 1:
275
+ res = _a.sent();
276
+ if (!this.validateAsyncId(component.gameObject.id, asyncId)) return [2];
277
+ return [3, 3];
278
+
279
+ case 2:
280
+ _a.sent();
281
+
282
+ throw new Error('mask resource load error');
283
+
284
+ case 3:
285
+ if (component.type === MASK_TYPE.Sprite) {
286
+ img = component.resource + resourceKeySplit + component.spriteName;
287
+ texture = res.instance[img];
288
+ sprite.image = texture;
289
+ } else {
290
+ sprite.image = res.data.image;
291
+ }
292
+
293
+ sprite.sprite.width = component.style.width;
294
+ sprite.sprite.height = component.style.height;
295
+ sprite.sprite.position.x = component.style.x;
296
+ sprite.sprite.position.y = component.style.y;
297
+ return [2];
298
+ }
299
+ });
300
+ });
301
+ };
302
+
303
+ Mask.systemName = 'Mask';
304
+ Mask = __decorate([decorators.componentObserver({
305
+ Mask: ['type', {
306
+ prop: ['style'],
307
+ deep: true
308
+ }, 'resource', 'spriteName']
309
+ })], Mask);
310
+ return Mask;
311
+ }(Renderer);
312
+
313
+ var Mask$1 = Mask;
314
+ export { MASK_TYPE$1 as MASK_TYPE, Mask$3 as Mask, Mask$1 as MaskSystem };
@@ -43,10 +43,6 @@ function __decorate(decorators, target, key, desc) {
43
43
  return c > 3 && r && Object.defineProperty(target, key, r), r;
44
44
  }
45
45
 
46
- function __metadata(metadataKey, metadataValue) {
47
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
48
- }
49
-
50
46
  function __awaiter(thisArg, _arguments, P, generator) {
51
47
  return new (P || (P = Promise))(function (resolve, reject) {
52
48
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -118,7 +114,6 @@ function __spread() {
118
114
  return ar;
119
115
  }
120
116
 
121
- var _a;
122
117
  exports.MASK_TYPE = void 0;
123
118
  (function (MASK_TYPE) {
124
119
  MASK_TYPE["Circle"] = "Circle";
@@ -129,31 +124,6 @@ exports.MASK_TYPE = void 0;
129
124
  MASK_TYPE["Img"] = "Img";
130
125
  MASK_TYPE["Sprite"] = "Sprite";
131
126
  })(exports.MASK_TYPE || (exports.MASK_TYPE = {}));
132
- var MaskStyle = (function () {
133
- function MaskStyle() {
134
- }
135
- __decorate([
136
- inspectorDecorator.Field({ step: 1 }),
137
- __metadata("design:type", Number)
138
- ], MaskStyle.prototype, "x", void 0);
139
- __decorate([
140
- inspectorDecorator.Field({ step: 1 }),
141
- __metadata("design:type", Number)
142
- ], MaskStyle.prototype, "y", void 0);
143
- __decorate([
144
- inspectorDecorator.Field({ step: 0.1, if: function (mask) { return mask.type === exports.MASK_TYPE.Circle || mask.type === exports.MASK_TYPE.RoundedRect; } }),
145
- __metadata("design:type", Number)
146
- ], MaskStyle.prototype, "radius", void 0);
147
- __decorate([
148
- inspectorDecorator.Field({ step: 1, if: function (mask) { return mask.type !== exports.MASK_TYPE.Circle; } }),
149
- __metadata("design:type", Number)
150
- ], MaskStyle.prototype, "width", void 0);
151
- __decorate([
152
- inspectorDecorator.Field({ step: 1, if: function (mask) { return mask.type !== exports.MASK_TYPE.Circle; } }),
153
- __metadata("design:type", Number)
154
- ], MaskStyle.prototype, "height", void 0);
155
- return MaskStyle;
156
- }());
157
127
  var Mask$2 = (function (_super) {
158
128
  __extends(Mask, _super);
159
129
  function Mask() {
@@ -168,31 +138,11 @@ var Mask$2 = (function (_super) {
168
138
  };
169
139
  Mask.componentName = 'Mask';
170
140
  __decorate([
171
- inspectorDecorator.Field({
172
- type: 'selector',
173
- options: (_a = {},
174
- _a[exports.MASK_TYPE.Circle] = exports.MASK_TYPE.Circle,
175
- _a[exports.MASK_TYPE.Ellipse] = exports.MASK_TYPE.Ellipse,
176
- _a[exports.MASK_TYPE.Img] = exports.MASK_TYPE.Img,
177
- _a[exports.MASK_TYPE.Rect] = exports.MASK_TYPE.Rect,
178
- _a[exports.MASK_TYPE.RoundedRect] = exports.MASK_TYPE.RoundedRect,
179
- _a),
180
- alias: 'type',
181
- default: exports.MASK_TYPE.Circle,
182
- }),
183
- __metadata("design:type", String)
184
- ], Mask.prototype, "mask_type", void 0);
185
- __decorate([
186
- inspectorDecorator.Field(function () { return MaskStyle; }),
187
- __metadata("design:type", Object)
188
- ], Mask.prototype, "style", void 0);
189
- __decorate([
190
- inspectorDecorator.Field({
191
- type: 'resource',
192
- if: function (mask) { return mask.type === exports.MASK_TYPE.Img || exports.MASK_TYPE.Sprite; },
193
- }),
194
- __metadata("design:type", String)
141
+ inspectorDecorator.type('string')
195
142
  ], Mask.prototype, "resource", void 0);
143
+ __decorate([
144
+ inspectorDecorator.type('string')
145
+ ], Mask.prototype, "spriteName", void 0);
196
146
  return Mask;
197
147
  }(eva_js.Component));
198
148
  var Mask$3 = Mask$2;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@eva/eva.js"),r=require("@eva/inspector-decorator"),n=require("@eva/plugin-renderer"),o=require("@eva/renderer-adapter"),i=function(e,t){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},i(e,t)};function a(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function p(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var p=e.length-1;p>=0;p--)(o=e[p])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function s(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function c(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:p(0),throw:p(1),return:p(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function p(i){return function(p){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=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++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.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],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,p])}}}function l(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}exports.MASK_TYPE=void 0,function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(exports.MASK_TYPE||(exports.MASK_TYPE={}));var u,y=function(){function e(){}return p([r.Field({step:1}),s("design:type",Number)],e.prototype,"x",void 0),p([r.Field({step:1}),s("design:type",Number)],e.prototype,"y",void 0),p([r.Field({step:.1,if:function(e){return e.type===exports.MASK_TYPE.Circle||e.type===exports.MASK_TYPE.RoundedRect}}),s("design:type",Number)],e.prototype,"radius",void 0),p([r.Field({step:1,if:function(e){return e.type!==exports.MASK_TYPE.Circle}}),s("design:type",Number)],e.prototype,"width",void 0),p([r.Field({step:1,if:function(e){return e.type!==exports.MASK_TYPE.Circle}}),s("design:type",Number)],e.prototype,"height",void 0),e}(),d=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.style={},e.resource="",e.spriteName="",e}return a(n,t),n.prototype.init=function(e){Object.assign(this,e)},n.componentName="Mask",p([r.Field({type:"selector",options:(e={},e[exports.MASK_TYPE.Circle]=exports.MASK_TYPE.Circle,e[exports.MASK_TYPE.Ellipse]=exports.MASK_TYPE.Ellipse,e[exports.MASK_TYPE.Img]=exports.MASK_TYPE.Img,e[exports.MASK_TYPE.Rect]=exports.MASK_TYPE.Rect,e[exports.MASK_TYPE.RoundedRect]=exports.MASK_TYPE.RoundedRect,e),alias:"type",default:exports.MASK_TYPE.Circle}),s("design:type",String)],n.prototype,"mask_type",void 0),p([r.Field((function(){return y})),s("design:type",Object)],n.prototype,"style",void 0),p([r.Field({type:"resource",if:function(e){return e.type===exports.MASK_TYPE.Img||exports.MASK_TYPE.Sprite}}),s("design:type",String)],n.prototype,"resource",void 0),n}(t.Component),h=d,f={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]},g={Circle:"drawCircle",Ellipse:"drawEllipse",Rect:"drawRect",RoundedRect:"drawRoundedRect",Polygon:"drawPolygon"};!function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(u||(u={}));var m=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="Mask",t.changedCache={},t.maskSpriteCache={},t}return a(r,e),r.prototype.init=function(){this.renderSystem=this.game.getSystem(n.RendererSystem),this.renderSystem.rendererManager.register(this)},r.prototype.rendererUpdate=function(){this.changedCache={}},r.prototype.componentChanged=function(e){if("Mask"===e.component.name)switch(e.type){case t.OBSERVER_TYPE.ADD:this.add(e);break;case t.OBSERVER_TYPE.REMOVE:this.remove(e);break;case t.OBSERVER_TYPE.CHANGE:this.change(e)}},r.prototype.add=function(e){var t,r=e.component;if(!(r.type in u))throw new Error("no have Mask type: "+r.type);if(!r.style)throw new Error("no have Mask style: "+r.type);switch(r.type){case u.Circle:case u.Ellipse:case u.Rect:case u.RoundedRect:case u.Polygon:t=this.createGraphics(r);break;case u.Img:case u.Sprite:t=this.createSprite(r)}if(!t)throw new Error("no have mask instance, check your mask params: "+r.type);var n=this.containerManager.getContainer(e.gameObject.id);n.mask=t,n.addChild(t)},r.prototype.remove=function(e){var t=this.containerManager.getContainer(e.gameObject.id);t.removeChild(t.mask),t.mask.destroy({children:!0}),t.mask=null,delete this.maskSpriteCache[e.gameObject.id]},r.prototype.change=function(e){if(!this.changedCache[e.gameObject.id]){var t=e.component;"type"===e.prop.prop[0]?(this.changedCache[e.gameObject.id]=!0,[u.Sprite,u.Img].indexOf(t.type)>-1||t._lastType!==t.type?(this.remove(e),this.add(e),t._lastType=t.type):this.redrawGraphics(e)):"style"===e.prop.prop[0]?[u.Sprite,u.Img].indexOf(t.type)>-1?this.changeSpriteStyle(t):this.redrawGraphics(e):("resource"===e.prop.prop[0]||"spriteName"===e.prop.prop[0])&&(this.changedCache[e.gameObject.id]=!0,this.changeSprite(t))}},r.prototype.createGraphics=function(e){var t=new o.Graphics;return this.draw(t,e),t},r.prototype.redrawGraphics=function(e){var t=this.containerManager.getContainer(e.gameObject.id).mask;t.clear(),this.draw(t,e.component)},r.prototype.draw=function(e,t){var r,n,o=[];try{for(var i=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(f[t.type]),a=i.next();!a.done;a=i.next()){var p=a.value;o.push(t.style[p])}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.beginFill(0,1),e[g[t.type]].apply(e,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(l(arguments[t]));return e}(o)),e.endFill()},r.prototype.createSprite=function(e){var t=new o.Sprite(null);return this.maskSpriteCache[e.gameObject.id]=t,this.setSprite(e,t),t.sprite},r.prototype.changeSpriteStyle=function(e){var t=this.maskSpriteCache[e.gameObject.id];t.sprite.width=e.style.width,t.sprite.height=e.style.height,t.sprite.position.x=e.style.x,t.sprite.position.y=e.style.y},r.prototype.changeSprite=function(e){var t=this.maskSpriteCache[e.gameObject.id];this.setSprite(e,t)},r.prototype.setSprite=function(e,r){return n=this,o=void 0,a=function(){var n,o,i,a;return c(this,(function(p){switch(p.label){case 0:return p.trys.push([0,2,,3]),o=this.increaseAsyncId(e.gameObject.id),[4,t.resource.getResource(e.resource)];case 1:return n=p.sent(),this.validateAsyncId(e.gameObject.id,o)?[3,3]:[2];case 2:throw p.sent(),new Error("mask resource load error");case 3:return e.type===u.Sprite?(i=e.resource+"_s|r|c_"+e.spriteName,a=n.instance[i],r.image=a):r.image=n.data.image,r.sprite.width=e.style.width,r.sprite.height=e.style.height,r.sprite.position.x=e.style.x,r.sprite.position.y=e.style.y,[2]}}))},new((i=void 0)||(i=Promise))((function(e,t){function r(e){try{s(a.next(e))}catch(e){t(e)}}function p(e){try{s(a.throw(e))}catch(e){t(e)}}function s(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(r,p)}s((a=a.apply(n,o||[])).next())}));var n,o,i,a},r.systemName="Mask",r=p([t.decorators.componentObserver({Mask:["type",{prop:["style"],deep:!0},"resource","spriteName"]})],r)}(n.Renderer),v=m;exports.Mask=h,exports.MaskSystem=v;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("@eva/inspector-decorator"),r=require("@eva/plugin-renderer"),n=require("@eva/renderer-adapter"),o=function(e,t){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])},o(e,t)};function i(e,t){function r(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=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++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.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],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}function s(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}exports.MASK_TYPE=void 0,function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(exports.MASK_TYPE||(exports.MASK_TYPE={}));var p,l=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.style={},t.resource="",t.spriteName="",t}return i(r,e),r.prototype.init=function(e){Object.assign(this,e)},r.componentName="Mask",a([t.type("string")],r.prototype,"resource",void 0),a([t.type("string")],r.prototype,"spriteName",void 0),r}(e.Component),h=l,u={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]},y={Circle:"drawCircle",Ellipse:"drawEllipse",Rect:"drawRect",RoundedRect:"drawRoundedRect",Polygon:"drawPolygon"};!function(e){e.Circle="Circle",e.Ellipse="Ellipse",e.Rect="Rect",e.RoundedRect="RoundedRect",e.Polygon="Polygon",e.Img="Img",e.Sprite="Sprite"}(p||(p={}));var d=function(t){function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Mask",e.changedCache={},e.maskSpriteCache={},e}return i(o,t),o.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},o.prototype.rendererUpdate=function(){this.changedCache={}},o.prototype.componentChanged=function(t){if("Mask"===t.component.name)switch(t.type){case e.OBSERVER_TYPE.ADD:this.add(t);break;case e.OBSERVER_TYPE.REMOVE:this.remove(t);break;case e.OBSERVER_TYPE.CHANGE:this.change(t)}},o.prototype.add=function(e){var t,r=e.component;if(!(r.type in p))throw new Error("no have Mask type: "+r.type);if(!r.style)throw new Error("no have Mask style: "+r.type);switch(r.type){case p.Circle:case p.Ellipse:case p.Rect:case p.RoundedRect:case p.Polygon:t=this.createGraphics(r);break;case p.Img:case p.Sprite:t=this.createSprite(r)}if(!t)throw new Error("no have mask instance, check your mask params: "+r.type);var n=this.containerManager.getContainer(e.gameObject.id);n.mask=t,n.addChild(t)},o.prototype.remove=function(e){var t=this.containerManager.getContainer(e.gameObject.id);t.removeChild(t.mask),t.mask.destroy({children:!0}),t.mask=null,delete this.maskSpriteCache[e.gameObject.id]},o.prototype.change=function(e){if(!this.changedCache[e.gameObject.id]){var t=e.component;"type"===e.prop.prop[0]?(this.changedCache[e.gameObject.id]=!0,[p.Sprite,p.Img].indexOf(t.type)>-1||t._lastType!==t.type?(this.remove(e),this.add(e),t._lastType=t.type):this.redrawGraphics(e)):"style"===e.prop.prop[0]?[p.Sprite,p.Img].indexOf(t.type)>-1?this.changeSpriteStyle(t):this.redrawGraphics(e):("resource"===e.prop.prop[0]||"spriteName"===e.prop.prop[0])&&(this.changedCache[e.gameObject.id]=!0,this.changeSprite(t))}},o.prototype.createGraphics=function(e){var t=new n.Graphics;return this.draw(t,e),t},o.prototype.redrawGraphics=function(e){var t=this.containerManager.getContainer(e.gameObject.id).mask;t.clear(),this.draw(t,e.component)},o.prototype.draw=function(e,t){var r,n,o=[];try{for(var i=function(e){var t="function"==typeof Symbol&&e[Symbol.iterator],r=0;return t?t.call(e):{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}}}(u[t.type]),a=i.next();!a.done;a=i.next()){var c=a.value;o.push(t.style[c])}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}e.beginFill(0,1),e[y[t.type]].apply(e,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(s(arguments[t]));return e}(o)),e.endFill()},o.prototype.createSprite=function(e){var t=new n.Sprite(null);return this.maskSpriteCache[e.gameObject.id]=t,this.setSprite(e,t),t.sprite},o.prototype.changeSpriteStyle=function(e){var t=this.maskSpriteCache[e.gameObject.id];t.sprite.width=e.style.width,t.sprite.height=e.style.height,t.sprite.position.x=e.style.x,t.sprite.position.y=e.style.y},o.prototype.changeSprite=function(e){var t=this.maskSpriteCache[e.gameObject.id];this.setSprite(e,t)},o.prototype.setSprite=function(t,r){return n=this,o=void 0,a=function(){var n,o,i,a;return c(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),o=this.increaseAsyncId(t.gameObject.id),[4,e.resource.getResource(t.resource)];case 1:return n=c.sent(),this.validateAsyncId(t.gameObject.id,o)?[3,3]:[2];case 2:throw c.sent(),new Error("mask resource load error");case 3:return t.type===p.Sprite?(i=t.resource+"_s|r|c_"+t.spriteName,a=n.instance[i],r.image=a):r.image=n.data.image,r.sprite.width=t.style.width,r.sprite.height=t.style.height,r.sprite.position.x=t.style.x,r.sprite.position.y=t.style.y,[2]}}))},new((i=void 0)||(i=Promise))((function(e,t){function r(e){try{s(a.next(e))}catch(e){t(e)}}function c(e){try{s(a.throw(e))}catch(e){t(e)}}function s(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(r,c)}s((a=a.apply(n,o||[])).next())}));var n,o,i,a},o.systemName="Mask",o=a([e.decorators.componentObserver({Mask:["type",{prop:["style"],deep:!0},"resource","spriteName"]})],o)}(r.Renderer);exports.Mask=h,exports.MaskSystem=d;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="pixi.js" />
2
-
3
2
  import { Component } from '@eva/eva.js';
4
3
  import { ComponentChanged } from '@eva/eva.js';
5
4
  import { ContainerManager } from '@eva/plugin-renderer';
@@ -12,7 +11,6 @@ import { Sprite } from '@eva/renderer-adapter';
12
11
  export declare class Mask extends Component<MaskParams> {
13
12
  static componentName: string;
14
13
  _lastType: MaskParams['type'];
15
- mask_type: string;
16
14
  type: MaskParams['type'];
17
15
  style?: MaskParams['style'];
18
16
  resource?: string;
@@ -1,5 +1,5 @@
1
1
  import { Component, OBSERVER_TYPE, decorators, resource } from '@eva/eva.js';
2
- import { Field } from '@eva/inspector-decorator';
2
+ import { type } from '@eva/inspector-decorator';
3
3
  import { RendererSystem, Renderer } from '@eva/plugin-renderer';
4
4
  import { Graphics, Sprite } from '@eva/renderer-adapter';
5
5
 
@@ -39,10 +39,6 @@ function __decorate(decorators, target, key, desc) {
39
39
  return c > 3 && r && Object.defineProperty(target, key, r), r;
40
40
  }
41
41
 
42
- function __metadata(metadataKey, metadataValue) {
43
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
44
- }
45
-
46
42
  function __awaiter(thisArg, _arguments, P, generator) {
47
43
  return new (P || (P = Promise))(function (resolve, reject) {
48
44
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -114,7 +110,6 @@ function __spread() {
114
110
  return ar;
115
111
  }
116
112
 
117
- var _a;
118
113
  var MASK_TYPE$1;
119
114
  (function (MASK_TYPE) {
120
115
  MASK_TYPE["Circle"] = "Circle";
@@ -125,31 +120,6 @@ var MASK_TYPE$1;
125
120
  MASK_TYPE["Img"] = "Img";
126
121
  MASK_TYPE["Sprite"] = "Sprite";
127
122
  })(MASK_TYPE$1 || (MASK_TYPE$1 = {}));
128
- var MaskStyle = (function () {
129
- function MaskStyle() {
130
- }
131
- __decorate([
132
- Field({ step: 1 }),
133
- __metadata("design:type", Number)
134
- ], MaskStyle.prototype, "x", void 0);
135
- __decorate([
136
- Field({ step: 1 }),
137
- __metadata("design:type", Number)
138
- ], MaskStyle.prototype, "y", void 0);
139
- __decorate([
140
- Field({ step: 0.1, if: function (mask) { return mask.type === MASK_TYPE$1.Circle || mask.type === MASK_TYPE$1.RoundedRect; } }),
141
- __metadata("design:type", Number)
142
- ], MaskStyle.prototype, "radius", void 0);
143
- __decorate([
144
- Field({ step: 1, if: function (mask) { return mask.type !== MASK_TYPE$1.Circle; } }),
145
- __metadata("design:type", Number)
146
- ], MaskStyle.prototype, "width", void 0);
147
- __decorate([
148
- Field({ step: 1, if: function (mask) { return mask.type !== MASK_TYPE$1.Circle; } }),
149
- __metadata("design:type", Number)
150
- ], MaskStyle.prototype, "height", void 0);
151
- return MaskStyle;
152
- }());
153
123
  var Mask$2 = (function (_super) {
154
124
  __extends(Mask, _super);
155
125
  function Mask() {
@@ -164,31 +134,11 @@ var Mask$2 = (function (_super) {
164
134
  };
165
135
  Mask.componentName = 'Mask';
166
136
  __decorate([
167
- Field({
168
- type: 'selector',
169
- options: (_a = {},
170
- _a[MASK_TYPE$1.Circle] = MASK_TYPE$1.Circle,
171
- _a[MASK_TYPE$1.Ellipse] = MASK_TYPE$1.Ellipse,
172
- _a[MASK_TYPE$1.Img] = MASK_TYPE$1.Img,
173
- _a[MASK_TYPE$1.Rect] = MASK_TYPE$1.Rect,
174
- _a[MASK_TYPE$1.RoundedRect] = MASK_TYPE$1.RoundedRect,
175
- _a),
176
- alias: 'type',
177
- default: MASK_TYPE$1.Circle,
178
- }),
179
- __metadata("design:type", String)
180
- ], Mask.prototype, "mask_type", void 0);
181
- __decorate([
182
- Field(function () { return MaskStyle; }),
183
- __metadata("design:type", Object)
184
- ], Mask.prototype, "style", void 0);
185
- __decorate([
186
- Field({
187
- type: 'resource',
188
- if: function (mask) { return mask.type === MASK_TYPE$1.Img || MASK_TYPE$1.Sprite; },
189
- }),
190
- __metadata("design:type", String)
137
+ type('string')
191
138
  ], Mask.prototype, "resource", void 0);
139
+ __decorate([
140
+ type('string')
141
+ ], Mask.prototype, "spriteName", void 0);
192
142
  return Mask;
193
143
  }(Component));
194
144
  var Mask$3 = Mask$2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-mask",
3
- "version": "1.2.7-editor.9",
3
+ "version": "1.2.8-alpha.0",
4
4
  "description": "@eva/plugin-renderer-mask",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-mask.esm.js",
@@ -18,10 +18,10 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/inspector-decorator": "0.1.0-alpha.2",
22
- "@eva/plugin-renderer": "1.2.7-editor.9",
23
- "@eva/renderer-adapter": "1.2.7-editor.9",
24
- "@eva/eva.js": "1.2.7-editor.9",
21
+ "@eva/inspector-decorator": "^0.0.5",
22
+ "@eva/plugin-renderer": "1.2.8-alpha.0",
23
+ "@eva/renderer-adapter": "1.2.8-alpha.0",
24
+ "@eva/eva.js": "1.2.8-alpha.0",
25
25
  "pixi.js": "^4.8.7"
26
26
  }
27
27
  }