@eva/plugin-renderer-mask 1.2.7-editor.0 → 1.2.7-editor.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.
@@ -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 (b.hasOwnProperty(p)) d[p] = b[p];
17
+ if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
18
18
  }
19
19
  };
20
20
 
@@ -22,6 +22,8 @@ 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
+
25
27
  _extendStatics(d, b);
26
28
 
27
29
  function __() {
@@ -31,6 +33,22 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
31
33
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
32
34
  }
33
35
 
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
+
34
52
  function __decorate(decorators, target, key, desc) {
35
53
  var c = arguments.length,
36
54
  r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
@@ -41,6 +59,10 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
41
59
  return c > 3 && r && Object.defineProperty(target, key, r), r;
42
60
  }
43
61
 
62
+ function __metadata(metadataKey, metadataValue) {
63
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
64
+ }
65
+
44
66
  function __awaiter(thisArg, _arguments, P, generator) {
45
67
  function adopt(value) {
46
68
  return value instanceof P ? value : new P(function (resolve) {
@@ -236,24 +258,106 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
236
258
  return ar;
237
259
  }
238
260
 
239
- function getIDEPropsPropertyObj(target, propertyKey) {
240
- if (!target.constructor.IDEProps) {
241
- target.constructor.IDEProps = {};
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;
242
286
  }
243
287
 
244
- if (!target.constructor.IDEProps[propertyKey]) {
245
- target.constructor.IDEProps[propertyKey] = {};
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';
246
296
  }
247
297
 
248
- var propertyObj = target.constructor.IDEProps[propertyKey];
249
- return propertyObj;
298
+ if (type === Number) {
299
+ return 'number';
300
+ }
301
+
302
+ if (type === Boolean) {
303
+ return 'boolean';
304
+ }
305
+
306
+ return 'unknown';
250
307
  }
251
308
 
252
- function type(type) {
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
+ }
327
+ }
328
+
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
+ };
343
+ }
344
+
345
+ return {
346
+ options: returnTypeFuncOrOptions || {}
347
+ };
348
+ }
349
+
350
+ function Field(returnTypeFunction, maybeOptions) {
253
351
  return function (target, propertyKey) {
254
- var prop = getIDEPropsPropertyObj(target, propertyKey);
255
- prop.key = propertyKey;
256
- prop.type = type;
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);
257
361
  };
258
362
  }
259
363
 
@@ -287,9 +391,9 @@ var _EVA_IIFE_mask = function (exports, eva_js, pluginRenderer, rendererAdapter)
287
391
 
288
392
  Mask.componentName = 'Mask';
289
393
 
290
- __decorate([type('string')], Mask.prototype, "resource", void 0);
394
+ __decorate([Field(), __metadata("design:type", String)], Mask.prototype, "resource", void 0);
291
395
 
292
- __decorate([type('string')], Mask.prototype, "spriteName", void 0);
396
+ __decorate([Field(), __metadata("design:type", String)], Mask.prototype, "spriteName", void 0);
293
397
 
294
398
  return Mask;
