konva 9.3.13 → 9.3.15

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/konva.js CHANGED
@@ -5,10 +5,10 @@
5
5
  })(this, (function () { 'use strict';
6
6
 
7
7
  /*
8
- * Konva JavaScript Framework v9.3.13
8
+ * Konva JavaScript Framework v9.3.15
9
9
  * http://konvajs.org/
10
10
  * Licensed under the MIT
11
- * Date: Fri Jul 05 2024
11
+ * Date: Mon Sep 09 2024
12
12
  *
13
13
  * Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
14
14
  * Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
@@ -35,7 +35,7 @@
35
35
  : {};
36
36
  const Konva$2 = {
37
37
  _global: glob,
38
- version: '9.3.13',
38
+ version: '9.3.15',
39
39
  isBrowser: detectBrowser(),
40
40
  isUnminified: /param/.test(function (param) { }.toString()),
41
41
  dblClickWindow: 400,
@@ -5106,6 +5106,8 @@
5106
5106
  /**
5107
5107
  * get/set listening attr. If you need to determine if a node is listening or not
5108
5108
  * by taking into account its parents, use the isListening() method
5109
+ * nodes with listening set to false will not be detected in hit graph
5110
+ * so they will be ignored in container.getIntersection() method
5109
5111
  * @name Konva.Node#listening
5110
5112
  * @method
5111
5113
  * @param {Boolean} listening Can be true, or false. The default is true.
@@ -5564,6 +5566,7 @@
5564
5566
  * canvas and redraw every shape inside the container, it should only be used for special situations
5565
5567
  * because it performs very poorly. Please use the {@link Konva.Stage#getIntersection} method if at all possible
5566
5568
  * because it performs much better
5569
+ * nodes with listening set to false will not be detected
5567
5570
  * @method
5568
5571
  * @name Konva.Container#getAllIntersections
5569
5572
  * @param {Object} pos
@@ -6173,6 +6176,7 @@
6173
6176
  /**
6174
6177
  * get visible intersection shape. This is the preferred
6175
6178
  * method for determining if a point intersects a shape or not
6179
+ * nodes with listening set to false will not be detected
6176
6180
  * @method
6177
6181
  * @name Konva.Stage#getIntersection
6178
6182
  * @param {Object} pos
@@ -6750,7 +6754,13 @@
6750
6754
  context.stroke();
6751
6755
  }
6752
6756
  function _fillFuncHit(context) {
6753
- context.fill();
6757
+ const fillRule = this.attrs.fillRule;
6758
+ if (fillRule) {
6759
+ context.fill(fillRule);
6760
+ }
6761
+ else {
6762
+ context.fill();
6763
+ }
6754
6764
  }
6755
6765
  function _strokeFuncHit(context) {
6756
6766
  context.stroke();
@@ -8644,6 +8654,7 @@
8644
8654
  * get visible intersection shape. This is the preferred
8645
8655
  * method for determining if a point intersects a shape or not
8646
8656
  * also you may pass optional selector parameter to return ancestor of intersected shape
8657
+ * nodes with listening set to false will not be detected
8647
8658
  * @method
8648
8659
  * @name Konva.Layer#getIntersection
8649
8660
  * @param {Object} pos
@@ -11427,7 +11438,7 @@
11427
11438
  return pathLength;
11428
11439
  }
11429
11440
  static getPointAtLengthOfDataArray(length, dataArray) {
11430
- var point, i = 0, ii = dataArray.length;
11441
+ var points, i = 0, ii = dataArray.length;
11431
11442
  if (!ii) {
11432
11443
  return null;
11433
11444
  }
@@ -11436,17 +11447,17 @@
11436
11447
  ++i;
11437
11448
  }
11438
11449
  if (i === ii) {
11439
- point = dataArray[i - 1].points.slice(-2);
11450
+ points = dataArray[i - 1].points.slice(-2);
11440
11451
  return {
11441
- x: point[0],
11442
- y: point[1],
11452
+ x: points[0],
11453
+ y: points[1],
11443
11454
  };
11444
11455
  }
11445
11456
  if (length < 0.01) {
11446
- point = dataArray[i].points.slice(0, 2);
11457
+ points = dataArray[i].points.slice(0, 2);
11447
11458
  return {
11448
- x: point[0],
11449
- y: point[1],
11459
+ x: points[0],
11460
+ y: points[1],
11450
11461
  };
11451
11462
  }
11452
11463
  var cp = dataArray[i];
@@ -12635,6 +12646,11 @@
12635
12646
  }
12636
12647
  }
12637
12648
  _useBufferCanvas() {
12649
+ const hasCornerRadius = !!this.cornerRadius();
12650
+ const hasShadow = this.hasShadow();
12651
+ if (hasCornerRadius && hasShadow) {
12652
+ return true;
12653
+ }
12638
12654
  return super._useBufferCanvas(true);
12639
12655
  }
12640
12656
  _sceneFunc(context) {
@@ -14128,11 +14144,26 @@
14128
14144
  Factory.addGetterSetter(Star, 'outerRadius', 0, getNumberValidator());
14129
14145
 
14130
14146
  function stringToArray(string) {
14131
- // we need to use `Array.from` because it can split unicode string correctly
14132
- // we also can use some regexp magic from lodash:
14133
- // https://github.com/lodash/lodash/blob/fb1f99d9d90ad177560d771bc5953a435b2dc119/lodash.toarray/index.js#L256
14134
- // but I decided it is too much code for that small fix
14135
- return Array.from(string);
14147
+ // Use Unicode-aware splitting
14148
+ return [...string].reduce((acc, char, index, array) => {
14149
+ // Handle emoji sequences (including ZWJ sequences)
14150
+ if (/\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?(?:\u200D\p{Emoji_Presentation})+/u.test(char)) {
14151
+ acc.push(char);
14152
+ }
14153
+ // Handle regional indicator symbols (flags)
14154
+ else if (/\p{Regional_Indicator}{2}/u.test(char + (array[index + 1] || ''))) {
14155
+ acc.push(char + array[index + 1]);
14156
+ }
14157
+ // Handle Indic scripts and other combining characters
14158
+ else if (index > 0 && /\p{Mn}|\p{Me}|\p{Mc}/u.test(char)) {
14159
+ acc[acc.length - 1] += char;
14160
+ }
14161
+ // Handle other characters
14162
+ else {
14163
+ acc.push(char);
14164
+ }
14165
+ return acc;
14166
+ }, []);
14136
14167
  }
14137
14168
  // constants
14138
14169
  var AUTO = 'auto',
@@ -14478,8 +14509,8 @@
14478
14509
  * That method can't handle multiline text.
14479
14510
  * @method
14480
14511
  * @name Konva.Text#measureSize
14481
- * @param {String} [text] text to measure
14482
- * @returns {Object} { width , height} of measured text
14512
+ * @param {String} text text to measure
14513
+ * @returns {Object} { width , height } of measured text
14483
14514
  */
14484
14515
  measureSize(text) {
14485
14516
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;