@eva/plugin-renderer-graphics 2.0.1-beta.9 → 2.0.2-beta.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 +1 @@
1
- globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_graphics=function(e,r,n,t){"use strict";class i extends n.Graphics{}class s extends r.Component{constructor(){super(...arguments),this.graphics=null}init(){this.graphics=new i}}function c(e,r,n,t){return new(n||(n=Promise))((function(i,s){function c(e){try{o(t.next(e))}catch(e){s(e)}}function a(e){try{o(t.throw(e))}catch(e){s(e)}}function o(e){var r;e.done?i(e.value):(r=e.value,r instanceof n?r:new n((function(e){e(r)}))).then(c,a)}o((t=t.apply(e,r||[])).next())}))}s.componentName="Graphics";let a=class extends t.Renderer{constructor(){super(...arguments),this.name="Graphics"}init(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){return c(this,void 0,void 0,(function*(){e.type===r.OBSERVER_TYPE.ADD?this.containerManager.getContainer(e.gameObject.id).addChildAt(e.component.graphics,0):e.type===r.OBSERVER_TYPE.REMOVE&&(this.containerManager.getContainer(e.gameObject.id).removeChild(e.component.graphics),e.component.graphics.destroy({children:!0}))}))}};a.systemName="Graphics",a=function(e,r,n,t){var i,s=arguments.length,c=s<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,n):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,r,n,t);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(c=(s<3?i(c):s>3?i(r,n,c):i(r,n))||c);return s>3&&c&&Object.defineProperty(r,n,c),c}([r.decorators.componentObserver({Graphics:["graphics"]})],a);var o=a;return e.Graphics=s,e.GraphicsSystem=o,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,PIXI,EVA.plugin.renderer);globalThis.EVA.plugin.renderer.graphics=globalThis.EVA.plugin.renderer.graphics||_EVA_IIFE_graphics;
1
+ globalThis.EVA=globalThis.EVA||{},globalThis.EVA.plugin=globalThis.EVA.plugin||{},globalThis.EVA.plugin.renderer=globalThis.EVA.plugin.renderer||{};var _EVA_IIFE_graphics=function(e,r,n,t){"use strict";class i extends n.Graphics{}class s extends r.Component{constructor(){super(...arguments),this.graphics=null}init(){this.graphics=new i}}function c(e,r,n,t){return new(n||(n=Promise))(function(i,s){function c(e){try{o(t.next(e))}catch(e){s(e)}}function a(e){try{o(t.throw(e))}catch(e){s(e)}}function o(e){var r;e.done?i(e.value):(r=e.value,r instanceof n?r:new n(function(e){e(r)})).then(c,a)}o((t=t.apply(e,r||[])).next())})}s.componentName="Graphics";let a=class extends t.Renderer{constructor(){super(...arguments),this.name="Graphics"}init(){this.renderSystem=this.game.getSystem(t.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(e){return c(this,void 0,void 0,function*(){e.type===r.OBSERVER_TYPE.ADD?this.containerManager.getContainer(e.gameObject.id).addChildAt(e.component.graphics,0):e.type===r.OBSERVER_TYPE.REMOVE&&(this.containerManager.getContainer(e.gameObject.id).removeChild(e.component.graphics),e.component.graphics.destroy({children:!0}))})}};a.systemName="Graphics",a=function(e,r,n,t){var i,s=arguments.length,c=s<3?r:null===t?t=Object.getOwnPropertyDescriptor(r,n):t;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,r,n,t);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(c=(s<3?i(c):s>3?i(r,n,c):i(r,n))||c);return s>3&&c&&Object.defineProperty(r,n,c),c}([r.decorators.componentObserver({Graphics:["graphics"]})],a);var o=a;return e.Graphics=s,e.GraphicsSystem=o,Object.defineProperty(e,"__esModule",{value:!0}),e}({},EVA,PIXI,EVA.plugin.renderer);globalThis.EVA.plugin.renderer.graphics=globalThis.EVA.plugin.renderer.graphics||_EVA_IIFE_graphics;
@@ -9,30 +9,65 @@ var pluginRenderer = require('@eva/plugin-renderer');
9
9
  class Graphics$3 extends pixi_js.Graphics {
10
10
  }
11
11
 
12
+ /**
13
+ * 图形绘制组件
14
+ *
15
+ * Graphics 组件提供矢量图形绘制能力,可以动态绘制各种几何图形。
16
+ * 它基于 PixiJS Graphics,支持绘制线条、矩形、圆形、多边形等,
17
+ * 适用于调试可视化、动态UI、简单特效等场景。
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const shape = new GameObject('shape');
22
+ * const graphics = new Graphics();
23
+ * shape.addComponent(graphics);
24
+ *
25
+ * // 在组件初始化后使用 graphics 对象绘制
26
+ * graphics.graphics.clear();
27
+ * graphics.graphics.beginFill(0xff0000);
28
+ * graphics.graphics.drawCircle(100, 100, 50); // 绘制圆形
29
+ * graphics.graphics.endFill();
30
+ *
31
+ * // 绘制矩形
32
+ * graphics.graphics.lineStyle(2, 0x0000ff);
33
+ * graphics.graphics.drawRect(0, 0, 100, 100);
34
+ *
35
+ * // 绘制多边形
36
+ * graphics.graphics.beginFill(0x00ff00);
37
+ * graphics.graphics.drawPolygon([0,0, 100,0, 100,100, 0,100]);
38
+ * graphics.graphics.endFill();
39
+ * ```
40
+ */
12
41
  class Graphics$2 extends eva_js.Component {
13
42
  constructor() {
14
43
  super(...arguments);
44
+ /** PixiJS Graphics 实例,用于绘制矢量图形 */
15
45
  this.graphics = null;
16
46
  }
47
+ /**
48
+ * 初始化组件
49
+ * 创建 Graphics 绘图对象实例
50
+ */
17
51
  init() {
18
52
  this.graphics = new Graphics$3();
19
53
  }
20
54
  }
55
+ /** 组件名称 */
21
56
  Graphics$2.componentName = 'Graphics';
22
57
 
23
- /*! *****************************************************************************
24
- Copyright (c) Microsoft Corporation. All rights reserved.
25
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
26
- this file except in compliance with the License. You may obtain a copy of the
27
- License at http://www.apache.org/licenses/LICENSE-2.0
58
+ /******************************************************************************
59
+ Copyright (c) Microsoft Corporation.
28
60
 
29
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
30
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
31
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
32
- MERCHANTABLITY OR NON-INFRINGEMENT.
61
+ Permission to use, copy, modify, and/or distribute this software for any
62
+ purpose with or without fee is hereby granted.
33
63
 
34
- See the Apache Version 2.0 License for specific language governing permissions
35
- and limitations under the License.
64
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
65
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
66
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
67
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
68
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
69
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
70
+ PERFORMANCE OF THIS SOFTWARE.
36
71
  ***************************************************************************** */
37
72
 
38
73
  function __decorate(decorators, target, key, desc) {
@@ -43,13 +78,19 @@ function __decorate(decorators, target, key, desc) {
43
78
  }
44
79
 
45
80
  function __awaiter(thisArg, _arguments, P, generator) {
81
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
46
82
  return new (P || (P = Promise))(function (resolve, reject) {
47
83
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
48
84
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
49
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
85
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
50
86
  step((generator = generator.apply(thisArg, _arguments || [])).next());
51
87
  });
52
- }
88
+ }
89
+
90
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
91
+ var e = new Error(message);
92
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
93
+ };
53
94
 
