konva 10.5.0 → 10.7.0
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 +16 -12
- package/konva.js +3623 -3819
- package/konva.min.js +4 -4
- package/lib/Animation.d.ts +2 -2
- package/lib/Animation.js +2 -2
- package/lib/BezierFunctions.d.ts +1 -1
- package/lib/BezierFunctions.js +76 -116
- package/lib/Canvas.d.ts +10 -3
- package/lib/Canvas.js +91 -10
- package/lib/Container.d.ts +3 -2
- package/lib/Container.js +31 -17
- package/lib/Context.d.ts +9 -7
- package/lib/Context.js +99 -73
- package/lib/DragAndDrop.d.ts +4 -3
- package/lib/DragAndDrop.js +39 -25
- package/lib/Factory.d.ts +3 -2
- package/lib/Factory.js +10 -9
- package/lib/Global.d.ts +2 -7
- package/lib/Global.js +8 -9
- package/lib/Group.d.ts +7 -1
- package/lib/Group.js +61 -0
- package/lib/Layer.d.ts +1 -1
- package/lib/Layer.js +13 -8
- package/lib/Node.d.ts +25 -19
- package/lib/Node.js +178 -169
- package/lib/PointerEvents.d.ts +1 -2
- package/lib/PointerEvents.js +20 -18
- package/lib/Shape.d.ts +9 -15
- package/lib/Shape.js +190 -86
- package/lib/Stage.d.ts +19 -15
- package/lib/Stage.js +184 -99
- package/lib/Tween.js +59 -66
- package/lib/Util.d.ts +3 -2
- package/lib/Util.js +46 -16
- package/lib/_CoreInternals.d.ts +23 -11
- package/lib/_FullInternals.d.ts +23 -11
- package/lib/filters/Blur.js +16 -12
- package/lib/filters/Brighten.d.ts +1 -0
- package/lib/filters/Brighten.js +1 -0
- package/lib/filters/Brightness.d.ts +2 -1
- package/lib/filters/Brightness.js +4 -4
- package/lib/filters/Emboss.js +16 -58
- package/lib/filters/Kaleidoscope.js +8 -15
- package/lib/filters/Mask.js +8 -8
- package/lib/filters/Pixelate.js +16 -29
- package/lib/filters/Threshold.d.ts +1 -1
- package/lib/filters/Threshold.js +1 -1
- package/lib/shapes/Arc.js +8 -6
- package/lib/shapes/Arrow.d.ts +3 -6
- package/lib/shapes/Arrow.js +75 -47
- package/lib/shapes/Circle.d.ts +1 -0
- package/lib/shapes/Circle.js +4 -1
- package/lib/shapes/Ellipse.d.ts +1 -0
- package/lib/shapes/Ellipse.js +4 -1
- package/lib/shapes/Image.d.ts +2 -1
- package/lib/shapes/Image.js +22 -22
- package/lib/shapes/Label.d.ts +2 -3
- package/lib/shapes/Label.js +25 -41
- package/lib/shapes/Line.d.ts +2 -1
- package/lib/shapes/Line.js +5 -2
- package/lib/shapes/Path.d.ts +11 -2
- package/lib/shapes/Path.js +133 -143
- package/lib/shapes/Rect.d.ts +1 -0
- package/lib/shapes/Rect.js +4 -1
- package/lib/shapes/RegularPolygon.js +2 -2
- package/lib/shapes/Ring.d.ts +7 -0
- package/lib/shapes/Ring.js +8 -1
- package/lib/shapes/Sprite.d.ts +2 -1
- package/lib/shapes/Sprite.js +8 -9
- package/lib/shapes/Star.d.ts +6 -0
- package/lib/shapes/Star.js +5 -1
- package/lib/shapes/Text.d.ts +16 -5
- package/lib/shapes/Text.js +134 -65
- package/lib/shapes/TextPath.d.ts +11 -3
- package/lib/shapes/TextPath.js +56 -27
- package/lib/shapes/Transformer.js +95 -96
- package/lib/shapes/Wedge.js +1 -1
- package/lib/types.d.ts +2 -2
- package/package.json +5 -20
|
@@ -16,6 +16,7 @@ const ATTR_CHANGE_LIST = [
|
|
|
16
16
|
'enabledAnchorsChange',
|
|
17
17
|
'anchorSizeChange',
|
|
18
18
|
'borderEnabledChange',
|
|
19
|
+
'shouldOverdrawWholeAreaChange',
|
|
19
20
|
'borderStrokeChange',
|
|
20
21
|
'borderStrokeWidthChange',
|
|
21
22
|
'borderDashChange',
|
|
@@ -42,6 +43,11 @@ const TRANSFORM_CHANGE_STR = [
|
|
|
42
43
|
'offsetYChange',
|
|
43
44
|
'transformsEnabledChange',
|
|
44
45
|
'strokeWidthChange',
|
|
46
|
+
'strokeChange',
|
|
47
|
+
'selfRectFuncChange',
|
|
48
|
+
'strokeLinearGradientColorStopsChange',
|
|
49
|
+
'strokeScaleEnabledChange',
|
|
50
|
+
'strokeEnabledChange',
|
|
45
51
|
'draggableChange',
|
|
46
52
|
];
|
|
47
53
|
const ANGLES = {
|
|
@@ -140,16 +146,50 @@ function rotateAroundCenter(shape, deltaRad) {
|
|
|
140
146
|
}
|
|
141
147
|
function getSnap(snaps, newRotationRad, tol) {
|
|
142
148
|
let snapped = newRotationRad;
|
|
149
|
+
let nearest = tol;
|
|
143
150
|
for (let i = 0; i < snaps.length; i++) {
|
|
144
151
|
const angle = Konva.getAngle(snaps[i]);
|
|
145
152
|
const absDiff = Math.abs(angle - newRotationRad) % (Math.PI * 2);
|
|
146
153
|
const dif = Math.min(absDiff, Math.PI * 2 - absDiff);
|
|
147
|
-
if (dif <
|
|
154
|
+
if (dif < nearest) {
|
|
155
|
+
nearest = dif;
|
|
148
156
|
snapped = angle;
|
|
149
157
|
}
|
|
150
158
|
}
|
|
151
159
|
return snapped;
|
|
152
160
|
}
|
|
161
|
+
// start and end point of the rotate line, in the transformer box coordinates
|
|
162
|
+
function getRotaterLine(tr, width, height) {
|
|
163
|
+
const rad = Util.degToRad(tr.rotateAnchorAngle());
|
|
164
|
+
// direction vector (0 degrees = up/top)
|
|
165
|
+
const dirX = Math.sin(rad);
|
|
166
|
+
const dirY = -Math.cos(rad);
|
|
167
|
+
const cx = width / 2;
|
|
168
|
+
const cy = height / 2;
|
|
169
|
+
// distance from the center to the first box edge in that direction
|
|
170
|
+
let t = Infinity;
|
|
171
|
+
if (dirY < 0) {
|
|
172
|
+
t = Math.min(t, -cy / dirY);
|
|
173
|
+
}
|
|
174
|
+
else if (dirY > 0) {
|
|
175
|
+
t = Math.min(t, (height - cy) / dirY);
|
|
176
|
+
}
|
|
177
|
+
if (dirX < 0) {
|
|
178
|
+
t = Math.min(t, -cx / dirX);
|
|
179
|
+
}
|
|
180
|
+
else if (dirX > 0) {
|
|
181
|
+
t = Math.min(t, (width - cx) / dirX);
|
|
182
|
+
}
|
|
183
|
+
const edgeX = cx + dirX * t;
|
|
184
|
+
const edgeY = cy + dirY * t;
|
|
185
|
+
const offset = tr.rotateAnchorOffset() + tr.padding();
|
|
186
|
+
return {
|
|
187
|
+
edgeX,
|
|
188
|
+
edgeY,
|
|
189
|
+
endX: edgeX + dirX * offset,
|
|
190
|
+
endY: edgeY + dirY * offset,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
153
193
|
const activeTransformers = new Set();
|
|
154
194
|
/**
|
|
155
195
|
* Transformer constructor. Transformer is a special type of group that allow you transform Konva
|
|
@@ -226,7 +266,13 @@ export class Transformer extends Group {
|
|
|
226
266
|
this._handleMouseUp = this._handleMouseUp.bind(this);
|
|
227
267
|
this.update = this.update.bind(this);
|
|
228
268
|
// update transformer data for certain attr changes
|
|
229
|
-
this.on(ATTR_CHANGE_LIST,
|
|
269
|
+
this.on(ATTR_CHANGE_LIST, (event) => {
|
|
270
|
+
if (event.type === 'ignoreStrokeChange')
|
|
271
|
+
this._resetTransformCache();
|
|
272
|
+
this.update();
|
|
273
|
+
});
|
|
274
|
+
// the memoized rect bakes in our own rotation, so a manual rotation must drop it
|
|
275
|
+
this.on(`rotationChange.${EVENTS_NAME}`, () => this._clearCache(NODES_RECT));
|
|
230
276
|
if (this.getNode()) {
|
|
231
277
|
this.update();
|
|
232
278
|
}
|
|
@@ -257,11 +303,19 @@ export class Transformer extends Group {
|
|
|
257
303
|
if (this._nodes && this._nodes.length) {
|
|
258
304
|
this.detach();
|
|
259
305
|
}
|
|
260
|
-
const
|
|
306
|
+
const selected = new Set(nodes);
|
|
307
|
+
for (const node of selected) {
|
|
261
308
|
// check if ancestor of the transformer
|
|
262
309
|
if (node.isAncestorOf(this)) {
|
|
263
310
|
Util.error('Konva.Transformer cannot be an a child of the node you are trying to attach');
|
|
264
|
-
|
|
311
|
+
selected.delete(node);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const filteredNodes = Array.from(selected).filter((node) => {
|
|
315
|
+
// Transform a selected subtree once, through its selected ancestor.
|
|
316
|
+
for (let parent = node.getParent(); parent; parent = parent.getParent()) {
|
|
317
|
+
if (selected.has(parent))
|
|
318
|
+
return false;
|
|
265
319
|
}
|
|
266
320
|
return true;
|
|
267
321
|
});
|
|
@@ -375,6 +429,7 @@ export class Transformer extends Group {
|
|
|
375
429
|
* transformer.detach();
|
|
376
430
|
*/
|
|
377
431
|
detach() {
|
|
432
|
+
var _a;
|
|
378
433
|
// remove events
|
|
379
434
|
if (this._nodes) {
|
|
380
435
|
this._nodes.forEach((node) => {
|
|
@@ -383,6 +438,7 @@ export class Transformer extends Group {
|
|
|
383
438
|
}
|
|
384
439
|
this._nodes = [];
|
|
385
440
|
this._resetTransformCache();
|
|
441
|
+
(_a = this.getLayer()) === null || _a === void 0 ? void 0 : _a.batchDraw();
|
|
386
442
|
}
|
|
387
443
|
/**
|
|
388
444
|
* bind events to the Transformer. You can use events: `transform`, `transformstart`, `transformend`, `dragstart`, `dragmove`, `dragend`
|
|
@@ -432,13 +488,14 @@ export class Transformer extends Group {
|
|
|
432
488
|
// Bounds may only be reused when they are a pure function of the node's
|
|
433
489
|
// own size: then every change reaches us either through _setAttr or
|
|
434
490
|
// through the size probe below. A shape with its own getSelfRect - Line
|
|
435
|
-
// mutates its points array in place, and a user subclass
|
|
436
|
-
// anything at all - may change with no signal, so it is
|
|
437
|
-
// time. Groups depend on their descendants, and a cached
|
|
438
|
-
// suppresses descendant transform-change notifications, so
|
|
439
|
-
// measured too.
|
|
491
|
+
// mutates its points array in place, and a user subclass or selfRectFunc
|
|
492
|
+
// can measure anything at all - may change with no signal, so it is
|
|
493
|
+
// measured every time. Groups depend on their descendants, and a cached
|
|
494
|
+
// ancestor suppresses descendant transform-change notifications, so
|
|
495
|
+
// both are measured too.
|
|
440
496
|
const cacheable = node instanceof Shape &&
|
|
441
497
|
node.getSelfRect === Shape.prototype.getSelfRect &&
|
|
498
|
+
!node.attrs.selfRectFunc &&
|
|
442
499
|
!node._hasCachedAncestor();
|
|
443
500
|
// width() and height() are the only inputs of the default getSelfRect and
|
|
444
501
|
// they can come from outside the attrs (an Image source that loads or
|
|
@@ -454,8 +511,11 @@ export class Transformer extends Group {
|
|
|
454
511
|
bounds.version !== node._attrsVersion ||
|
|
455
512
|
bounds.width !== width ||
|
|
456
513
|
bounds.height !== height) {
|
|
514
|
+
let trans = node.getAbsoluteTransform();
|
|
515
|
+
const [a, b, c, d] = trans.getMatrix();
|
|
516
|
+
const collapsed = a * d - b * c === 0;
|
|
457
517
|
const box = node.getClientRect({
|
|
458
|
-
skipTransform:
|
|
518
|
+
skipTransform: !collapsed,
|
|
459
519
|
skipShadow: true,
|
|
460
520
|
skipStroke: ignoreStroke,
|
|
461
521
|
});
|
|
@@ -465,7 +525,8 @@ export class Transformer extends Group {
|
|
|
465
525
|
{ x: box.x + box.width, y: box.y + box.height },
|
|
466
526
|
{ x: box.x, y: box.y + box.height },
|
|
467
527
|
];
|
|
468
|
-
|
|
528
|
+
if (collapsed)
|
|
529
|
+
trans = new Transform();
|
|
469
530
|
bounds = {
|
|
470
531
|
rotation,
|
|
471
532
|
ignoreStroke,
|
|
@@ -548,6 +609,8 @@ export class Transformer extends Group {
|
|
|
548
609
|
});
|
|
549
610
|
// add hover styling
|
|
550
611
|
anchor.on('mouseenter', () => {
|
|
612
|
+
if (this.isTransforming())
|
|
613
|
+
return;
|
|
551
614
|
const rad = Konva.getAngle(this.rotation());
|
|
552
615
|
const rotateCursor = this.rotateAnchorCursor();
|
|
553
616
|
const cursor = getCursor(name, rad, rotateCursor);
|
|
@@ -556,9 +619,11 @@ export class Transformer extends Group {
|
|
|
556
619
|
this._cursorChange = true;
|
|
557
620
|
});
|
|
558
621
|
anchor.on('mouseout', () => {
|
|
622
|
+
this._cursorChange = false;
|
|
623
|
+
if (this.isTransforming())
|
|
624
|
+
return;
|
|
559
625
|
anchor.getStage().content &&
|
|
560
626
|
(anchor.getStage().content.style.cursor = '');
|
|
561
|
-
this._cursorChange = false;
|
|
562
627
|
});
|
|
563
628
|
this.add(anchor);
|
|
564
629
|
}
|
|
@@ -569,45 +634,17 @@ export class Transformer extends Group {
|
|
|
569
634
|
height: 0,
|
|
570
635
|
sceneFunc(ctx, shape) {
|
|
571
636
|
const tr = shape.getParent();
|
|
637
|
+
if (!tr.borderEnabled())
|
|
638
|
+
return;
|
|
572
639
|
const padding = tr.padding();
|
|
573
640
|
const width = shape.width();
|
|
574
641
|
const height = shape.height();
|
|
575
642
|
ctx.beginPath();
|
|
576
643
|
ctx.rect(-padding, -padding, width + padding * 2, height + padding * 2);
|
|
577
644
|
if (tr.rotateEnabled() && tr.rotateLineVisible()) {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
const rad = Util.degToRad(rotateAnchorAngle);
|
|
582
|
-
// Direction vector (0 degrees = up/top)
|
|
583
|
-
const dirX = Math.sin(rad);
|
|
584
|
-
const dirY = -Math.cos(rad);
|
|
585
|
-
// Center of the box
|
|
586
|
-
const cx = width / 2;
|
|
587
|
-
const cy = height / 2;
|
|
588
|
-
// Find intersection with box edge
|
|
589
|
-
let t = Infinity;
|
|
590
|
-
if (dirY < 0) {
|
|
591
|
-
t = Math.min(t, -cy / dirY);
|
|
592
|
-
}
|
|
593
|
-
else if (dirY > 0) {
|
|
594
|
-
t = Math.min(t, (height - cy) / dirY);
|
|
595
|
-
}
|
|
596
|
-
if (dirX < 0) {
|
|
597
|
-
t = Math.min(t, -cx / dirX);
|
|
598
|
-
}
|
|
599
|
-
else if (dirX > 0) {
|
|
600
|
-
t = Math.min(t, (width - cx) / dirX);
|
|
601
|
-
}
|
|
602
|
-
// Edge point (start of line)
|
|
603
|
-
const edgeX = cx + dirX * t;
|
|
604
|
-
const edgeY = cy + dirY * t;
|
|
605
|
-
// End point with offset
|
|
606
|
-
const sign = Util._sign(height);
|
|
607
|
-
const endX = edgeX + dirX * rotateAnchorOffset * sign;
|
|
608
|
-
const endY = edgeY + dirY * rotateAnchorOffset * sign;
|
|
609
|
-
ctx.moveTo(edgeX, edgeY);
|
|
610
|
-
ctx.lineTo(endX, endY);
|
|
645
|
+
const line = getRotaterLine(tr, width, height);
|
|
646
|
+
ctx.moveTo(line.edgeX, line.edgeY);
|
|
647
|
+
ctx.lineTo(line.endX, line.endY);
|
|
611
648
|
}
|
|
612
649
|
ctx.fillStrokeShape(shape);
|
|
613
650
|
},
|
|
@@ -643,6 +680,8 @@ export class Transformer extends Group {
|
|
|
643
680
|
}
|
|
644
681
|
_handleMouseDown(e) {
|
|
645
682
|
var _a, _b;
|
|
683
|
+
if (e.evt.button !== undefined && !Konva.dragButtons.includes(e.evt.button))
|
|
684
|
+
return;
|
|
646
685
|
// do nothing if we already transforming
|
|
647
686
|
// that is possible to trigger with multitouch
|
|
648
687
|
if (this._transforming) {
|
|
@@ -714,11 +753,8 @@ export class Transformer extends Group {
|
|
|
714
753
|
y = -anchorNode.y() + attrs.height / 2;
|
|
715
754
|
// Calculate angle from center to current anchor position
|
|
716
755
|
// Offset by rotateAnchorAngle so we measure rotation from the anchor's starting position
|
|
717
|
-
const rotateAnchorAngleRad =
|
|
756
|
+
const rotateAnchorAngleRad = Util.degToRad(this.rotateAnchorAngle());
|
|
718
757
|
let delta = Math.atan2(-y, x) + Math.PI / 2 - rotateAnchorAngleRad;
|
|
719
|
-
if (attrs.height < 0) {
|
|
720
|
-
delta -= Math.PI;
|
|
721
|
-
}
|
|
722
758
|
const oldRotation = Konva.getAngle(this.rotation());
|
|
723
759
|
const newRotation = oldRotation + delta;
|
|
724
760
|
const tol = Konva.getAngle(this.rotationSnapTolerance());
|
|
@@ -905,9 +941,12 @@ export class Transformer extends Group {
|
|
|
905
941
|
return top ? top.getAbsoluteTransform().copy().invert().multiply(at) : at;
|
|
906
942
|
}
|
|
907
943
|
_removeEvents(e) {
|
|
908
|
-
var _a;
|
|
944
|
+
var _a, _b;
|
|
909
945
|
if (this._transforming) {
|
|
910
946
|
this._transforming = false;
|
|
947
|
+
const content = (_a = this.getStage()) === null || _a === void 0 ? void 0 : _a.content;
|
|
948
|
+
if (content && !this._cursorChange)
|
|
949
|
+
content.style.cursor = '';
|
|
911
950
|
const win = this._transformWindow;
|
|
912
951
|
this._transformWindow = null;
|
|
913
952
|
if (win) {
|
|
@@ -921,7 +960,7 @@ export class Transformer extends Group {
|
|
|
921
960
|
activeTransformers.delete(this);
|
|
922
961
|
this._fire('transformend', { evt: e, target: node });
|
|
923
962
|
// redraw layer to restore hit graph
|
|
924
|
-
(
|
|
963
|
+
(_b = this.getLayer()) === null || _b === void 0 ? void 0 : _b.batchDraw();
|
|
925
964
|
if (node) {
|
|
926
965
|
this._nodes.forEach((target) => {
|
|
927
966
|
var _a;
|
|
@@ -934,17 +973,12 @@ export class Transformer extends Group {
|
|
|
934
973
|
}
|
|
935
974
|
}
|
|
936
975
|
_fitNodesInto(newAttrs, evt, anchorProjected = false) {
|
|
937
|
-
//
|
|
938
|
-
// don't each trigger _requestDraw -> getLayer parent-chain walks.
|
|
939
|
-
// batchDraw per affected layer is issued at the end.
|
|
940
|
-
const prevAutoDraw = Konva.autoDrawEnabled;
|
|
941
|
-
Konva.autoDrawEnabled = false;
|
|
976
|
+
// Defer our own bounds updates while preserving drawing in user callbacks.
|
|
942
977
|
this._fitting = true;
|
|
943
978
|
try {
|
|
944
979
|
return this._doFitNodesInto(newAttrs, evt, anchorProjected);
|
|
945
980
|
}
|
|
946
981
|
finally {
|
|
947
|
-
Konva.autoDrawEnabled = prevAutoDraw;
|
|
948
982
|
this._fitting = false;
|
|
949
983
|
}
|
|
950
984
|
}
|
|
@@ -1169,7 +1203,6 @@ export class Transformer extends Group {
|
|
|
1169
1203
|
return;
|
|
1170
1204
|
}
|
|
1171
1205
|
this._lastNodeRect = { ...attrs };
|
|
1172
|
-
this.rotation(Util._getRotation(attrs.rotation));
|
|
1173
1206
|
const width = attrs.width;
|
|
1174
1207
|
const height = attrs.height;
|
|
1175
1208
|
const enabledAnchors = this.enabledAnchors();
|
|
@@ -1241,50 +1274,16 @@ export class Transformer extends Group {
|
|
|
1241
1274
|
offsetY: anchorSize / 2 - padding,
|
|
1242
1275
|
visible: resizeEnabled && enabledAnchors.indexOf('bottom-right') >= 0,
|
|
1243
1276
|
});
|
|
1244
|
-
|
|
1245
|
-
const rotateAnchorAngle = this.rotateAnchorAngle();
|
|
1246
|
-
const rotateAnchorOffset = this.rotateAnchorOffset();
|
|
1247
|
-
const rad = Util.degToRad(rotateAnchorAngle);
|
|
1248
|
-
// Direction vector (0 degrees = up/top)
|
|
1249
|
-
const dirX = Math.sin(rad);
|
|
1250
|
-
const dirY = -Math.cos(rad);
|
|
1251
|
-
// Center of the box
|
|
1252
|
-
const cx = width / 2;
|
|
1253
|
-
const cy = height / 2;
|
|
1254
|
-
// Find intersection with box edge
|
|
1255
|
-
// Calculate time to hit each edge from center
|
|
1256
|
-
let t = Infinity;
|
|
1257
|
-
// Handle each direction
|
|
1258
|
-
if (dirY < 0) {
|
|
1259
|
-
// Moving up, check top edge (y = 0)
|
|
1260
|
-
t = Math.min(t, -cy / dirY);
|
|
1261
|
-
}
|
|
1262
|
-
else if (dirY > 0) {
|
|
1263
|
-
// Moving down, check bottom edge (y = height)
|
|
1264
|
-
t = Math.min(t, (height - cy) / dirY);
|
|
1265
|
-
}
|
|
1266
|
-
if (dirX < 0) {
|
|
1267
|
-
// Moving left, check left edge (x = 0)
|
|
1268
|
-
t = Math.min(t, -cx / dirX);
|
|
1269
|
-
}
|
|
1270
|
-
else if (dirX > 0) {
|
|
1271
|
-
// Moving right, check right edge (x = width)
|
|
1272
|
-
t = Math.min(t, (width - cx) / dirX);
|
|
1273
|
-
}
|
|
1274
|
-
// Edge point
|
|
1275
|
-
const edgeX = cx + dirX * t;
|
|
1276
|
-
const edgeY = cy + dirY * t;
|
|
1277
|
-
// Final position with offset (accounting for height sign and padding)
|
|
1278
|
-
const sign = Util._sign(height);
|
|
1277
|
+
const rotaterLine = getRotaterLine(this, width, height);
|
|
1279
1278
|
this._anchors['rotater'].setAttrs({
|
|
1280
|
-
x:
|
|
1281
|
-
y:
|
|
1279
|
+
x: rotaterLine.endX,
|
|
1280
|
+
y: rotaterLine.endY,
|
|
1282
1281
|
visible: this.rotateEnabled(),
|
|
1283
1282
|
});
|
|
1284
1283
|
this._back.setAttrs({
|
|
1285
1284
|
width: width,
|
|
1286
1285
|
height: height,
|
|
1287
|
-
visible: this.borderEnabled(),
|
|
1286
|
+
visible: this.borderEnabled() || this.shouldOverdrawWholeArea(),
|
|
1288
1287
|
stroke: this.borderStroke(),
|
|
1289
1288
|
strokeWidth: this.borderStrokeWidth(),
|
|
1290
1289
|
dash: this.borderDash(),
|
package/lib/shapes/Wedge.js
CHANGED
|
@@ -49,7 +49,7 @@ export class Wedge extends Shape {
|
|
|
49
49
|
Wedge.prototype.className = 'Wedge';
|
|
50
50
|
Wedge.prototype._centroid = true;
|
|
51
51
|
Wedge.prototype._attrsAffectingSize = ['radius'];
|
|
52
|
-
_registerNode(Wedge);
|
|
52
|
+
_registerNode(Wedge, true);
|
|
53
53
|
/**
|
|
54
54
|
* get/set radius
|
|
55
55
|
* @name Konva.Wedge#radius
|
package/lib/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "konva",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.0",
|
|
4
4
|
"description": "HTML5 2d canvas library for interactive graphics, design editors, whiteboards, and diagrams.",
|
|
5
5
|
"author": "Anton Lavrenov",
|
|
6
6
|
"type": "module",
|
|
@@ -48,14 +48,13 @@
|
|
|
48
48
|
"test:build": "rimraf ./.parcel-cache && PARCEL_WORKER_BACKEND=process parcel build ./test/unit-tests.html --dist-dir ./test-build --target none --public-url ./ --no-source-maps",
|
|
49
49
|
"test:browser": "npm run test:build && mocha-headless-chrome -f ./test-build/unit-tests.html -a disable-web-security -a no-sandbox -a disable-setuid-sandbox",
|
|
50
50
|
"test:watch": "rimraf ./.parcel-cache && PARCEL_WORKERS=0 parcel serve ./test/unit-tests.html ./test/manual-tests.html ./test/sandbox.html ./test/text-paths.html ./test/bunnies.html",
|
|
51
|
-
"test:node:canvas": "mocha -r tsx -r ./test/node-canvas-global-setup.mjs --extension ts --recursive './test/unit/'",
|
|
52
|
-
"test:node:skia": "mocha -r tsx -r ./test/node-skia-global-setup.mjs --extension ts --recursive './test/unit/'",
|
|
51
|
+
"test:node:canvas": "mocha -r tsx -r ./test/node-canvas-global-setup.mjs --file ./test/setup.ts --extension ts --recursive './test/unit/'",
|
|
52
|
+
"test:node:skia": "mocha -r tsx -r ./test/node-skia-global-setup.mjs --file ./test/setup.ts --extension ts --recursive './test/unit/'",
|
|
53
53
|
"test:node": "npm run test:node:canvas && npm run test:node:skia",
|
|
54
54
|
"tsc": "tsc",
|
|
55
55
|
"rollup": "rollup -c",
|
|
56
56
|
"clean": "rimraf ./lib ./test-build",
|
|
57
|
-
"watch": "rollup -c -w"
|
|
58
|
-
"size": "size-limit"
|
|
57
|
+
"watch": "rollup -c -w"
|
|
59
58
|
},
|
|
60
59
|
"targets": {
|
|
61
60
|
"none": {}
|
|
@@ -74,22 +73,8 @@
|
|
|
74
73
|
"url": "https://github.com/sponsors/lavrton"
|
|
75
74
|
}
|
|
76
75
|
],
|
|
77
|
-
"size-limit": [
|
|
78
|
-
{
|
|
79
|
-
"limit": "48 KB",
|
|
80
|
-
"path": "./lib/index.js"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"limit": "26 KB",
|
|
84
|
-
"path": "./lib/Core.js"
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"path": "./konva.min.js"
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
76
|
"devDependencies": {
|
|
91
77
|
"@parcel/transformer-image": "2.15.4",
|
|
92
|
-
"@size-limit/preset-big-lib": "^11.2.0",
|
|
93
78
|
"@types/mocha": "^10.0.10",
|
|
94
79
|
"canvas": "^3.2.1",
|
|
95
80
|
"chai": "6.2.2",
|
|
@@ -108,8 +93,8 @@
|
|
|
108
93
|
"rimraf": "^6.1.2",
|
|
109
94
|
"rollup": "^4.55.1",
|
|
110
95
|
"rollup-plugin-typescript2": "^0.37.0",
|
|
111
|
-
"size-limit": "^11.2.0",
|
|
112
96
|
"skia-canvas": "^3.0.4",
|
|
97
|
+
"stats.js": "0.17.0",
|
|
113
98
|
"tsx": "^4.21.0",
|
|
114
99
|
"typescript": "^5.9.3"
|
|
115
100
|
},
|