canvas-editor-engine 2.1.11 → 2.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Canvas 2D library use: [`typescript`] [`canvas`];
4
4
 
5
- For: [vue3] [native-js];
5
+ For: [vue3] [native-js] [nuxt];
6
6
 
7
- # Vue3 example
7
+ # Vue3 example [depricated]
8
8
 
9
9
  input:
10
10
  ```jsx
package/dist/config.d.ts CHANGED
@@ -6,6 +6,7 @@ export interface ILayer {
6
6
  export declare class ConfigFabric {
7
7
  protected _CANVAS_SIZE: ICanvasSize;
8
8
  protected _LAYERS: ILayer[];
9
+ protected _ZOOM: number;
9
10
  }
10
11
  export default class AppConfig extends ConfigFabric {
11
12
  constructor();
@@ -13,4 +14,6 @@ export default class AppConfig extends ConfigFabric {
13
14
  set CANVAS_SIZE(value: ICanvasSize | undefined);
14
15
  get LAYERS(): ILayer[];
15
16
  set LAYERS(value: ILayer[]);
17
+ get ZOOM(): number;
18
+ set ZOOM(value: number);
16
19
  }
package/dist/index.mjs CHANGED
@@ -83,6 +83,7 @@ var AppConfig = function(_super) {
83
83
  name: "high",
84
84
  index: 3
85
85
  } ];
86
+ _this._ZOOM = 1;
86
87
  return _this;
87
88
  }
88
89
  Object.defineProperty(AppConfig.prototype, "CANVAS_SIZE", {
@@ -111,6 +112,16 @@ var AppConfig = function(_super) {
111
112
  enumerable: false,
112
113
  configurable: true
113
114
  });
115
+ Object.defineProperty(AppConfig.prototype, "ZOOM", {
116
+ get: function() {
117
+ return this._ZOOM;
118
+ },
119
+ set: function(value) {
120
+ this._ZOOM = value;
121
+ },
122
+ enumerable: false,
123
+ configurable: true
124
+ });
114
125
  return AppConfig;
115
126
  }(ConfigFabric);
116
127
 
@@ -215,8 +226,8 @@ var CanvasComponent = function(_super) {
215
226
  });
216
227
  CanvasComponent.prototype.getCursorPosition = function(event) {
217
228
  var rect = this.canvas.getBoundingClientRect();
218
- var x = event.clientX - rect.left;
219
- var y = event.clientY - rect.top;
229
+ var x = (event.clientX - rect.left) / this.appConfig.ZOOM;
230
+ var y = (event.clientY - rect.top) / this.appConfig.ZOOM;
220
231
  return {
221
232
  x,
222
233
  y
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "canvas-editor-engine",
3
- "version": "2.1.11",
3
+ "version": "2.1.12",
4
4
  "description": "CanvasEditorEngine library, use: [typescript] [canvas]",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",