konva 10.0.1 → 10.0.3

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
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="https://konvajs.org/android-chrome-192x192.png" alt="Konva logo" height="180" />
2
+ <img src="https://konvajs.org/img/icon.png" alt="Konva logo" height="60" />
3
3
  </p>
4
4
 
5
5
  <h1 align="center">Konva</h1>
package/konva.js CHANGED
@@ -5,10 +5,10 @@
5
5
  })(this, (function () { 'use strict';
6
6
 
7
7
  /*
8
- * Konva JavaScript Framework v10.0.1
8
+ * Konva JavaScript Framework v10.0.3
9
9
  * http://konvajs.org/
10
10
  * Licensed under the MIT
11
- * Date: Tue Sep 09 2025
11
+ * Date: Tue Oct 21 2025
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: '10.0.1',
38
+ version: '10.0.3',
39
39
  isBrowser: detectBrowser(),
40
40
  isUnminified: /param/.test(function (param) { }.toString()),
41
41
  dblClickWindow: 400,
@@ -189,7 +189,7 @@
189
189
  // it is required for npm packages
190
190
  _injectGlobal(Konva) {
191
191
  if (typeof glob.Konva !== 'undefined') {
192
- console.error('Severa Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.');
192
+ console.error('Several Konva instances detected. It is not recommended to use multiple Konva instances in the same environment.');
193
193
  }
194
194
  glob.Konva = Konva;
195
195
  },
@@ -15624,8 +15624,7 @@ js: import "konva/skia-backend";
15624
15624
  return null;
15625
15625
  }
15626
15626
  const totalLength = this.pathLength;
15627
- // -1px for rounding of the last symbol
15628
- if (length - 1 > totalLength) {
15627
+ if (length > totalLength) {
15629
15628
  return null;
15630
15629
  }
15631
15630
  return Path.getPointAtLengthOfDataArray(length, this.dataArray);
@@ -15643,7 +15642,9 @@ js: import "konva/skia-backend";
15643
15642
  const fill = this.fill();
15644
15643
  const fontSize = this.fontSize();
15645
15644
  const glyphInfo = this.glyphInfo;
15646
- if (textDecoration === 'underline') {
15645
+ const hasUnderline = textDecoration.indexOf('underline') !== -1;
15646
+ const hasLineThrough = textDecoration.indexOf('line-through') !== -1;
15647
+ if (hasUnderline) {
15647
15648
  context.beginPath();
15648
15649
  }
15649
15650
  for (let i = 0; i < glyphInfo.length; i++) {
@@ -15653,11 +15654,12 @@ js: import "konva/skia-backend";
15653
15654
  context.rotate(glyphInfo[i].rotation);
15654
15655
  this.partialText = glyphInfo[i].text;
15655
15656
  context.fillStrokeShape(this);
15656
- if (textDecoration === 'underline') {
15657
+ if (hasUnderline) {
15657
15658
  if (i === 0) {
15658
15659
  context.moveTo(0, fontSize / 2 + 1);
15659
15660
  }
15660
- context.lineTo(fontSize, fontSize / 2 + 1);
15661
+ console.log('underline log');
15662
+ context.lineTo(glyphInfo[i].width, fontSize / 2 + 1);
15661
15663
  }
15662
15664
  context.restore();
15663
15665
  //// To assist with debugging visually, uncomment following
@@ -15669,7 +15671,25 @@ js: import "konva/skia-backend";
15669
15671
  // context.lineTo(p1.x, p1.y);
15670
15672
  // context.stroke();
15671
15673
  }
15672
- if (textDecoration === 'underline') {
15674
+ if (hasUnderline) {
15675
+ context.strokeStyle = fill;
15676
+ context.lineWidth = fontSize / 20;
15677
+ console.log('underline log');
15678
+ context.stroke();
15679
+ }
15680
+ if (hasLineThrough) {
15681
+ context.beginPath();
15682
+ for (let i = 0; i < glyphInfo.length; i++) {
15683
+ context.save();
15684
+ const p0 = glyphInfo[i].p0;
15685
+ context.translate(p0.x, p0.y);
15686
+ context.rotate(glyphInfo[i].rotation);
15687
+ if (i === 0) {
15688
+ context.moveTo(0, 0);
15689
+ }
15690
+ context.lineTo(glyphInfo[i].width, 0);
15691
+ context.restore();
15692
+ }
15673
15693
  context.strokeStyle = fill;
15674
15694
  context.lineWidth = fontSize / 20;
15675
15695
  context.stroke();
@@ -15794,6 +15814,7 @@ js: import "konva/skia-backend";
15794
15814
  rotation: rotation,
15795
15815
  p0: charStartPoint,
15796
15816
  p1: charEndPoint,
15817
+ width: width,
15797
15818
  });
15798
15819
  offsetToGlyph += glyphWidth;
15799
15820
  }
@@ -15980,7 +16001,7 @@ js: import "konva/skia-backend";
15980
16001
  */
15981
16002
  Factory.addGetterSetter(TextPath, 'text', EMPTY_STRING);
15982
16003
  /**
15983
- * get/set text decoration of a text. Can be '' or 'underline'.
16004
+ * get/set text decoration of a text. Can be '', 'underline', 'line-through', or a combination like 'underline line-through'.
15984
16005
  * @name Konva.TextPath#textDecoration
15985
16006
  * @method
15986
16007
  * @param {String} textDecoration
@@ -15991,6 +16012,12 @@ js: import "konva/skia-backend";
15991
16012
  *
15992
16013
  * // underline text
15993
16014
  * shape.textDecoration('underline');
16015
+ *
16016
+ * // line-through text
16017
+ * shape.textDecoration('line-through');
16018
+ *
16019
+ * // combine both
16020
+ * shape.textDecoration('underline line-through');
15994
16021
  */
15995
16022
  Factory.addGetterSetter(TextPath, 'textDecoration', '');
15996
16023
  /**