konva 9.1.0 → 9.2.1

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,17 +5,17 @@
5
5
  })(this, (function () { 'use strict';
6
6
 
7
7
  /*
8
- * Konva JavaScript Framework v9.1.0
8
+ * Konva JavaScript Framework v9.2.1
9
9
  * http://konvajs.org/
10
10
  * Licensed under the MIT
11
- * Date: Fri Jun 02 2023
11
+ * Date: Thu Sep 14 2023
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)
15
15
  *
16
16
  * @license
17
17
  */
18
- var PI_OVER_180 = Math.PI / 180;
18
+ const PI_OVER_180 = Math.PI / 180;
19
19
  /**
20
20
  * @namespace Konva
21
21
  */
@@ -35,7 +35,7 @@
35
35
  : {};
36
36
  const Konva$2 = {
37
37
  _global: glob,
38
- version: '9.1.0',
38
+ version: '9.2.1',
39
39
  isBrowser: detectBrowser(),
40
40
  isUnminified: /param/.test(function (param) { }.toString()),
41
41
  dblClickWindow: 400,
@@ -1109,7 +1109,7 @@
1109
1109
  releaseCanvas(...canvases) {
1110
1110
  if (!Konva$2.releaseCanvasOnDestroy)
1111
1111
  return;
1112
- canvases.forEach(c => {
1112
+ canvases.forEach((c) => {
1113
1113
  c.width = 0;
1114
1114
  c.height = 0;
1115
1115
  });
@@ -1120,7 +1120,11 @@
1120
1120
  let bottomLeft = 0;
1121
1121
  let bottomRight = 0;
1122
1122
  if (typeof cornerRadius === 'number') {
1123
- topLeft = topRight = bottomLeft = bottomRight = Math.min(cornerRadius, width / 2, height / 2);
1123
+ topLeft =
1124
+ topRight =
1125
+ bottomLeft =
1126
+ bottomRight =
1127
+ Math.min(cornerRadius, width / 2, height / 2);
1124
1128
  }
1125
1129
  else {
1126
1130
  topLeft = Math.min(cornerRadius[0] || 0, width / 2, height / 2);
@@ -1137,7 +1141,7 @@
1137
1141
  context.arc(bottomLeft, height - bottomLeft, bottomLeft, Math.PI / 2, Math.PI, false);
1138
1142
  context.lineTo(0, topLeft);
1139
1143
  context.arc(topLeft, topLeft, topLeft, Math.PI, (Math.PI * 3) / 2, false);
1140
- }
1144
+ },
1141
1145
  };
1142
1146
 
1143
1147
  function _formatValue(val) {
@@ -1677,16 +1681,17 @@
1677
1681
  * @method
1678
1682
  * @name Konva.Context#arc
1679
1683
  */
1680
- arc(a0, a1, a2, a3, a4, a5) {
1681
- this._context.arc(a0, a1, a2, a3, a4, a5);
1684
+ arc(x, y, radius, startAngle, endAngle, counterClockwise) {
1685
+ this._context.arc(x, y, radius, startAngle, endAngle, counterClockwise);
1682
1686
  }
1683
1687
  /**
1684
1688
  * arcTo function.
1685
1689
  * @method
1686
1690
  * @name Konva.Context#arcTo
1691
+ *
1687
1692
  */
1688
- arcTo(a0, a1, a2, a3, a4) {
1689
- this._context.arcTo(a0, a1, a2, a3, a4);
1693
+ arcTo(x1, y1, x2, y2, radius) {
1694
+ this._context.arcTo(x1, y1, x2, y2, radius);
1690
1695
  }
1691
1696
  /**
1692
1697
  * beginPath function.
@@ -1701,24 +1706,19 @@
1701
1706
  * @method
1702
1707
  * @name Konva.Context#bezierCurveTo
1703
1708
  */
1704
- bezierCurveTo(a0, a1, a2, a3, a4, a5) {
1705
- this._context.bezierCurveTo(a0, a1, a2, a3, a4, a5);
1709
+ bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y) {
1710
+ this._context.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
1706
1711
  }
1707
1712
  /**
1708
1713
  * clearRect function.
1709
1714
  * @method
1710
1715
  * @name Konva.Context#clearRect
1711
1716
  */
1712
- clearRect(a0, a1, a2, a3) {
1713
- this._context.clearRect(a0, a1, a2, a3);
1717
+ clearRect(x, y, width, height) {
1718
+ this._context.clearRect(x, y, width, height);
1714
1719
  }
1715
- /**
1716
- * clip function.
1717
- * @method
1718
- * @name Konva.Context#clip
1719
- */
1720
- clip() {
1721
- this._context.clip();
1720
+ clip(...args) {
1721
+ this._context.clip.apply(this._context, args);
1722
1722
  }
1723
1723
  /**
1724
1724
  * closePath function.
@@ -1733,13 +1733,13 @@
1733
1733
  * @method
1734
1734
  * @name Konva.Context#createImageData
1735
1735
  */
1736
- createImageData(a0, a1) {
1736
+ createImageData(width, height) {
1737
1737
  var a = arguments;
1738
1738
  if (a.length === 2) {
1739
- return this._context.createImageData(a0, a1);
1739
+ return this._context.createImageData(width, height);
1740
1740
  }
1741
1741
  else if (a.length === 1) {
1742
- return this._context.createImageData(a0);
1742
+ return this._context.createImageData(width);
1743
1743
  }
1744
1744
  }
1745
1745
  /**
@@ -1747,41 +1747,41 @@
1747
1747
  * @method
1748
1748
  * @name Konva.Context#createLinearGradient
1749
1749
  */
1750
- createLinearGradient(a0, a1, a2, a3) {
1751
- return this._context.createLinearGradient(a0, a1, a2, a3);
1750
+ createLinearGradient(x0, y0, x1, y1) {
1751
+ return this._context.createLinearGradient(x0, y0, x1, y1);
1752
1752
  }
1753
1753
  /**
1754
1754
  * createPattern function.
1755
1755
  * @method
1756
1756
  * @name Konva.Context#createPattern
1757
1757
  */
1758
- createPattern(a0, a1) {
1759
- return this._context.createPattern(a0, a1);
1758
+ createPattern(image, repetition) {
1759
+ return this._context.createPattern(image, repetition);
1760
1760
  }
1761
1761
  /**
1762
1762
  * createRadialGradient function.
1763
1763
  * @method
1764
1764
  * @name Konva.Context#createRadialGradient
1765
1765
  */
1766
- createRadialGradient(a0, a1, a2, a3, a4, a5) {
1767
- return this._context.createRadialGradient(a0, a1, a2, a3, a4, a5);
1766
+ createRadialGradient(x0, y0, r0, x1, y1, r1) {
1767
+ return this._context.createRadialGradient(x0, y0, r0, x1, y1, r1);
1768
1768
  }
1769
1769
  /**
1770
1770
  * drawImage function.
1771
1771
  * @method
1772
1772
  * @name Konva.Context#drawImage
1773
1773
  */
1774
- drawImage(a0, a1, a2, a3, a4, a5, a6, a7, a8) {
1774
+ drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight) {
1775
1775
  // this._context.drawImage(...arguments);
1776
1776
  var a = arguments, _context = this._context;
1777
1777
  if (a.length === 3) {
1778
- _context.drawImage(a0, a1, a2);
1778
+ _context.drawImage(image, sx, sy);
1779
1779
  }
1780
1780
  else if (a.length === 5) {
1781
- _context.drawImage(a0, a1, a2, a3, a4);
1781
+ _context.drawImage(image, sx, sy, sWidth, sHeight);
1782
1782
  }
1783
1783
  else if (a.length === 9) {
1784
- _context.drawImage(a0, a1, a2, a3, a4, a5, a6, a7, a8);
1784
+ _context.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
1785
1785
  }
1786
1786
  }
1787
1787
  /**
@@ -1789,8 +1789,8 @@
1789
1789
  * @method
1790
1790
  * @name Konva.Context#ellipse
1791
1791
  */
1792
- ellipse(a0, a1, a2, a3, a4, a5, a6, a7) {
1793
- this._context.ellipse(a0, a1, a2, a3, a4, a5, a6, a7);
1792
+ ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise) {
1793
+ this._context.ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise);
1794
1794
  }
1795
1795
  /**
1796
1796
  * isPointInPath function.
@@ -1803,18 +1803,9 @@
1803
1803
  }
1804
1804
  return this._context.isPointInPath(x, y, fillRule);
1805
1805
  }
1806
- /**
1807
- * fill function.
1808
- * @method
1809
- * @name Konva.Context#fill
1810
- */
1811
- fill(path2d) {
1812
- if (path2d) {
1813
- this._context.fill(path2d);
1814
- }
1815
- else {
1816
- this._context.fill();
1817
- }
1806
+ fill(...args) {
1807
+ // this._context.fill();
1808
+ this._context.fill.apply(this._context, args);
1818
1809
  }
1819
1810
  /**
1820
1811
  * fillRect function.
@@ -1858,48 +1849,48 @@
1858
1849
  * @method
1859
1850
  * @name Konva.Context#getImageData
1860
1851
  */
1861
- getImageData(a0, a1, a2, a3) {
1862
- return this._context.getImageData(a0, a1, a2, a3);
1852
+ getImageData(sx, sy, sw, sh) {
1853
+ return this._context.getImageData(sx, sy, sw, sh);
1863
1854
  }
1864
1855
  /**
1865
1856
  * lineTo function.
1866
1857
  * @method
1867
1858
  * @name Konva.Context#lineTo
1868
1859
  */
1869
- lineTo(a0, a1) {
1870
- this._context.lineTo(a0, a1);
1860
+ lineTo(x, y) {
1861
+ this._context.lineTo(x, y);
1871
1862
  }
1872
1863
  /**
1873
1864
  * moveTo function.
1874
1865
  * @method
1875
1866
  * @name Konva.Context#moveTo
1876
1867
  */
1877
- moveTo(a0, a1) {
1878
- this._context.moveTo(a0, a1);
1868
+ moveTo(x, y) {
1869
+ this._context.moveTo(x, y);
1879
1870
  }
1880
1871
  /**
1881
1872
  * rect function.
1882
1873
  * @method
1883
1874
  * @name Konva.Context#rect
1884
1875
  */
1885
- rect(a0, a1, a2, a3) {
1886
- this._context.rect(a0, a1, a2, a3);
1876
+ rect(x, y, width, height) {
1877
+ this._context.rect(x, y, width, height);
1887
1878
  }
1888
1879
  /**
1889
1880
  * putImageData function.
1890
1881
  * @method
1891
1882
  * @name Konva.Context#putImageData
1892
1883
  */
1893
- putImageData(a0, a1, a2) {
1894
- this._context.putImageData(a0, a1, a2);
1884
+ putImageData(imageData, dx, dy) {
1885
+ this._context.putImageData(imageData, dx, dy);
1895
1886
  }
1896
1887
  /**
1897
1888
  * quadraticCurveTo function.
1898
1889
  * @method
1899
1890
  * @name Konva.Context#quadraticCurveTo
1900
1891
  */
1901
- quadraticCurveTo(a0, a1, a2, a3) {
1902
- this._context.quadraticCurveTo(a0, a1, a2, a3);
1892
+ quadraticCurveTo(cpx, cpy, x, y) {
1893
+ this._context.quadraticCurveTo(cpx, cpy, x, y);
1903
1894
  }
1904
1895
  /**
1905
1896
  * restore function.
@@ -1914,8 +1905,8 @@
1914
1905
  * @method
1915
1906
  * @name Konva.Context#rotate
1916
1907
  */
1917
- rotate(a0) {
1918
- this._context.rotate(a0);
1908
+ rotate(angle) {
1909
+ this._context.rotate(angle);
1919
1910
  }
1920
1911
  /**
1921
1912
  * save function.
@@ -1930,26 +1921,26 @@
1930
1921
  * @method
1931
1922
  * @name Konva.Context#scale
1932
1923
  */
1933
- scale(a0, a1) {
1934
- this._context.scale(a0, a1);
1924
+ scale(x, y) {
1925
+ this._context.scale(x, y);
1935
1926
  }
1936
1927
  /**
1937
1928
  * setLineDash function.
1938
1929
  * @method
1939
1930
  * @name Konva.Context#setLineDash
1940
1931
  */
1941
- setLineDash(a0) {
1932
+ setLineDash(segments) {
1942
1933
  // works for Chrome and IE11
1943
1934
  if (this._context.setLineDash) {
1944
- this._context.setLineDash(a0);
1935
+ this._context.setLineDash(segments);
1945
1936
  }
1946
1937
  else if ('mozDash' in this._context) {
1947
1938
  // verified that this works in firefox
1948
- this._context['mozDash'] = a0;
1939
+ this._context['mozDash'] = segments;
1949
1940
  }
1950
1941
  else if ('webkitLineDash' in this._context) {
1951
1942
  // does not currently work for Safari
1952
- this._context['webkitLineDash'] = a0;
1943
+ this._context['webkitLineDash'] = segments;
1953
1944
  }
1954
1945
  // no support for IE9 and IE10
1955
1946
  }
@@ -1966,8 +1957,8 @@
1966
1957
  * @method
1967
1958
  * @name Konva.Context#setTransform
1968
1959
  */
1969
- setTransform(a0, a1, a2, a3, a4, a5) {
1970
- this._context.setTransform(a0, a1, a2, a3, a4, a5);
1960
+ setTransform(a, b, c, d, e, f) {
1961
+ this._context.setTransform(a, b, c, d, e, f);
1971
1962
  }
1972
1963
  /**
1973
1964
  * stroke function.
@@ -1987,24 +1978,24 @@
1987
1978
  * @method
1988
1979
  * @name Konva.Context#strokeText
1989
1980
  */
1990
- strokeText(a0, a1, a2, a3) {
1991
- this._context.strokeText(a0, a1, a2, a3);
1981
+ strokeText(text, x, y, maxWidth) {
1982
+ this._context.strokeText(text, x, y, maxWidth);
1992
1983
  }
1993
1984
  /**
1994
1985
  * transform function.
1995
1986
  * @method
1996
1987
  * @name Konva.Context#transform
1997
1988
  */
1998
- transform(a0, a1, a2, a3, a4, a5) {
1999
- this._context.transform(a0, a1, a2, a3, a4, a5);
1989
+ transform(a, b, c, d, e, f) {
1990
+ this._context.transform(a, b, c, d, e, f);
2000
1991
  }
2001
1992
  /**
2002
1993
  * translate function.
2003
1994
  * @method
2004
1995
  * @name Konva.Context#translate
2005
1996
  */
2006
- translate(a0, a1) {
2007
- this._context.translate(a0, a1);
1997
+ translate(x, y) {
1998
+ this._context.translate(x, y);
2008
1999
  }
2009
2000
  _enableTrace() {
2010
2001
  var that = this, len = CONTEXT_METHODS.length, origSetter = this.setAttr, n, args;
@@ -2695,7 +2686,7 @@
2695
2686
  conf.height === undefined) {
2696
2687
  rect = this.getClientRect({
2697
2688
  skipTransform: true,
2698
- relativeTo: this.getParent(),
2689
+ relativeTo: this.getParent() || undefined,
2699
2690
  });
2700
2691
  }
2701
2692
  var width = Math.ceil(conf.width || rect.width), height = Math.ceil(conf.height || rect.height), pixelRatio = conf.pixelRatio, x = conf.x === undefined ? Math.floor(rect.x) : conf.x, y = conf.y === undefined ? Math.floor(rect.y) : conf.y, offset = conf.offset || 0, drawBorder = conf.drawBorder || false, hitCanvasPixelRatio = conf.hitCanvasPixelRatio || 1;
@@ -2832,7 +2823,7 @@
2832
2823
  { x: rect.x + rect.width, y: rect.y + rect.height },
2833
2824
  { x: rect.x, y: rect.y + rect.height },
2834
2825
  ];
2835
- var minX, minY, maxX, maxY;
2826
+ var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
2836
2827
  var trans = this.getAbsoluteTransform(top);
2837
2828
  points.forEach(function (point) {
2838
2829
  var transformed = trans.point(point);
@@ -3334,8 +3325,9 @@
3334
3325
  addChildren(nodes);
3335
3326
  }
3336
3327
  }
3337
- if (that.nodeType !== UPPER_STAGE) {
3338
- addChildren(that.getStage().getChildren());
3328
+ const stage = this.getStage();
3329
+ if (that.nodeType !== UPPER_STAGE && stage) {
3330
+ addChildren(stage.getChildren());
3339
3331
  }
3340
3332
  return index;
3341
3333
  }
@@ -3395,11 +3387,12 @@
3395
3387
  * rect.getRelativePointerPosition();
3396
3388
  */
3397
3389
  getRelativePointerPosition() {
3398
- if (!this.getStage()) {
3390
+ const stage = this.getStage();
3391
+ if (!stage) {
3399
3392
  return null;
3400
3393
  }
3401
3394
  // get pointer (say mouse or touch) position
3402
- var pos = this.getStage().getPointerPosition();
3395
+ var pos = stage.getPointerPosition();
3403
3396
  if (!pos) {
3404
3397
  return null;
3405
3398
  }
@@ -3446,12 +3439,10 @@
3446
3439
  return absoluteTransform.getTranslation();
3447
3440
  }
3448
3441
  setAbsolutePosition(pos) {
3449
- var origTrans = this._clearTransform();
3442
+ const { x, y, ...origTrans } = this._clearTransform();
3450
3443
  // don't clear translation
3451
- this.attrs.x = origTrans.x;
3452
- this.attrs.y = origTrans.y;
3453
- delete origTrans.x;
3454
- delete origTrans.y;
3444
+ this.attrs.x = x;
3445
+ this.attrs.y = y;
3455
3446
  // important, use non cached value
3456
3447
  this._clearCache(TRANSFORM);
3457
3448
  var it = this._getAbsoluteTransform().copy();
@@ -3845,7 +3836,7 @@
3845
3836
  return parent.getStage();
3846
3837
  }
3847
3838
  else {
3848
- return undefined;
3839
+ return null;
3849
3840
  }
3850
3841
  }
3851
3842
  /**
@@ -4502,6 +4493,9 @@
4502
4493
  var pointerId = evt ? evt.pointerId : undefined;
4503
4494
  var stage = this.getStage();
4504
4495
  var ap = this.getAbsolutePosition();
4496
+ if (!stage) {
4497
+ return;
4498
+ }
4505
4499
  var pos = stage._getPointerById(pointerId) ||
4506
4500
  stage._changedPointerPositions[0] ||
4507
4501
  ap;
@@ -5548,7 +5542,7 @@
5548
5542
  */
5549
5543
  getAllIntersections(pos) {
5550
5544
  var arr = [];
5551
- this.find('Shape').forEach(function (shape) {
5545
+ this.find('Shape').forEach((shape) => {
5552
5546
  if (shape.isVisible() && shape.intersects(pos)) {
5553
5547
  arr.push(shape);
5554
5548
  }
@@ -5619,15 +5613,16 @@
5619
5613
  var m = transform.getMatrix();
5620
5614
  context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
5621
5615
  context.beginPath();
5616
+ let clipArgs;
5622
5617
  if (clipFunc) {
5623
- clipFunc.call(this, context, this);
5618
+ clipArgs = clipFunc.call(this, context, this);
5624
5619
  }
5625
5620
  else {
5626
5621
  var clipX = this.clipX();
5627
5622
  var clipY = this.clipY();
5628
5623
  context.rect(clipX, clipY, clipWidth, clipHeight);
5629
5624
  }
5630
- context.clip();
5625
+ context.clip.apply(context, clipArgs);
5631
5626
  m = transform.copy().invert().getMatrix();
5632
5627
  context.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
5633
5628
  }
@@ -5648,9 +5643,8 @@
5648
5643
  context.restore();
5649
5644
  }
5650
5645
  }
5651
- getClientRect(config) {
5646
+ getClientRect(config = {}) {
5652
5647
  var _a;
5653
- config = config || {};
5654
5648
  var skipTransform = config.skipTransform;
5655
5649
  var relativeTo = config.relativeTo;
5656
5650
  var minX, minY, maxX, maxY;
@@ -5817,10 +5811,15 @@
5817
5811
  * // get clip function
5818
5812
  * var clipFunction = container.clipFunc();
5819
5813
  *
5820
- * // set clip height
5814
+ * // set clip function
5821
5815
  * container.clipFunc(function(ctx) {
5822
5816
  * ctx.rect(0, 0, 100, 100);
5823
5817
  * });
5818
+ *
5819
+ * container.clipFunc(function(ctx) {
5820
+ * // optionally return a clip Path2D and clip-rule or just the clip-rule
5821
+ * return [new Path2D('M0 0v50h50Z'), 'evenodd']
5822
+ * });
5824
5823
  */
5825
5824
 
5826
5825
  const Captures = new Map();
@@ -6239,20 +6238,24 @@
6239
6238
  _pointerenter(evt) {
6240
6239
  this.setPointersPositions(evt);
6241
6240
  const events = getEventsMap(evt.type);
6242
- this._fire(events.pointerenter, {
6243
- evt: evt,
6244
- target: this,
6245
- currentTarget: this,
6246
- });
6241
+ if (events) {
6242
+ this._fire(events.pointerenter, {
6243
+ evt: evt,
6244
+ target: this,
6245
+ currentTarget: this,
6246
+ });
6247
+ }
6247
6248
  }
6248
6249
  _pointerover(evt) {
6249
6250
  this.setPointersPositions(evt);
6250
6251
  const events = getEventsMap(evt.type);
6251
- this._fire(events.pointerover, {
6252
- evt: evt,
6253
- target: this,
6254
- currentTarget: this,
6255
- });
6252
+ if (events) {
6253
+ this._fire(events.pointerover, {
6254
+ evt: evt,
6255
+ target: this,
6256
+ currentTarget: this,
6257
+ });
6258
+ }
6256
6259
  }
6257
6260
  _getTargetShape(evenType) {
6258
6261
  let shape = this[evenType + 'targetShape'];
@@ -6292,7 +6295,7 @@
6292
6295
  currentTarget: this,
6293
6296
  });
6294
6297
  }
6295
- this.pointerPos = undefined;
6298
+ this.pointerPos = null;
6296
6299
  this._pointerPositions = [];
6297
6300
  }
6298
6301
  _pointerdown(evt) {
@@ -6309,8 +6312,7 @@
6309
6312
  // probably we are staring a click
6310
6313
  Konva$2['_' + eventType + 'ListenClick'] = true;
6311
6314
  // no shape detected? do nothing
6312
- const hasShape = shape && shape.isListening();
6313
- if (!hasShape) {
6315
+ if (!shape || !shape.isListening()) {
6314
6316
  return;
6315
6317
  }
6316
6318
  if (Konva$2.capturePointerEventsEnabled) {
@@ -6364,8 +6366,8 @@
6364
6366
  const event = { evt: evt, pointerId };
6365
6367
  var differentTarget = targetShape !== shape;
6366
6368
  if (differentTarget && targetShape) {
6367
- targetShape._fireAndBubble(events.pointerout, Object.assign({}, event), shape);
6368
- targetShape._fireAndBubble(events.pointerleave, Object.assign({}, event), shape);
6369
+ targetShape._fireAndBubble(events.pointerout, { ...event }, shape);
6370
+ targetShape._fireAndBubble(events.pointerleave, { ...event }, shape);
6369
6371
  }
6370
6372
  if (shape) {
6371
6373
  if (processedShapesIds[shape._id]) {
@@ -6376,11 +6378,11 @@
6376
6378
  if (shape && shape.isListening()) {
6377
6379
  triggeredOnShape = true;
6378
6380
  if (differentTarget) {
6379
- shape._fireAndBubble(events.pointerover, Object.assign({}, event), targetShape);
6380
- shape._fireAndBubble(events.pointerenter, Object.assign({}, event), targetShape);
6381
+ shape._fireAndBubble(events.pointerover, { ...event }, targetShape);
6382
+ shape._fireAndBubble(events.pointerenter, { ...event }, targetShape);
6381
6383
  this[eventType + 'targetShape'] = shape;
6382
6384
  }
6383
- shape._fireAndBubble(events.pointermove, Object.assign({}, event));
6385
+ shape._fireAndBubble(events.pointermove, { ...event });
6384
6386
  }
6385
6387
  else {
6386
6388
  if (targetShape) {
@@ -6442,14 +6444,14 @@
6442
6444
  if (shape && shape.isListening()) {
6443
6445
  triggeredOnShape = true;
6444
6446
  this[eventType + 'ClickEndShape'] = shape;
6445
- shape._fireAndBubble(events.pointerup, Object.assign({}, event));
6447
+ shape._fireAndBubble(events.pointerup, { ...event });
6446
6448
  // detect if click or double click occurred
6447
6449
  if (Konva$2['_' + eventType + 'ListenClick'] &&
6448
6450
  clickStartShape &&
6449
6451
  clickStartShape === shape) {
6450
- shape._fireAndBubble(events.pointerclick, Object.assign({}, event));
6452
+ shape._fireAndBubble(events.pointerclick, { ...event });
6451
6453
  if (fireDblClick && clickEndShape && clickEndShape === shape) {
6452
- shape._fireAndBubble(events.pointerdblclick, Object.assign({}, event));
6454
+ shape._fireAndBubble(events.pointerdblclick, { ...event });
6453
6455
  }
6454
6456
  }
6455
6457
  }
@@ -6692,7 +6694,13 @@
6692
6694
  // the approach is good. But what if we want to cache the shape before we add it into the stage
6693
6695
  // what color to use for hit test?
6694
6696
  function _fillFunc$2(context) {
6695
- context.fill();
6697
+ const fillRule = this.attrs.fillRule;
6698
+ if (fillRule) {
6699
+ context.fill(fillRule);
6700
+ }
6701
+ else {
6702
+ context.fill();
6703
+ }
6696
6704
  }
6697
6705
  function _strokeFunc$2(context) {
6698
6706
  context.stroke();
@@ -7014,10 +7022,14 @@
7014
7022
  * @returns {Boolean}
7015
7023
  */
7016
7024
  intersects(point) {
7017
- var stage = this.getStage(), bufferHitCanvas = stage.bufferHitCanvas, p;
7025
+ var stage = this.getStage();
7026
+ if (!stage) {
7027
+ return false;
7028
+ }
7029
+ const bufferHitCanvas = stage.bufferHitCanvas;
7018
7030
  bufferHitCanvas.getContext().clear();
7019
- this.drawHit(bufferHitCanvas, null, true);
7020
- p = bufferHitCanvas.context.getImageData(Math.round(point.x), Math.round(point.y), 1, 1).data;
7031
+ this.drawHit(bufferHitCanvas, undefined, true);
7032
+ const p = bufferHitCanvas.context.getImageData(Math.round(point.x), Math.round(point.y), 1, 1).data;
7021
7033
  return p[3] > 0;
7022
7034
  }
7023
7035
  destroy() {
@@ -7130,7 +7142,8 @@
7130
7142
  // 1 - simple drawing when nothing is cached.
7131
7143
  // 2 - when we are caching current
7132
7144
  // 3 - when node is cached and we need to draw it into layer
7133
- var layer = this.getLayer(), canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferCanvas, bufferContext;
7145
+ var layer = this.getLayer();
7146
+ var canvas = can || layer.getCanvas(), context = canvas.getContext(), cachedCanvas = this._getCanvasCache(), drawFunc = this.getSceneFunc(), hasShadow = this.hasShadow(), stage, bufferCanvas, bufferContext;
7134
7147
  var skipBuffer = canvas.isCache;
7135
7148
  var cachingSelf = top === this;
7136
7149
  if (!this.isVisible() && !cachingSelf) {
@@ -8266,6 +8279,20 @@
8266
8279
  * // set fill pattern rotation
8267
8280
  * shape.fillPatternRotation(20);
8268
8281
  */
8282
+ Factory.addGetterSetter(Shape, 'fillRule', undefined, getStringValidator());
8283
+ /**
8284
+ * get/set fill rule
8285
+ * @name Konva.Shape#fillRule
8286
+ * @method
8287
+ * @param {CanvasFillRule} rotation
8288
+ * @returns {Konva.Shape}
8289
+ * @example
8290
+ * // get fill rule
8291
+ * var fillRule = shape.fillRule();
8292
+ *
8293
+ * // set fill rule
8294
+ * shape.fillRule('evenodd');
8295
+ */
8269
8296
  Factory.backCompat(Shape, {
8270
8297
  dashArray: 'dash',
8271
8298
  getDashArray: 'getDash',
@@ -8842,7 +8869,7 @@
8842
8869
  Group.prototype.nodeType = 'Group';
8843
8870
  _registerNode(Group);
8844
8871
 
8845
- var now = (function () {
8872
+ const now = (function () {
8846
8873
  if (glob.performance && glob.performance.now) {
8847
8874
  return function () {
8848
8875
  return glob.performance.now();
@@ -8894,20 +8921,10 @@
8894
8921
  * @return {Konva.Animation} this
8895
8922
  */
8896
8923
  setLayers(layers) {
8897
- var lays = [];
8924
+ let lays = [];
8898
8925
  // if passing in no layers
8899
- if (!layers) {
8900
- lays = [];
8901
- }
8902
- else if (layers.length > 0) {
8903
- // if passing in an array of Layers
8904
- // NOTE: layers could be an array. for simplicity, I'm just inspecting
8905
- // the length property to check for both cases
8906
- lays = layers;
8907
- }
8908
- else {
8909
- // if passing in a Layer
8910
- lays = [layers];
8926
+ if (layers) {
8927
+ lays = Array.isArray(layers) ? layers : [layers];
8911
8928
  }
8912
8929
  this.layers = lays;
8913
8930
  return this;
@@ -8929,9 +8946,10 @@
8929
8946
  * @return {Bool} true if layer is added to animation, otherwise false
8930
8947
  */
8931
8948
  addLayer(layer) {
8932
- var layers = this.layers, len = layers.length, n;
8949
+ const layers = this.layers;
8950
+ const len = layers.length;
8933
8951
  // don't add the layer if it already exists
8934
- for (n = 0; n < len; n++) {
8952
+ for (let n = 0; n < len; n++) {
8935
8953
  if (layers[n]._id === layer._id) {
8936
8954
  return false;
8937
8955
  }
@@ -8946,8 +8964,10 @@
8946
8964
  * @return {Bool} is animation running?
8947
8965
  */
8948
8966
  isRunning() {
8949
- var a = Animation, animations = a.animations, len = animations.length, n;
8950
- for (n = 0; n < len; n++) {
8967
+ const a = Animation;
8968
+ const animations = a.animations;
8969
+ const len = animations.length;
8970
+ for (let n = 0; n < len; n++) {
8951
8971
  if (animations[n].id === this.id) {
8952
8972
  return true;
8953
8973
  }
@@ -8988,8 +9008,10 @@
8988
9008
  this._handleAnimation();
8989
9009
  }
8990
9010
  static _removeAnimation(anim) {
8991
- var id = anim.id, animations = this.animations, len = animations.length, n;
8992
- for (n = 0; n < len; n++) {
9011
+ const id = anim.id;
9012
+ const animations = this.animations;
9013
+ const len = animations.length;
9014
+ for (let n = 0; n < len; n++) {
8993
9015
  if (animations[n].id === id) {
8994
9016
  this.animations.splice(n, 1);
8995
9017
  break;
@@ -8997,7 +9019,8 @@
8997
9019
  }
8998
9020
  }
8999
9021
  static _runFrames() {
9000
- var layerHash = {}, animations = this.animations, anim, layers, func, n, i, layersLen, layer, key, needRedraw;
9022
+ const layerHash = {};
9023
+ const animations = this.animations;
9001
9024
  /*
9002
9025
  * loop through all animations and execute animation
9003
9026
  * function. if the animation object has specified node,
@@ -9009,13 +9032,14 @@
9009
9032
  * WARNING: don't cache animations.length because it could change while
9010
9033
  * the for loop is running, causing a JS error
9011
9034
  */
9012
- for (n = 0; n < animations.length; n++) {
9013
- anim = animations[n];
9014
- layers = anim.layers;
9015
- func = anim.func;
9035
+ for (let n = 0; n < animations.length; n++) {
9036
+ const anim = animations[n];
9037
+ const layers = anim.layers;
9038
+ const func = anim.func;
9016
9039
  anim._updateFrameObject(now());
9017
- layersLen = layers.length;
9040
+ const layersLen = layers.length;
9018
9041
  // if animation object has a function, execute it
9042
+ let needRedraw;
9019
9043
  if (func) {
9020
9044
  // allow anim bypassing drawing
9021
9045
  needRedraw = func.call(anim, anim.frame) !== false;
@@ -9026,14 +9050,14 @@
9026
9050
  if (!needRedraw) {
9027
9051
  continue;
9028
9052
  }
9029
- for (i = 0; i < layersLen; i++) {
9030
- layer = layers[i];
9053
+ for (let i = 0; i < layersLen; i++) {
9054
+ const layer = layers[i];
9031
9055
  if (layer._id !== undefined) {
9032
9056
  layerHash[layer._id] = layer;
9033
9057
  }
9034
9058
  }
9035
9059
  }
9036
- for (key in layerHash) {
9060
+ for (let key in layerHash) {
9037
9061
  if (!layerHash.hasOwnProperty(key)) {
9038
9062
  continue;
9039
9063
  }
@@ -9041,7 +9065,7 @@
9041
9065
  }
9042
9066
  }
9043
9067
  static _animationLoop() {
9044
- var Anim = Animation;
9068
+ const Anim = Animation;
9045
9069
  if (Anim.animations.length) {
9046
9070
  Anim._runFrames();
9047
9071
  Util.requestAnimFrame(Anim._animationLoop);
@@ -11598,7 +11622,7 @@
11598
11622
  // case for a trailing comma before next command
11599
11623
  break;
11600
11624
  }
11601
- var cmd = null;
11625
+ var cmd = '';
11602
11626
  var points = [];
11603
11627
  var startX = cpx, startY = cpy;
11604
11628
  // Move var from within the switch to up here (jshint)
@@ -14154,7 +14178,7 @@
14154
14178
  * @param {Object} config
14155
14179
  * @param {String} [config.fontFamily] default is Arial
14156
14180
  * @param {Number} [config.fontSize] in pixels. Default is 12
14157
- * @param {String} [config.fontStyle] can be 'normal', 'bold', 'italic' or even 'italic bold'. Default is 'normal'
14181
+ * @param {String} [config.fontStyle] can be 'normal', 'italic', or 'bold', '500' or even 'italic bold'. 'normal' is the default.
14158
14182
  * @param {String} [config.fontVariant] can be normal or small-caps. Default is normal
14159
14183
  * @param {String} [config.textDecoration] can be line-through, underline or empty string. Default is empty string.
14160
14184
  * @param {String} config.text
@@ -14596,6 +14620,15 @@
14596
14620
  getStrokeScaleEnabled() {
14597
14621
  return true;
14598
14622
  }
14623
+ _useBufferCanvas() {
14624
+ const hasLine = this.textDecoration().indexOf('underline') !== -1 ||
14625
+ this.textDecoration().indexOf('line-through') !== -1;
14626
+ const hasShadow = this.hasShadow();
14627
+ if (hasLine && hasShadow) {
14628
+ return true;
14629
+ }
14630
+ return super._useBufferCanvas();
14631
+ }
14599
14632
  }
14600
14633
  Text.prototype._fillFunc = _fillFunc$1;
14601
14634
  Text.prototype._strokeFunc = _strokeFunc$1;
@@ -14674,7 +14707,7 @@
14674
14707
  */
14675
14708
  Factory.addGetterSetter(Text, 'fontSize', 12, getNumberValidator());
14676
14709
  /**
14677
- * get/set font style. Can be 'normal', 'italic', or 'bold' or even 'italic bold'. 'normal' is the default.
14710
+ * get/set font style. Can be 'normal', 'italic', or 'bold', '500' or even 'italic bold'. 'normal' is the default.
14678
14711
  * @name Konva.Text#fontStyle
14679
14712
  * @method
14680
14713
  * @param {String} fontStyle
@@ -14850,7 +14883,7 @@
14850
14883
  * @param {Object} config
14851
14884
  * @param {String} [config.fontFamily] default is Arial
14852
14885
  * @param {Number} [config.fontSize] default is 12
14853
- * @param {String} [config.fontStyle] can be normal, bold, or italic. Default is normal
14886
+ * @param {String} [config.fontStyle] Can be 'normal', 'italic', or 'bold', '500' or even 'italic bold'. 'normal' is the default.
14854
14887
  * @param {String} [config.fontVariant] can be normal or small-caps. Default is normal
14855
14888
  * @param {String} [config.textBaseline] Can be 'top', 'bottom', 'middle', 'alphabetic', 'hanging'. Default is middle
14856
14889
  * @param {String} config.text
@@ -15239,7 +15272,7 @@
15239
15272
  */
15240
15273
  Factory.addGetterSetter(TextPath, 'fontSize', 12, getNumberValidator());
15241
15274
  /**
15242
- * get/set font style. Can be 'normal', 'italic', or 'bold'. 'normal' is the default.
15275
+ * get/set font style. Can be 'normal', 'italic', or 'bold', '500' or even 'italic bold'. 'normal' is the default.
15243
15276
  * @name Konva.TextPath#fontStyle
15244
15277
  * @method
15245
15278
  * @param {String} fontStyle
@@ -15401,9 +15434,9 @@
15401
15434
  'bottom-right': 135,
15402
15435
  };
15403
15436
  const TOUCH_DEVICE = 'ontouchstart' in Konva$2._global;
15404
- function getCursor(anchorName, rad) {
15437
+ function getCursor(anchorName, rad, rotateCursor) {
15405
15438
  if (anchorName === 'rotater') {
15406
- return 'crosshair';
15439
+ return rotateCursor;
15407
15440
  }
15408
15441
  rad += Util.degToRad(ANGLES[anchorName] || 0);
15409
15442
  var angle = ((Util.radToDeg(rad) % 360) + 360) % 360;
@@ -15473,8 +15506,12 @@
15473
15506
  const y = point.y +
15474
15507
  (shape.x - point.x) * Math.sin(angleRad) +
15475
15508
  (shape.y - point.y) * Math.cos(angleRad);
15476
- return Object.assign(Object.assign({}, shape), { rotation: shape.rotation + angleRad, x,
15477
- y });
15509
+ return {
15510
+ ...shape,
15511
+ rotation: shape.rotation + angleRad,
15512
+ x,
15513
+ y,
15514
+ };
15478
15515
  }
15479
15516
  function rotateAroundCenter(shape, deltaRad) {
15480
15517
  const center = getCenter(shape);
@@ -15504,6 +15541,7 @@
15504
15541
  * @param {Array} [config.rotationSnaps] Array of angles for rotation snaps. Default is []
15505
15542
  * @param {Number} [config.rotationSnapTolerance] Snapping tolerance. If closer than this it will snap. Default is 5
15506
15543
  * @param {Number} [config.rotateAnchorOffset] Default is 50
15544
+ * @param {String} [config.rotateAnchorCursor] Default is crosshair
15507
15545
  * @param {Number} [config.padding] Default is 0
15508
15546
  * @param {Boolean} [config.borderEnabled] Should we draw border? Default is true
15509
15547
  * @param {String} [config.borderStroke] Border stroke color
@@ -15535,6 +15573,7 @@
15535
15573
  constructor(config) {
15536
15574
  // call super constructor
15537
15575
  super(config);
15576
+ this._movingAnchorName = null;
15538
15577
  this._transforming = false;
15539
15578
  this._createElements();
15540
15579
  // bindings
@@ -15760,7 +15799,7 @@
15760
15799
  });
15761
15800
  const tr = new Transform();
15762
15801
  tr.rotate(-Konva$2.getAngle(this.rotation()));
15763
- var minX, minY, maxX, maxY;
15802
+ var minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
15764
15803
  totalPoints.forEach(function (point) {
15765
15804
  var transformed = tr.point(point);
15766
15805
  if (minX === undefined) {
@@ -15804,9 +15843,9 @@
15804
15843
  }
15805
15844
  _createElements() {
15806
15845
  this._createBack();
15807
- ANCHORS_NAMES.forEach(function (name) {
15846
+ ANCHORS_NAMES.forEach((name) => {
15808
15847
  this._createAnchor(name);
15809
- }.bind(this));
15848
+ });
15810
15849
  this._createAnchor('rotater');
15811
15850
  }
15812
15851
  _createAnchor(name) {
@@ -15835,7 +15874,8 @@
15835
15874
  // add hover styling
15836
15875
  anchor.on('mouseenter', () => {
15837
15876
  var rad = Konva$2.getAngle(this.rotation());
15838
- var cursor = getCursor(name, rad);
15877
+ var rotateCursor = this.rotateAnchorCursor();
15878
+ var cursor = getCursor(name, rad, rotateCursor);
15839
15879
  anchor.getStage().content &&
15840
15880
  (anchor.getStage().content.style.cursor = cursor);
15841
15881
  this._cursorChange = true;
@@ -15853,16 +15893,16 @@
15853
15893
  width: 0,
15854
15894
  height: 0,
15855
15895
  draggable: true,
15856
- sceneFunc(ctx) {
15857
- var tr = this.getParent();
15896
+ sceneFunc(ctx, shape) {
15897
+ var tr = shape.getParent();
15858
15898
  var padding = tr.padding();
15859
15899
  ctx.beginPath();
15860
- ctx.rect(-padding, -padding, this.width() + padding * 2, this.height() + padding * 2);
15861
- ctx.moveTo(this.width() / 2, -padding);
15900
+ ctx.rect(-padding, -padding, shape.width() + padding * 2, shape.height() + padding * 2);
15901
+ ctx.moveTo(shape.width() / 2, -padding);
15862
15902
  if (tr.rotateEnabled()) {
15863
- ctx.lineTo(this.width() / 2, -tr.rotateAnchorOffset() * Util._sign(this.height()) - padding);
15903
+ ctx.lineTo(shape.width() / 2, -tr.rotateAnchorOffset() * Util._sign(shape.height()) - padding);
15864
15904
  }
15865
- ctx.fillStrokeShape(this);
15905
+ ctx.fillStrokeShape(shape);
15866
15906
  },
15867
15907
  hitFunc: (ctx, shape) => {
15868
15908
  if (!this.shouldOverdrawWholeArea()) {
@@ -16552,6 +16592,20 @@
16552
16592
  * transformer.rotateAnchorOffset(100);
16553
16593
  */
16554
16594
  Factory.addGetterSetter(Transformer, 'rotateAnchorOffset', 50, getNumberValidator());
16595
+ /**
16596
+ * get/set rotation anchor cursor
16597
+ * @name Konva.Transformer#rotateAnchorCursor
16598
+ * @method
16599
+ * @param {String} cursorName
16600
+ * @returns {String}
16601
+ * @example
16602
+ * // get
16603
+ * var currentRotationAnchorCursor = transformer.rotateAnchorCursor();
16604
+ *
16605
+ * // set
16606
+ * transformer.rotateAnchorCursor('grab');
16607
+ */
16608
+ Factory.addGetterSetter(Transformer, 'rotateAnchorCursor', 'crosshair');
16555
16609
  /**
16556
16610
  * get/set distance for rotation tolerance
16557
16611
  * @name Konva.Transformer#rotationSnapTolerance
@@ -17090,518 +17144,39 @@
17090
17144
  this.next = null;
17091
17145
  }
17092
17146
  var mul_table = [
17093
- 512,
17094
- 512,
17095
- 456,
17096
- 512,
17097
- 328,
17098
- 456,
17099
- 335,
17100
- 512,
17101
- 405,
17102
- 328,
17103
- 271,
17104
- 456,
17105
- 388,
17106
- 335,
17107
- 292,
17108
- 512,
17109
- 454,
17110
- 405,
17111
- 364,
17112
- 328,
17113
- 298,
17114
- 271,
17115
- 496,
17116
- 456,
17117
- 420,
17118
- 388,
17119
- 360,
17120
- 335,
17121
- 312,
17122
- 292,
17123
- 273,
17124
- 512,
17125
- 482,
17126
- 454,
17127
- 428,
17128
- 405,
17129
- 383,
17130
- 364,
17131
- 345,
17132
- 328,
17133
- 312,
17134
- 298,
17135
- 284,
17136
- 271,
17137
- 259,
17138
- 496,
17139
- 475,
17140
- 456,
17141
- 437,
17142
- 420,
17143
- 404,
17144
- 388,
17145
- 374,
17146
- 360,
17147
- 347,
17148
- 335,
17149
- 323,
17150
- 312,
17151
- 302,
17152
- 292,
17153
- 282,
17154
- 273,
17155
- 265,
17156
- 512,
17157
- 497,
17158
- 482,
17159
- 468,
17160
- 454,
17161
- 441,
17162
- 428,
17163
- 417,
17164
- 405,
17165
- 394,
17166
- 383,
17167
- 373,
17168
- 364,
17169
- 354,
17170
- 345,
17171
- 337,
17172
- 328,
17173
- 320,
17174
- 312,
17175
- 305,
17176
- 298,
17177
- 291,
17178
- 284,
17179
- 278,
17180
- 271,
17181
- 265,
17182
- 259,
17183
- 507,
17184
- 496,
17185
- 485,
17186
- 475,
17187
- 465,
17188
- 456,
17189
- 446,
17190
- 437,
17191
- 428,
17192
- 420,
17193
- 412,
17194
- 404,
17195
- 396,
17196
- 388,
17197
- 381,
17198
- 374,
17199
- 367,
17200
- 360,
17201
- 354,
17202
- 347,
17203
- 341,
17204
- 335,
17205
- 329,
17206
- 323,
17207
- 318,
17208
- 312,
17209
- 307,
17210
- 302,
17211
- 297,
17212
- 292,
17213
- 287,
17214
- 282,
17215
- 278,
17216
- 273,
17217
- 269,
17218
- 265,
17219
- 261,
17220
- 512,
17221
- 505,
17222
- 497,
17223
- 489,
17224
- 482,
17225
- 475,
17226
- 468,
17227
- 461,
17228
- 454,
17229
- 447,
17230
- 441,
17231
- 435,
17232
- 428,
17233
- 422,
17234
- 417,
17235
- 411,
17236
- 405,
17237
- 399,
17238
- 394,
17239
- 389,
17240
- 383,
17241
- 378,
17242
- 373,
17243
- 368,
17244
- 364,
17245
- 359,
17246
- 354,
17247
- 350,
17248
- 345,
17249
- 341,
17250
- 337,
17251
- 332,
17252
- 328,
17253
- 324,
17254
- 320,
17255
- 316,
17256
- 312,
17257
- 309,
17258
- 305,
17259
- 301,
17260
- 298,
17261
- 294,
17262
- 291,
17263
- 287,
17264
- 284,
17265
- 281,
17266
- 278,
17267
- 274,
17268
- 271,
17269
- 268,
17270
- 265,
17271
- 262,
17272
- 259,
17273
- 257,
17274
- 507,
17275
- 501,
17276
- 496,
17277
- 491,
17278
- 485,
17279
- 480,
17280
- 475,
17281
- 470,
17282
- 465,
17283
- 460,
17284
- 456,
17285
- 451,
17286
- 446,
17287
- 442,
17288
- 437,
17289
- 433,
17290
- 428,
17291
- 424,
17292
- 420,
17293
- 416,
17294
- 412,
17295
- 408,
17296
- 404,
17297
- 400,
17298
- 396,
17299
- 392,
17300
- 388,
17301
- 385,
17302
- 381,
17303
- 377,
17304
- 374,
17305
- 370,
17306
- 367,
17307
- 363,
17308
- 360,
17309
- 357,
17310
- 354,
17311
- 350,
17312
- 347,
17313
- 344,
17314
- 341,
17315
- 338,
17316
- 335,
17317
- 332,
17318
- 329,
17319
- 326,
17320
- 323,
17321
- 320,
17322
- 318,
17323
- 315,
17324
- 312,
17325
- 310,
17326
- 307,
17327
- 304,
17328
- 302,
17329
- 299,
17330
- 297,
17331
- 294,
17332
- 292,
17333
- 289,
17334
- 287,
17335
- 285,
17336
- 282,
17337
- 280,
17338
- 278,
17339
- 275,
17340
- 273,
17341
- 271,
17342
- 269,
17343
- 267,
17344
- 265,
17345
- 263,
17346
- 261,
17347
- 259,
17147
+ 512, 512, 456, 512, 328, 456, 335, 512, 405, 328, 271, 456, 388, 335, 292,
17148
+ 512, 454, 405, 364, 328, 298, 271, 496, 456, 420, 388, 360, 335, 312, 292,
17149
+ 273, 512, 482, 454, 428, 405, 383, 364, 345, 328, 312, 298, 284, 271, 259,
17150
+ 496, 475, 456, 437, 420, 404, 388, 374, 360, 347, 335, 323, 312, 302, 292,
17151
+ 282, 273, 265, 512, 497, 482, 468, 454, 441, 428, 417, 405, 394, 383, 373,
17152
+ 364, 354, 345, 337, 328, 320, 312, 305, 298, 291, 284, 278, 271, 265, 259,
17153
+ 507, 496, 485, 475, 465, 456, 446, 437, 428, 420, 412, 404, 396, 388, 381,
17154
+ 374, 367, 360, 354, 347, 341, 335, 329, 323, 318, 312, 307, 302, 297, 292,
17155
+ 287, 282, 278, 273, 269, 265, 261, 512, 505, 497, 489, 482, 475, 468, 461,
17156
+ 454, 447, 441, 435, 428, 422, 417, 411, 405, 399, 394, 389, 383, 378, 373,
17157
+ 368, 364, 359, 354, 350, 345, 341, 337, 332, 328, 324, 320, 316, 312, 309,
17158
+ 305, 301, 298, 294, 291, 287, 284, 281, 278, 274, 271, 268, 265, 262, 259,
17159
+ 257, 507, 501, 496, 491, 485, 480, 475, 470, 465, 460, 456, 451, 446, 442,
17160
+ 437, 433, 428, 424, 420, 416, 412, 408, 404, 400, 396, 392, 388, 385, 381,
17161
+ 377, 374, 370, 367, 363, 360, 357, 354, 350, 347, 344, 341, 338, 335, 332,
17162
+ 329, 326, 323, 320, 318, 315, 312, 310, 307, 304, 302, 299, 297, 294, 292,
17163
+ 289, 287, 285, 282, 280, 278, 275, 273, 271, 269, 267, 265, 263, 261, 259,
17348
17164
  ];
17349
17165
  var shg_table = [
17350
- 9,
17351
- 11,
17352
- 12,
17353
- 13,
17354
- 13,
17355
- 14,
17356
- 14,
17357
- 15,
17358
- 15,
17359
- 15,
17360
- 15,
17361
- 16,
17362
- 16,
17363
- 16,
17364
- 16,
17365
- 17,
17366
- 17,
17367
- 17,
17368
- 17,
17369
- 17,
17370
- 17,
17371
- 17,
17372
- 18,
17373
- 18,
17374
- 18,
17375
- 18,
17376
- 18,
17377
- 18,
17378
- 18,
17379
- 18,
17380
- 18,
17381
- 19,
17382
- 19,
17383
- 19,
17384
- 19,
17385
- 19,
17386
- 19,
17387
- 19,
17388
- 19,
17389
- 19,
17390
- 19,
17391
- 19,
17392
- 19,
17393
- 19,
17394
- 19,
17395
- 20,
17396
- 20,
17397
- 20,
17398
- 20,
17399
- 20,
17400
- 20,
17401
- 20,
17402
- 20,
17403
- 20,
17404
- 20,
17405
- 20,
17406
- 20,
17407
- 20,
17408
- 20,
17409
- 20,
17410
- 20,
17411
- 20,
17412
- 20,
17413
- 21,
17414
- 21,
17415
- 21,
17416
- 21,
17417
- 21,
17418
- 21,
17419
- 21,
17420
- 21,
17421
- 21,
17422
- 21,
17423
- 21,
17424
- 21,
17425
- 21,
17426
- 21,
17427
- 21,
17428
- 21,
17429
- 21,
17430
- 21,
17431
- 21,
17432
- 21,
17433
- 21,
17434
- 21,
17435
- 21,
17436
- 21,
17437
- 21,
17438
- 21,
17439
- 21,
17440
- 22,
17441
- 22,
17442
- 22,
17443
- 22,
17444
- 22,
17445
- 22,
17446
- 22,
17447
- 22,
17448
- 22,
17449
- 22,
17450
- 22,
17451
- 22,
17452
- 22,
17453
- 22,
17454
- 22,
17455
- 22,
17456
- 22,
17457
- 22,
17458
- 22,
17459
- 22,
17460
- 22,
17461
- 22,
17462
- 22,
17463
- 22,
17464
- 22,
17465
- 22,
17466
- 22,
17467
- 22,
17468
- 22,
17469
- 22,
17470
- 22,
17471
- 22,
17472
- 22,
17473
- 22,
17474
- 22,
17475
- 22,
17476
- 22,
17477
- 23,
17478
- 23,
17479
- 23,
17480
- 23,
17481
- 23,
17482
- 23,
17483
- 23,
17484
- 23,
17485
- 23,
17486
- 23,
17487
- 23,
17488
- 23,
17489
- 23,
17490
- 23,
17491
- 23,
17492
- 23,
17493
- 23,
17494
- 23,
17495
- 23,
17496
- 23,
17497
- 23,
17498
- 23,
17499
- 23,
17500
- 23,
17501
- 23,
17502
- 23,
17503
- 23,
17504
- 23,
17505
- 23,
17506
- 23,
17507
- 23,
17508
- 23,
17509
- 23,
17510
- 23,
17511
- 23,
17512
- 23,
17513
- 23,
17514
- 23,
17515
- 23,
17516
- 23,
17517
- 23,
17518
- 23,
17519
- 23,
17520
- 23,
17521
- 23,
17522
- 23,
17523
- 23,
17524
- 23,
17525
- 23,
17526
- 23,
17527
- 23,
17528
- 23,
17529
- 23,
17530
- 23,
17531
- 24,
17532
- 24,
17533
- 24,
17534
- 24,
17535
- 24,
17536
- 24,
17537
- 24,
17538
- 24,
17539
- 24,
17540
- 24,
17541
- 24,
17542
- 24,
17543
- 24,
17544
- 24,
17545
- 24,
17546
- 24,
17547
- 24,
17548
- 24,
17549
- 24,
17550
- 24,
17551
- 24,
17552
- 24,
17553
- 24,
17554
- 24,
17555
- 24,
17556
- 24,
17557
- 24,
17558
- 24,
17559
- 24,
17560
- 24,
17561
- 24,
17562
- 24,
17563
- 24,
17564
- 24,
17565
- 24,
17566
- 24,
17567
- 24,
17568
- 24,
17569
- 24,
17570
- 24,
17571
- 24,
17572
- 24,
17573
- 24,
17574
- 24,
17575
- 24,
17576
- 24,
17577
- 24,
17578
- 24,
17579
- 24,
17580
- 24,
17581
- 24,
17582
- 24,
17583
- 24,
17584
- 24,
17585
- 24,
17586
- 24,
17587
- 24,
17588
- 24,
17589
- 24,
17590
- 24,
17591
- 24,
17592
- 24,
17593
- 24,
17594
- 24,
17595
- 24,
17596
- 24,
17597
- 24,
17598
- 24,
17599
- 24,
17600
- 24,
17601
- 24,
17602
- 24,
17603
- 24,
17604
- 24,
17166
+ 9, 11, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17,
17167
+ 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19,
17168
+ 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
17169
+ 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
17170
+ 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22,
17171
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
17172
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23,
17173
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
17174
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
17175
+ 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
17176
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
17177
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
17178
+ 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
17179
+ 24, 24, 24, 24, 24, 24, 24,
17605
17180
  ];
17606
17181
  function filterGaussBlurRGBA(imageData, radius) {
17607
17182
  var pixels = imageData.data, width = imageData.width, height = imageData.height;
@@ -17616,7 +17191,15 @@
17616
17191
  stack.next = stackStart;
17617
17192
  yw = yi = 0;
17618
17193
  for (y = 0; y < height; y++) {
17619
- r_in_sum = g_in_sum = b_in_sum = a_in_sum = r_sum = g_sum = b_sum = a_sum = 0;
17194
+ r_in_sum =
17195
+ g_in_sum =
17196
+ b_in_sum =
17197
+ a_in_sum =
17198
+ r_sum =
17199
+ g_sum =
17200
+ b_sum =
17201
+ a_sum =
17202
+ 0;
17620
17203
  r_out_sum = radiusPlus1 * (pr = pixels[yi]);
17621
17204
  g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]);
17622
17205
  b_out_sum = radiusPlus1 * (pb = pixels[yi + 2]);
@@ -17690,7 +17273,15 @@
17690
17273
  yw += width;
17691
17274
  }
17692
17275
  for (x = 0; x < width; x++) {
17693
- g_in_sum = b_in_sum = a_in_sum = r_in_sum = g_sum = b_sum = a_sum = r_sum = 0;
17276
+ g_in_sum =
17277
+ b_in_sum =
17278
+ a_in_sum =
17279
+ r_in_sum =
17280
+ g_sum =
17281
+ b_sum =
17282
+ a_sum =
17283
+ r_sum =
17284
+ 0;
17694
17285
  yi = x << 2;
17695
17286
  r_out_sum = radiusPlus1 * (pr = pixels[yi]);
17696
17287
  g_out_sum = radiusPlus1 * (pg = pixels[yi + 1]);