54
95
  let Graphics = class Graphics extends pluginRenderer.Renderer {
55
96
  constructor() {
@@ -1,16 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("pixi.js"),r=require("@eva/plugin-renderer");class n extends t.Graphics{}class i extends e.Component{constructor(){super(...arguments),this.graphics=null}init(){this.graphics=new n}}i.componentName="Graphics";let s=class extends r.Renderer{constructor(){super(...arguments),this.name="Graphics"}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(t){return r=this,n=void 0,s=function*(){t.type===e.OBSERVER_TYPE.ADD?this.containerManager.getContainer(t.gameObject.id).addChildAt(t.component.graphics,0):t.type===e.OBSERVER_TYPE.REMOVE&&(this.containerManager.getContainer(t.gameObject.id).removeChild(t.component.graphics),t.component.graphics.destroy({children:!0}))},new((i=void 0)||(i=Promise))((function(e,t){function c(e){try{a(s.next(e))}catch(e){t(e)}}function o(e){try{a(s.throw(e))}catch(e){t(e)}}function a(t){t.done?e(t.value):new i((function(e){e(t.value)})).then(c,o)}a((s=s.apply(r,n||[])).next())}));var r,n,i,s}};s.systemName="Graphics",s=
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
- this file except in compliance with the License. You may obtain a copy of the
6
- License at http://www.apache.org/licenses/LICENSE-2.0
7
-
8
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
10
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11
- MERCHANTABLITY OR NON-INFRINGEMENT.
12
-
13
- See the Apache Version 2.0 License for specific language governing permissions
14
- and limitations under the License.
15
- ***************************************************************************** */
16
- function(e,t,r,n){var i,s=arguments.length,c=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,n);else for(var o=e.length-1;o>=0;o--)(i=e[o])&&(c=(s<3?i(c):s>3?i(t,r,c):i(t,r))||c);return s>3&&c&&Object.defineProperty(t,r,c),c}([e.decorators.componentObserver({Graphics:["graphics"]})],s);var c=s;exports.Graphics=i,exports.GraphicsSystem=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@eva/eva.js"),t=require("pixi.js"),r=require("@eva/plugin-renderer");class n extends t.Graphics{}class s extends e.Component{constructor(){super(...arguments),this.graphics=null}init(){this.graphics=new n}}function i(e,t,r,n){return new(r||(r=Promise))(function(s,i){function o(e){try{a(n.next(e))}catch(e){i(e)}}function c(e){try{a(n.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(o,c)}a((n=n.apply(e,t||[])).next())})}s.componentName="Graphics","function"==typeof SuppressedError&&SuppressedError;let o=class extends r.Renderer{constructor(){super(...arguments),this.name="Graphics"}init(){this.renderSystem=this.game.getSystem(r.RendererSystem),this.renderSystem.rendererManager.register(this)}componentChanged(t){return i(this,void 0,void 0,function*(){t.type===e.OBSERVER_TYPE.ADD?this.containerManager.getContainer(t.gameObject.id).addChildAt(t.component.graphics,0):t.type===e.OBSERVER_TYPE.REMOVE&&(this.containerManager.getContainer(t.gameObject.id).removeChild(t.component.graphics),t.component.graphics.destroy({children:!0}))})}};o.systemName="Graphics",o=function(e,t,r,n){var s,i=arguments.length,o=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;c>=0;c--)(s=e[c])&&(o=(i<3?s(o):i>3?s(t,r,o):s(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}([e.decorators.componentObserver({Graphics:["graphics"]})],o);var c=o;exports.Graphics=s,exports.GraphicsSystem=c;
@@ -6,9 +6,44 @@ import { Renderer } from '@eva/plugin-renderer';
6
6
  import { RendererManager } from '@eva/plugin-renderer';
7
7
  import { RendererSystem } from '@eva/plugin-renderer';
8
8
 
9
+ /**
10
+ * 图形绘制组件
11
+ *
12
+ * Graphics 组件提供矢量图形绘制能力,可以动态绘制各种几何图形。
13
+ * 它基于 PixiJS Graphics,支持绘制线条、矩形、圆形、多边形等,
14
+ * 适用于调试可视化、动态UI、简单特效等场景。
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const shape = new GameObject('shape');
19
+ * const graphics = new Graphics();
20
+ * shape.addComponent(graphics);
21
+ *
22
+ * // 在组件初始化后使用 graphics 对象绘制
23
+ * graphics.graphics.clear();
24
+ * graphics.graphics.beginFill(0xff0000);
25
+ * graphics.graphics.drawCircle(100, 100, 50); // 绘制圆形
26
+ * graphics.graphics.endFill();
27
+ *
28
+ * // 绘制矩形
29
+ * graphics.graphics.lineStyle(2, 0x0000ff);
30
+ * graphics.graphics.drawRect(0, 0, 100, 100);
31
+ *
32
+ * // 绘制多边形
33
+ * graphics.graphics.beginFill(0x00ff00);
34
+ * graphics.graphics.drawPolygon([0,0, 100,0, 100,100, 0,100]);
35
+ * graphics.graphics.endFill();
36
+ * ```
37
+ */
9
38
  export declare class Graphics extends Component {
39
+ /** 组件名称 */
10
40
  static componentName: string;
41
+ /** PixiJS Graphics 实例,用于绘制矢量图形 */
11
42
  graphics: Graphics_2;
43
+ /**
44
+ * 初始化组件
45
+ * 创建 Graphics 绘图对象实例
46
+ */
12
47
  init(): void;
13
48
  }
14
49
 
@@ -5,30 +5,65 @@ import { Renderer, RendererSystem } from '@eva/plugin-renderer';
5
5
  class Graphics$3 extends Graphics$4 {
6
6
  }
7
7
 
8
+ /**
9
+ * 图形绘制组件
10
+ *
11
+ * Graphics 组件提供矢量图形绘制能力,可以动态绘制各种几何图形。
12
+ * 它基于 PixiJS Graphics,支持绘制线条、矩形、圆形、多边形等,
13
+ * 适用于调试可视化、动态UI、简单特效等场景。
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const shape = new GameObject('shape');
18
+ * const graphics = new Graphics();
19
+ * shape.addComponent(graphics);
20
+ *
21
+ * // 在组件初始化后使用 graphics 对象绘制
22
+ * graphics.graphics.clear();
23
+ * graphics.graphics.beginFill(0xff0000);
24
+ * graphics.graphics.drawCircle(100, 100, 50); // 绘制圆形
25
+ * graphics.graphics.endFill();
26
+ *
27
+ * // 绘制矩形
28
+ * graphics.graphics.lineStyle(2, 0x0000ff);
29
+ * graphics.graphics.drawRect(0, 0, 100, 100);
30
+ *
31
+ * // 绘制多边形
32
+ * graphics.graphics.beginFill(0x00ff00);
33
+ * graphics.graphics.drawPolygon([0,0, 100,0, 100,100, 0,100]);
34
+ * graphics.graphics.endFill();
35
+ * ```
36
+ */
8
37
  class Graphics$2 extends Component {
9
38
  constructor() {
10
39
  super(...arguments);
40
+ /** PixiJS Graphics 实例,用于绘制矢量图形 */
11
41
  this.graphics = null;
12
42
  }
43
+ /**
44
+ * 初始化组件
45
+ * 创建 Graphics 绘图对象实例
46
+ */
13
47
  init() {
14
48
  this.graphics = new Graphics$3();
15
49
  }
16
50
  }
51
+ /** 组件名称 */
17
52
  Graphics$2.componentName = 'Graphics';
18
53
 
19
- /*! *****************************************************************************
20
- Copyright (c) Microsoft Corporation. All rights reserved.
21
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
22
- this file except in compliance with the License. You may obtain a copy of the
23
- License at http://www.apache.org/licenses/LICENSE-2.0
54
+ /******************************************************************************
55
+ Copyright (c) Microsoft Corporation.
24
56
 
25
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
27
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
28
- MERCHANTABLITY OR NON-INFRINGEMENT.
57
+ Permission to use, copy, modify, and/or distribute this software for any
58
+ purpose with or without fee is hereby granted.
29
59
 
30
- See the Apache Version 2.0 License for specific language governing permissions
31
- and limitations under the License.
60
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
61
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
62
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
63
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
64
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
65
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
66
+ PERFORMANCE OF THIS SOFTWARE.
32
67
  ***************************************************************************** */
33
68
 
34
69
  function __decorate(decorators, target, key, desc) {
@@ -39,13 +74,19 @@ function __decorate(decorators, target, key, desc) {
39
74
  }
40
75
 
41
76
  function __awaiter(thisArg, _arguments, P, generator) {
77
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
42
78
  return new (P || (P = Promise))(function (resolve, reject) {
43
79
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
44
80
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
45
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
81
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
46
82
  step((generator = generator.apply(thisArg, _arguments || [])).next());
47
83
  });
48
- }
84
+ }
85
+
86
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
87
+ var e = new Error(message);
88
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
89
+ };
49
90
 
50
91
  let Graphics = class Graphics extends Renderer {
51
92
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eva/plugin-renderer-graphics",
3
- "version": "2.0.1-beta.9",
3
+ "version": "2.0.2-beta.0",
4
4
  "description": "@eva/plugin-renderer-graphics",
5
5
  "main": "index.js",
6
6
  "module": "dist/plugin-renderer-graphics.esm.js",
@@ -18,7 +18,7 @@
18
18
  "license": "MIT",
19
19
  "homepage": "https://eva.js.org",
20
20
  "dependencies": {
21
- "@eva/plugin-renderer": "2.0.1-beta.9",
22
- "@eva/eva.js": "2.0.1-beta.9"
21
+ "@eva/plugin-renderer": "2.0.2-beta.0",
22
+ "@eva/eva.js": "2.0.2-beta.0"
23
23
  }
24
24
  }