konva 8.2.0 → 8.2.4

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/lib/Global.js CHANGED
@@ -13,7 +13,7 @@ export const glob = typeof global !== 'undefined'
13
13
  : {};
14
14
  export const Konva = {
15
15
  _global: glob,
16
- version: '8.2.0',
16
+ version: '8.2.4',
17
17
  isBrowser: detectBrowser(),
18
18
  isUnminified: /param/.test(function (param) { }.toString()),
19
19
  dblClickWindow: 400,
package/lib/Util.js CHANGED
@@ -733,7 +733,7 @@ export const Util = {
733
733
  },
734
734
  _getFirstPointerId(evt) {
735
735
  if (!evt.touches) {
736
- return 999;
736
+ return evt.pointerId || 999;
737
737
  }
738
738
  else {
739
739
  return evt.changedTouches[0].identifier;
@@ -11,6 +11,7 @@ export interface ArrowConfig extends LineConfig {
11
11
  }
12
12
  export declare class Arrow extends Line<ArrowConfig> {
13
13
  _sceneFunc(ctx: any): void;
14
+ __fillStroke(ctx: any): void;
14
15
  getSelfRect(): {
15
16
  x: number;
16
17
  y: number;
@@ -46,6 +46,7 @@ export class Arrow extends Line {
46
46
  ctx.lineTo(-length, -width / 2);
47
47
  ctx.closePath();
48
48
  ctx.restore();
49
+ this.__fillStroke(ctx);
49
50
  }
50
51
  if (this.pointerAtBeginning()) {
51
52
  ctx.save();
@@ -65,11 +66,10 @@ export class Arrow extends Line {
65
66
  ctx.lineTo(-length, -width / 2);
66
67
  ctx.closePath();
67
68
  ctx.restore();
69
+ this.__fillStroke(ctx);
68
70
  }
69
- const hasPointer = this.pointerAtEnding() || this.pointerAtBeginning();
70
- if (!hasPointer) {
71
- return;
72
- }
71
+ }
72
+ __fillStroke(ctx) {
73
73
  var isDashEnabled = this.dashEnabled();
74
74
  if (isDashEnabled) {
75
75
  this.attrs.dashEnabled = false;
@@ -44,6 +44,7 @@ export declare class Transformer extends Group {
44
44
  attachTo(node: any): this;
45
45
  setNode(node: any): this;
46
46
  getNode(): Node<import("../Node").NodeConfig>;
47
+ _getEventNamespace(): string;
47
48
  setNodes(nodes?: Array<Node>): this;
48
49
  _proxyDrag(node: Node): void;
49
50
  getNodes(): Node<import("../Node").NodeConfig>[];
@@ -39,9 +39,7 @@ var TRANSFORM_CHANGE_STR = [
39
39
  'offsetYChange',
40
40
  'transformsEnabledChange',
41
41
  'strokeWidthChange',
42
- ]
43
- .map((e) => e + `.${EVENTS_NAME}`)
44
- .join(' ');
42
+ ];
45
43
  var ANGLES = {
46
44
  'top-left': -45,
47
45
  'top-center': 0,
@@ -159,6 +157,9 @@ export class Transformer extends Group {
159
157
  getNode() {
160
158
  return this._nodes && this._nodes[0];
161
159
  }
160
+ _getEventNamespace() {
161
+ return EVENTS_NAME + this._id;
162
+ }
162
163
  setNodes(nodes = []) {
163
164
  if (this._nodes && this._nodes.length) {
164
165
  this.detach();
@@ -171,9 +172,6 @@ export class Transformer extends Group {
171
172
  this.rotation(0);
172
173
  }
173
174
  this._nodes.forEach((node) => {
174
- const additionalEvents = node._attrsAffectingSize
175
- .map((prop) => prop + 'Change.' + EVENTS_NAME)
176
- .join(' ');
177
175
  const onChange = () => {
178
176
  if (this.nodes().length === 1 && this.useSingleNodeRotation()) {
179
177
  this.rotation(this.nodes()[0].getAbsoluteRotation());
@@ -183,10 +181,12 @@ export class Transformer extends Group {
183
181
  this.update();
184
182
  }
185
183
  };
184
+ const additionalEvents = node._attrsAffectingSize
185
+ .map((prop) => prop + 'Change.' + this._getEventNamespace())
186
+ .join(' ');
186
187
  node.on(additionalEvents, onChange);
187
- node.on(TRANSFORM_CHANGE_STR, onChange);
188
- node.on(`absoluteTransformChange.${EVENTS_NAME}`, onChange);
189
- node.on(`xChange.${EVENTS_NAME} yChange.${EVENTS_NAME}`, onChange);
188
+ node.on(TRANSFORM_CHANGE_STR.map((e) => e + `.${this._getEventNamespace()}`).join(' '), onChange);
189
+ node.on(`absoluteTransformChange.${this._getEventNamespace()}`, onChange);
190
190
  this._proxyDrag(node);
191
191
  });
192
192
  this._resetTransformCache();
@@ -198,13 +198,13 @@ export class Transformer extends Group {
198
198
  }
199
199
  _proxyDrag(node) {
200
200
  let lastPos;
201
- node.on(`dragstart.${EVENTS_NAME}`, (e) => {
201
+ node.on(`dragstart.${this._getEventNamespace()}`, (e) => {
202
202
  lastPos = node.getAbsolutePosition();
203
203
  if (!this.isDragging() && node !== this.findOne('.back')) {
204
204
  this.startDrag(e, false);
205
205
  }
206
206
  });
207
- node.on(`dragmove.${EVENTS_NAME}`, (e) => {
207
+ node.on(`dragmove.${this._getEventNamespace()}`, (e) => {
208
208
  if (!lastPos) {
209
209
  return;
210
210
  }
@@ -237,7 +237,7 @@ export class Transformer extends Group {
237
237
  detach() {
238
238
  if (this._nodes) {
239
239
  this._nodes.forEach((node) => {
240
- node.off('.' + EVENTS_NAME);
240
+ node.off('.' + this._getEventNamespace());
241
241
  });
242
242
  }
243
243
  this._nodes = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "konva",
3
- "version": "8.2.0",
3
+ "version": "8.2.4",
4
4
  "author": "Anton Lavrenov",
5
5
  "files": [
6
6
  "README.md",
@@ -13,16 +13,6 @@
13
13
  "browser": "./lib/index.js",
14
14
  "typings": "./lib/index-types.d.ts",
15
15
  "type": "module",
16
- "exports": {
17
- "node": {
18
- "import": "./lib/index-node.js",
19
- "require": "./cmj/index-node.js"
20
- },
21
- "browser": {
22
- "import": "./lib/index.js",
23
- "require": "./cmj/index.js"
24
- }
25
- },
26
16
  "scripts": {
27
17
  "start": "npm run test:watch",
28
18
  "compile": "npm run clean && npm run tsc && cp ./src/index-types.d.ts ./lib/index-types.d.ts && npm run rollup && cp ./package-cmj.json ./cmj/package.json && cp ./src/index-types.d.ts ./cmj/index-types.d.ts",
@@ -32,8 +22,8 @@
32
22
  "test:build": "parcel build ./test/unit-tests.html --dist-dir test-build --target none --public-url ./ --no-source-maps",
33
23
  "test:browser": "npm run test:build && mocha-headless-chrome -f ./test-build/unit-tests.html -a disable-web-security",
34
24
  "test:node": "env TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha -r ts-node/register test/unit/**/*.ts --exit && npm run test:import",
35
- "test:watch": "rm -rf ./parcel-cache && parcel serve ./test/unit-tests.html ./test/manual-tests.html",
36
- "tsc": "tsc && tsc --build ./tsconfig-cmj.json",
25
+ "test:watch": "rm -rf ./parcel-cache && parcel serve ./test/unit-tests.html ./test/manual-tests.html ./test/sandbox.html",
26
+ "tsc": "tsc --removeComments && tsc --build ./tsconfig-cmj.json",
37
27
  "rollup": "rollup -c",
38
28
  "clean": "rm -rf ./lib && rm -rf ./types && rm -rf ./cmj && rm -rf ./test-build",
39
29
  "watch": "rollup -c -w",