295
399
  }(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}).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])})(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={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"}(u||(u={}));var f=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?(this.remove(e),this.add(e)):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.")}(d[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(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);return e.Mask=h,e.MaskSystem=f,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||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}).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])})(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}).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 l(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 u(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 h="IDE_PROPERTY_METADATA";function d(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 f(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);d(r,n,o.options,o.returnTypeFunc)}}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 g,m=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",c([f(),s("design:type",String)],t.prototype,"resource",void 0),c([f(),s("design:type",String)],t.prototype,"spriteName",void 0),t}(t.Component),w={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]},v={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"}(g||(g={}));var b=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 g))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 g.Circle:case g.Ellipse:case g.Rect:case g.RoundedRect:case g.Polygon:t=this.createGraphics(r);break;case g.Img:case g.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,[g.Sprite,g.Img].indexOf(t.type)>-1?(this.remove(e),this.add(e)):this.redrawGraphics(e)):"style"===e.prop.prop[0]?[g.Sprite,g.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.")}(w[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[v[t.type]].apply(e,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(u(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 l(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===g.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);return e.Mask=m,e.MaskSystem=b,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,8 +1,8 @@
1
1
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
- import { __extends, __decorate, __values, __spread, __awaiter, __generator } from 'tslib';
3
+ import { __extends, __decorate, __metadata, __values, __spread, __awaiter, __generator } from 'tslib';
4
4
  import { Component, OBSERVER_TYPE, resource, decorators } from '@eva/eva.js/dist/miniprogram';
5
- import { type } from '@eva/inspector-decorator';
5
+ import { Field } from '@eva/inspector-decorator';
6
6
  import { RendererSystem, Renderer } from '@eva/plugin-renderer/dist/miniprogram';
7
7
  import { Graphics, Sprite } from '@eva/renderer-adapter/dist/miniprogram';
8
8
  var MASK_TYPE$1;
@@ -35,9 +35,9 @@ var Mask$2 = function (_super) {
35
35
 
36
36
  Mask.componentName = 'Mask';
37
37
 
38
- __decorate([type('string')], Mask.prototype, "resource", void 0);
38
+ __decorate([Field(), __metadata("design:type", String)], Mask.prototype, "resource", void 0);
39
39
 
40
- __decorate([type('string')], Mask.prototype, "spriteName", void 0);
40
+ __decorate([Field(), __metadata("design:type", String)], Mask.prototype, "spriteName", void 0);
41
41
 
42
42
  return Mask;
43
43
  }(Component);
@@ -43,6 +43,10 @@ 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
+
46
50
  function __awaiter(thisArg, _arguments, P, generator) {
47
51
  return new (P || (P = Promise))(function (resolve, reject) {
48
52
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -138,10 +142,12 @@ var Mask$2 = (function (_super) {
138
142
  };
139
143
  Mask.componentName = 'Mask';
140
144
  __decorate([
141
- inspectorDecorator.type('string')
145
+ inspectorDecorator.Field(),
146
+ __metadata("design:type", String)
142
147
  ], Mask.prototype, "resource", void 0);
143
148
  __decorate([
144
- inspectorDecorator.type('string')
149
+ inspectorDecorator.Field(),
150
+ __metadata("design:type", String)
145
151
  ], Mask.prototype, "spriteName", void 0);
146
152
  return Mask;
147
153
  }(eva_js.Component));
@@ -1 +1 @@
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])})(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={Circle:["x","y","radius"],Ellipse:["x","y","width","height"],Rect:["x","y","width","height"],RoundedRect:["x","y","width","height","radius"],Polygon:["paths"]},u={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 y=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?(this.remove(e),this.add(e)):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}}}}(h[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[u[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=l,exports.MaskSystem=y;
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"),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])})(e,t)};function o(e,t){function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function a(e,t,r,n){var i,o=arguments.length,a=o<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--)(i=e[c])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function s(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,c])}}}function p(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.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 l,u=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.style={},t.resource="",t.spriteName="",t}return o(r,e),r.prototype.init=function(e){Object.assign(this,e)},r.componentName="Mask",a([t.Field(),c("design:type",String)],r.prototype,"resource",void 0),a([t.Field(),c("design:type",String)],r.prototype,"spriteName",void 0),r}(e.Component),h={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"}(l||(l={}));var d=function(t){function i(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="Mask",e.changedCache={},e.maskSpriteCache={},e}return o(i,t),i.prototype.init=function(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)},i.prototype.rendererUpdate=function(){this.changedCache={}},i.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)}},i.prototype.add=function(e){var t,r=e.component;if(!(r.type in l))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 l.Circle:case l.Ellipse:case l.Rect:case l.RoundedRect:case l.Polygon:t=this.createGraphics(r);break;case l.Img:case l.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)},i.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]},i.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,[l.Sprite,l.Img].indexOf(t.type)>-1?(this.remove(e),this.add(e)):this.redrawGraphics(e)):"style"===e.prop.prop[0]?[l.Sprite,l.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))}},i.prototype.createGraphics=function(e){var t=new n.Graphics;return this.draw(t,e),t},i.prototype.redrawGraphics=function(e){var t=this.containerManager.getContainer(e.gameObject.id).mask;t.clear(),this.draw(t,e.component)},i.prototype.draw=function(e,t){var r,n,i=[];try{for(var o=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}}}}(h[t.type]),a=o.next();!a.done;a=o.next()){var c=a.value;i.push(t.style[c])}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}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(p(arguments[t]));return e}(i)),e.endFill()},i.prototype.createSprite=function(e){var t=new n.Sprite(null);return this.maskSpriteCache[e.gameObject.id]=t,this.setSprite(e,t),t.sprite},i.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},i.prototype.changeSprite=function(e){var t=this.maskSpriteCache[e.gameObject.id];this.setSprite(e,t)},i.prototype.setSprite=function(t,r){return n=this,i=void 0,a=function(){var n,i,o,a;return s(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),i=this.increaseAsyncId(t.gameObject.id),[4,e.resource.getResource(t.resource)];case 1:return n=c.sent(),this.validateAsyncId(t.gameObject.id,i)?[3,3]:[2];case 2:throw c.sent(),new Error("mask resource load error");case 3:return t.type===l.Sprite?(o=t.resource+"_s|r|c_"+t.spriteName,a=n.instance[o],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((o=void 0)||(o=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 o((function(e){e(t.value)})).then(r,c)}s((a=a.apply(n,i||[])).next())}));var n,i,o,a},i.systemName="Mask",i=a([e.decorators.componentObserver({Mask:["type",{prop:["style"],deep:!0},"resource","spriteName"]})],i)}(r.Renderer);exports.Mask=u,exports.MaskSystem=d;
@@ -1,5 +1,5 @@
1
1
  import { Component, OBSERVER_TYPE, decorators, resource } from '@eva/eva.js';
2
- import { type } from '@eva/inspector-decorator';
2
+ import { Field } 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,6 +39,10 @@ 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
+
42
46
  function __awaiter(thisArg, _arguments, P, generator) {
43
47
  return new (P || (P = Promise))(function (resolve, reject) {
44
48
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -134,10 +138,12 @@ var Mask$2 = (function (_super) {
134
138
  };
135
139
  Mask.componentName = 'Mask';
136
140
  __decorate([
137
- type('string')
141
+ Field(),
142
+ __metadata("design:type", String)
138
143
  ], Mask.prototype, "resource", void 0);
139
144
  __decorate([
140
- type('string')
145
+ Field(),
146
+ __metadata("design:type", String)
141
147
  ], Mask.prototype, "spriteName", void 0);
142
148
  return Mask;
143
149
  }(Component));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-mask",
3
- "version": "1.2.7-editor.0",
3
+ "version": "1.2.7-editor.1",
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.0.5",
22
- "@eva/plugin-renderer": "1.2.7-editor.0",
23
- "@eva/renderer-adapter": "1.2.7-editor.0",
24
- "@eva/eva.js": "1.2.7-editor.0",
21
+ "@eva/inspector-decorator": "0.1.0-alpha.1",
22
+ "@eva/plugin-renderer": "1.2.7-editor.1",
23
+ "@eva/renderer-adapter": "1.2.7-editor.1",
24
+ "@eva/eva.js": "1.2.7-editor.1",
25
25
  "pixi.js": "^4.8.7"
26
26
  }
27
27
  }