konva 9.3.17 → 9.3.19
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 +261 -231
- package/konva.min.js +3 -3
- package/lib/Canvas.js +0 -3
- package/lib/Global.js +1 -1
- package/lib/shapes/Arc.js +6 -1
- package/lib/shapes/Image.d.ts +3 -0
- package/lib/shapes/Image.js +16 -4
- package/lib/shapes/Text.js +18 -14
- package/lib/shapes/Transformer.js +6 -4
- package/lib/types.d.ts +1 -1
- package/package.json +7 -7
package/konva.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
})(this, (function () { 'use strict';
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
* Konva JavaScript Framework v9.3.
|
|
8
|
+
* Konva JavaScript Framework v9.3.19
|
|
9
9
|
* http://konvajs.org/
|
|
10
10
|
* Licensed under the MIT
|
|
11
|
-
* Date:
|
|
11
|
+
* Date: Wed Mar 12 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: '9.3.
|
|
38
|
+
version: '9.3.19',
|
|
39
39
|
isBrowser: detectBrowser(),
|
|
40
40
|
isUnminified: /param/.test(function (param) { }.toString()),
|
|
41
41
|
dblClickWindow: 400,
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
},
|
|
152
152
|
isTransforming() {
|
|
153
153
|
var _a;
|
|
154
|
-
return (_a = Konva$2['Transformer']) === null || _a ===
|
|
154
|
+
return (_a = Konva$2['Transformer']) === null || _a === undefined ? undefined : _a.isTransforming();
|
|
155
155
|
},
|
|
156
156
|
/**
|
|
157
157
|
* returns whether or not a drag and drop operation is ready, but may
|
|
@@ -2178,7 +2178,7 @@
|
|
|
2178
2178
|
}
|
|
2179
2179
|
_applyShadow(shape) {
|
|
2180
2180
|
var _a, _b, _c;
|
|
2181
|
-
const color = (_a = shape.getShadowRGBA()) !== null && _a !==
|
|
2181
|
+
const color = (_a = shape.getShadowRGBA()) !== null && _a !== undefined ? _a : 'black', blur = (_b = shape.getShadowBlur()) !== null && _b !== undefined ? _b : 5, offset = (_c = shape.getShadowOffset()) !== null && _c !== undefined ? _c : {
|
|
2182
2182
|
x: 0,
|
|
2183
2183
|
y: 0,
|
|
2184
2184
|
}, scale = shape.getAbsoluteScale(), ratio = this.canvas.getPixelRatio(), scaleX = scale.x * ratio, scaleY = scale.y * ratio;
|
|
@@ -2287,9 +2287,32 @@
|
|
|
2287
2287
|
getContext() {
|
|
2288
2288
|
return this.context;
|
|
2289
2289
|
}
|
|
2290
|
+
/**
|
|
2291
|
+
* get pixel ratio
|
|
2292
|
+
* @method
|
|
2293
|
+
* @name Konva.Canvas#getPixelRatio
|
|
2294
|
+
* @returns {Number} pixel ratio
|
|
2295
|
+
* @example
|
|
2296
|
+
* var pixelRatio = layer.getCanvas.getPixelRatio();
|
|
2297
|
+
*/
|
|
2290
2298
|
getPixelRatio() {
|
|
2291
2299
|
return this.pixelRatio;
|
|
2292
2300
|
}
|
|
2301
|
+
/**
|
|
2302
|
+
* set pixel ratio
|
|
2303
|
+
* KonvaJS automatically handles pixel ratio adustments in order to render crisp drawings
|
|
2304
|
+
* on all devices. Most desktops, low end tablets, and low end phones, have device pixel ratios
|
|
2305
|
+
* of 1. Some high end tablets and phones, like iPhones and iPads have a device pixel ratio
|
|
2306
|
+
* of 2. Some Macbook Pros, and iMacs also have a device pixel ratio of 2. Some high end Android devices have pixel
|
|
2307
|
+
* ratios of 2 or 3. Some browsers like Firefox allow you to configure the pixel ratio of the viewport. Unless otherwise
|
|
2308
|
+
* specificed, the pixel ratio will be defaulted to the actual device pixel ratio. You can override the device pixel
|
|
2309
|
+
* ratio for special situations, or, if you don't want the pixel ratio to be taken into account, you can set it to 1.
|
|
2310
|
+
* @method
|
|
2311
|
+
* @name Konva.Canvas#setPixelRatio
|
|
2312
|
+
* @param {Number} pixelRatio
|
|
2313
|
+
* @example
|
|
2314
|
+
* layer.getCanvas().setPixelRatio(3);
|
|
2315
|
+
*/
|
|
2293
2316
|
setPixelRatio(pixelRatio) {
|
|
2294
2317
|
const previousRatio = this.pixelRatio;
|
|
2295
2318
|
this.pixelRatio = pixelRatio;
|
|
@@ -2346,27 +2369,6 @@
|
|
|
2346
2369
|
}
|
|
2347
2370
|
}
|
|
2348
2371
|
}
|
|
2349
|
-
/**
|
|
2350
|
-
* get/set pixel ratio.
|
|
2351
|
-
* KonvaJS automatically handles pixel ratio adustments in order to render crisp drawings
|
|
2352
|
-
* on all devices. Most desktops, low end tablets, and low end phones, have device pixel ratios
|
|
2353
|
-
* of 1. Some high end tablets and phones, like iPhones and iPads have a device pixel ratio
|
|
2354
|
-
* of 2. Some Macbook Pros, and iMacs also have a device pixel ratio of 2. Some high end Android devices have pixel
|
|
2355
|
-
* ratios of 2 or 3. Some browsers like Firefox allow you to configure the pixel ratio of the viewport. Unless otherwise
|
|
2356
|
-
* specificed, the pixel ratio will be defaulted to the actual device pixel ratio. You can override the device pixel
|
|
2357
|
-
* ratio for special situations, or, if you don't want the pixel ratio to be taken into account, you can set it to 1.
|
|
2358
|
-
* @name Konva.Canvas#pixelRatio
|
|
2359
|
-
* @method
|
|
2360
|
-
* @param {Number} pixelRatio
|
|
2361
|
-
* @returns {Number}
|
|
2362
|
-
* @example
|
|
2363
|
-
* // get
|
|
2364
|
-
* var pixelRatio = layer.getCanvas.pixelRatio();
|
|
2365
|
-
*
|
|
2366
|
-
* // set
|
|
2367
|
-
* layer.getCanvas().pixelRatio(3);
|
|
2368
|
-
*/
|
|
2369
|
-
Factory.addGetterSetter(Canvas, 'pixelRatio', undefined, getNumberValidator());
|
|
2370
2372
|
class SceneCanvas extends Canvas {
|
|
2371
2373
|
constructor(config = { width: 0, height: 0, willReadFrequently: false }) {
|
|
2372
2374
|
super(config);
|
|
@@ -4027,7 +4029,7 @@
|
|
|
4027
4029
|
// I was trying to use attributes directly here
|
|
4028
4030
|
// but it doesn't work for Transformer well
|
|
4029
4031
|
// because it overwrite x,y getters
|
|
4030
|
-
const x = this.x(), y = this.y(), rotation = Konva$2.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !==
|
|
4032
|
+
const x = this.x(), y = this.y(), rotation = Konva$2.getAngle(this.rotation()), scaleX = (_a = this.attrs.scaleX) !== null && _a !== undefined ? _a : 1, scaleY = (_b = this.attrs.scaleY) !== null && _b !== undefined ? _b : 1, skewX = this.attrs.skewX || 0, skewY = this.attrs.skewY || 0, offsetX = this.attrs.offsetX || 0, offsetY = this.attrs.offsetY || 0;
|
|
4031
4033
|
if (x !== 0 || y !== 0) {
|
|
4032
4034
|
m.translate(x, y);
|
|
4033
4035
|
}
|
|
@@ -4414,7 +4416,7 @@
|
|
|
4414
4416
|
_requestDraw() {
|
|
4415
4417
|
if (Konva$2.autoDrawEnabled) {
|
|
4416
4418
|
const drawNode = this.getLayer() || this.getStage();
|
|
4417
|
-
drawNode === null || drawNode ===
|
|
4419
|
+
drawNode === null || drawNode === undefined ? undefined : drawNode.batchDraw();
|
|
4418
4420
|
}
|
|
4419
4421
|
}
|
|
4420
4422
|
_setAttr(key, val) {
|
|
@@ -4477,14 +4479,14 @@
|
|
|
4477
4479
|
}
|
|
4478
4480
|
_getProtoListeners(eventType) {
|
|
4479
4481
|
var _a, _b, _c;
|
|
4480
|
-
const allListeners = (_a = this._cache.get(ALL_LISTENERS)) !== null && _a !==
|
|
4481
|
-
let events = allListeners === null || allListeners ===
|
|
4482
|
+
const allListeners = (_a = this._cache.get(ALL_LISTENERS)) !== null && _a !== undefined ? _a : {};
|
|
4483
|
+
let events = allListeners === null || allListeners === undefined ? undefined : allListeners[eventType];
|
|
4482
4484
|
if (events === undefined) {
|
|
4483
4485
|
//recalculate cache
|
|
4484
4486
|
events = [];
|
|
4485
4487
|
let obj = Object.getPrototypeOf(this);
|
|
4486
4488
|
while (obj) {
|
|
4487
|
-
const hierarchyEvents = (_c = (_b = obj.eventListeners) === null || _b ===
|
|
4489
|
+
const hierarchyEvents = (_c = (_b = obj.eventListeners) === null || _b === undefined ? undefined : _b[eventType]) !== null && _c !== undefined ? _c : [];
|
|
4488
4490
|
events.push(...hierarchyEvents);
|
|
4489
4491
|
obj = Object.getPrototypeOf(obj);
|
|
4490
4492
|
}
|
|
@@ -5596,13 +5598,13 @@
|
|
|
5596
5598
|
if (this.isCached()) {
|
|
5597
5599
|
return;
|
|
5598
5600
|
}
|
|
5599
|
-
(_a = this.children) === null || _a ===
|
|
5601
|
+
(_a = this.children) === null || _a === undefined ? undefined : _a.forEach(function (node) {
|
|
5600
5602
|
node._clearSelfAndDescendantCache(attr);
|
|
5601
5603
|
});
|
|
5602
5604
|
}
|
|
5603
5605
|
_setChildrenIndices() {
|
|
5604
5606
|
var _a;
|
|
5605
|
-
(_a = this.children) === null || _a ===
|
|
5607
|
+
(_a = this.children) === null || _a === undefined ? undefined : _a.forEach(function (child, n) {
|
|
5606
5608
|
child.index = n;
|
|
5607
5609
|
});
|
|
5608
5610
|
this._requestDraw();
|
|
@@ -5673,7 +5675,7 @@
|
|
|
5673
5675
|
context.save();
|
|
5674
5676
|
context._applyGlobalCompositeOperation(this);
|
|
5675
5677
|
}
|
|
5676
|
-
(_a = this.children) === null || _a ===
|
|
5678
|
+
(_a = this.children) === null || _a === undefined ? undefined : _a.forEach(function (child) {
|
|
5677
5679
|
child[drawMethod](canvas, top, bufferCanvas);
|
|
5678
5680
|
});
|
|
5679
5681
|
if (hasComposition) {
|
|
@@ -5695,7 +5697,7 @@
|
|
|
5695
5697
|
height: 0,
|
|
5696
5698
|
};
|
|
5697
5699
|
const that = this;
|
|
5698
|
-
(_a = this.children) === null || _a ===
|
|
5700
|
+
(_a = this.children) === null || _a === undefined ? undefined : _a.forEach(function (child) {
|
|
5699
5701
|
// skip invisible children
|
|
5700
5702
|
if (!child.visible()) {
|
|
5701
5703
|
return;
|
|
@@ -7107,7 +7109,7 @@
|
|
|
7107
7109
|
// it probably will be simpler, then copy/paste the code
|
|
7108
7110
|
var _a;
|
|
7109
7111
|
// force skip buffer canvas
|
|
7110
|
-
const perfectDrawEnabled = (_a = this.attrs.perfectDrawEnabled) !== null && _a !==
|
|
7112
|
+
const perfectDrawEnabled = (_a = this.attrs.perfectDrawEnabled) !== null && _a !== undefined ? _a : true;
|
|
7111
7113
|
if (!perfectDrawEnabled) {
|
|
7112
7114
|
return false;
|
|
7113
7115
|
}
|
|
@@ -8871,7 +8873,7 @@
|
|
|
8871
8873
|
* @constructor
|
|
8872
8874
|
* @memberof Konva
|
|
8873
8875
|
* @augments Konva.Layer
|
|
8874
|
-
*
|
|
8876
|
+
* @param {Object} [config.clip] set clip
|
|
8875
8877
|
* @param {Number} [config.clipX] set clip x
|
|
8876
8878
|
* @param {Number} [config.clipY] set clip y
|
|
8877
8879
|
* @param {Number} [config.clipWidth] set clip width
|
|
@@ -10019,7 +10021,12 @@
|
|
|
10019
10021
|
}
|
|
10020
10022
|
Arc.prototype._centroid = true;
|
|
10021
10023
|
Arc.prototype.className = 'Arc';
|
|
10022
|
-
Arc.prototype._attrsAffectingSize = [
|
|
10024
|
+
Arc.prototype._attrsAffectingSize = [
|
|
10025
|
+
'innerRadius',
|
|
10026
|
+
'outerRadius',
|
|
10027
|
+
'angle',
|
|
10028
|
+
'clockwise',
|
|
10029
|
+
];
|
|
10023
10030
|
_registerNode(Arc);
|
|
10024
10031
|
// add getters setters
|
|
10025
10032
|
Factory.addGetterSetter(Arc, 'innerRadius', 0, getNumberValidator());
|
|
@@ -10400,337 +10407,337 @@
|
|
|
10400
10407
|
[],
|
|
10401
10408
|
[],
|
|
10402
10409
|
[
|
|
10403
|
-
-0.
|
|
10410
|
+
-0.5773502691896257,
|
|
10404
10411
|
0.5773502691896257645091487805019574556476,
|
|
10405
10412
|
],
|
|
10406
10413
|
[
|
|
10407
|
-
0, -0.
|
|
10414
|
+
0, -0.7745966692414834,
|
|
10408
10415
|
0.7745966692414833770358530799564799221665,
|
|
10409
10416
|
],
|
|
10410
10417
|
[
|
|
10411
|
-
-0.
|
|
10418
|
+
-0.33998104358485626,
|
|
10412
10419
|
0.3399810435848562648026657591032446872005,
|
|
10413
|
-
-0.
|
|
10420
|
+
-0.8611363115940526,
|
|
10414
10421
|
0.8611363115940525752239464888928095050957,
|
|
10415
10422
|
],
|
|
10416
10423
|
[
|
|
10417
|
-
0, -0.
|
|
10424
|
+
0, -0.5384693101056831,
|
|
10418
10425
|
0.5384693101056830910363144207002088049672,
|
|
10419
|
-
-0.
|
|
10426
|
+
-0.906179845938664,
|
|
10420
10427
|
0.9061798459386639927976268782993929651256,
|
|
10421
10428
|
],
|
|
10422
10429
|
[
|
|
10423
10430
|
0.6612093864662645136613995950199053470064,
|
|
10424
|
-
-0.
|
|
10425
|
-
-0.
|
|
10431
|
+
-0.6612093864662645,
|
|
10432
|
+
-0.2386191860831969,
|
|
10426
10433
|
0.2386191860831969086305017216807119354186,
|
|
10427
|
-
-0.
|
|
10434
|
+
-0.932469514203152,
|
|
10428
10435
|
0.9324695142031520278123015544939946091347,
|
|
10429
10436
|
],
|
|
10430
10437
|
[
|
|
10431
10438
|
0, 0.4058451513773971669066064120769614633473,
|
|
10432
|
-
-0.
|
|
10433
|
-
-0.
|
|
10439
|
+
-0.4058451513773972,
|
|
10440
|
+
-0.7415311855993945,
|
|
10434
10441
|
0.7415311855993944398638647732807884070741,
|
|
10435
|
-
-0.
|
|
10442
|
+
-0.9491079123427585,
|
|
10436
10443
|
0.9491079123427585245261896840478512624007,
|
|
10437
10444
|
],
|
|
10438
10445
|
[
|
|
10439
|
-
-0.
|
|
10446
|
+
-0.1834346424956498,
|
|
10440
10447
|
0.1834346424956498049394761423601839806667,
|
|
10441
|
-
-0.
|
|
10448
|
+
-0.525532409916329,
|
|
10442
10449
|
0.5255324099163289858177390491892463490419,
|
|
10443
|
-
-0.
|
|
10450
|
+
-0.7966664774136267,
|
|
10444
10451
|
0.7966664774136267395915539364758304368371,
|
|
10445
|
-
-0.
|
|
10452
|
+
-0.9602898564975363,
|
|
10446
10453
|
0.9602898564975362316835608685694729904282,
|
|
10447
10454
|
],
|
|
10448
10455
|
[
|
|
10449
|
-
0, -0.
|
|
10456
|
+
0, -0.8360311073266358,
|
|
10450
10457
|
0.8360311073266357942994297880697348765441,
|
|
10451
|
-
-0.
|
|
10458
|
+
-0.9681602395076261,
|
|
10452
10459
|
0.9681602395076260898355762029036728700494,
|
|
10453
|
-
-0.
|
|
10460
|
+
-0.3242534234038089,
|
|
10454
10461
|
0.3242534234038089290385380146433366085719,
|
|
10455
|
-
-0.
|
|
10462
|
+
-0.6133714327005904,
|
|
10456
10463
|
0.6133714327005903973087020393414741847857,
|
|
10457
10464
|
],
|
|
10458
10465
|
[
|
|
10459
|
-
-0.
|
|
10466
|
+
-0.14887433898163122,
|
|
10460
10467
|
0.1488743389816312108848260011297199846175,
|
|
10461
|
-
-0.
|
|
10468
|
+
-0.4333953941292472,
|
|
10462
10469
|
0.4333953941292471907992659431657841622,
|
|
10463
|
-
-0.
|
|
10470
|
+
-0.6794095682990244,
|
|
10464
10471
|
0.6794095682990244062343273651148735757692,
|
|
10465
|
-
-0.
|
|
10472
|
+
-0.8650633666889845,
|
|
10466
10473
|
0.8650633666889845107320966884234930485275,
|
|
10467
|
-
-0.
|
|
10474
|
+
-0.9739065285171717,
|
|
10468
10475
|
0.9739065285171717200779640120844520534282,
|
|
10469
10476
|
],
|
|
10470
10477
|
[
|
|
10471
|
-
0, -0.
|
|
10478
|
+
0, -0.26954315595234496,
|
|
10472
10479
|
0.2695431559523449723315319854008615246796,
|
|
10473
|
-
-0.
|
|
10480
|
+
-0.5190961292068118,
|
|
10474
10481
|
0.5190961292068118159257256694586095544802,
|
|
10475
|
-
-0.
|
|
10482
|
+
-0.7301520055740494,
|
|
10476
10483
|
0.7301520055740493240934162520311534580496,
|
|
10477
|
-
-0.
|
|
10484
|
+
-0.8870625997680953,
|
|
10478
10485
|
0.8870625997680952990751577693039272666316,
|
|
10479
|
-
-0.
|
|
10486
|
+
-0.978228658146057,
|
|
10480
10487
|
0.9782286581460569928039380011228573907714,
|
|
10481
10488
|
],
|
|
10482
10489
|
[
|
|
10483
|
-
-0.
|
|
10490
|
+
-0.1252334085114689,
|
|
10484
10491
|
0.1252334085114689154724413694638531299833,
|
|
10485
|
-
-0.
|
|
10492
|
+
-0.3678314989981802,
|
|
10486
10493
|
0.3678314989981801937526915366437175612563,
|
|
10487
|
-
-0.
|
|
10494
|
+
-0.5873179542866175,
|
|
10488
10495
|
0.587317954286617447296702418940534280369,
|
|
10489
|
-
-0.
|
|
10496
|
+
-0.7699026741943047,
|
|
10490
10497
|
0.7699026741943046870368938332128180759849,
|
|
10491
|
-
-0.
|
|
10498
|
+
-0.9041172563704749,
|
|
10492
10499
|
0.9041172563704748566784658661190961925375,
|
|
10493
|
-
-0.
|
|
10500
|
+
-0.9815606342467192,
|
|
10494
10501
|
0.9815606342467192506905490901492808229601,
|
|
10495
10502
|
],
|
|
10496
10503
|
[
|
|
10497
|
-
0, -0.
|
|
10504
|
+
0, -0.2304583159551348,
|
|
10498
10505
|
0.2304583159551347940655281210979888352115,
|
|
10499
|
-
-0.
|
|
10506
|
+
-0.44849275103644687,
|
|
10500
10507
|
0.4484927510364468528779128521276398678019,
|
|
10501
|
-
-0.
|
|
10508
|
+
-0.6423493394403402,
|
|
10502
10509
|
0.6423493394403402206439846069955156500716,
|
|
10503
|
-
-0.
|
|
10510
|
+
-0.8015780907333099,
|
|
10504
10511
|
0.8015780907333099127942064895828598903056,
|
|
10505
|
-
-0.
|
|
10512
|
+
-0.9175983992229779,
|
|
10506
10513
|
0.9175983992229779652065478365007195123904,
|
|
10507
|
-
-0.
|
|
10514
|
+
-0.9841830547185881,
|
|
10508
10515
|
0.9841830547185881494728294488071096110649,
|
|
10509
10516
|
],
|
|
10510
10517
|
[
|
|
10511
|
-
-0.
|
|
10518
|
+
-0.10805494870734367,
|
|
10512
10519
|
0.1080549487073436620662446502198347476119,
|
|
10513
|
-
-0.
|
|
10520
|
+
-0.31911236892788974,
|
|
10514
10521
|
0.3191123689278897604356718241684754668342,
|
|
10515
|
-
-0.
|
|
10522
|
+
-0.5152486363581541,
|
|
10516
10523
|
0.5152486363581540919652907185511886623088,
|
|
10517
|
-
-0.
|
|
10524
|
+
-0.6872929048116855,
|
|
10518
10525
|
0.6872929048116854701480198030193341375384,
|
|
10519
|
-
-0.
|
|
10526
|
+
-0.827201315069765,
|
|
10520
10527
|
0.8272013150697649931897947426503949610397,
|
|
10521
|
-
-0.
|
|
10528
|
+
-0.9284348836635735,
|
|
10522
10529
|
0.928434883663573517336391139377874264477,
|
|
10523
|
-
-0.
|
|
10530
|
+
-0.9862838086968123,
|
|
10524
10531
|
0.986283808696812338841597266704052801676,
|
|
10525
10532
|
],
|
|
10526
10533
|
[
|
|
10527
|
-
0, -0.
|
|
10534
|
+
0, -0.20119409399743451,
|
|
10528
10535
|
0.2011940939974345223006283033945962078128,
|
|
10529
|
-
-0.
|
|
10536
|
+
-0.3941513470775634,
|
|
10530
10537
|
0.3941513470775633698972073709810454683627,
|
|
10531
|
-
-0.
|
|
10538
|
+
-0.5709721726085388,
|
|
10532
10539
|
0.5709721726085388475372267372539106412383,
|
|
10533
|
-
-0.
|
|
10540
|
+
-0.7244177313601701,
|
|
10534
10541
|
0.7244177313601700474161860546139380096308,
|
|
10535
|
-
-0.
|
|
10542
|
+
-0.8482065834104272,
|
|
10536
10543
|
0.8482065834104272162006483207742168513662,
|
|
10537
|
-
-0.
|
|
10544
|
+
-0.937273392400706,
|
|
10538
10545
|
0.9372733924007059043077589477102094712439,
|
|
10539
|
-
-0.
|
|
10546
|
+
-0.9879925180204854,
|
|
10540
10547
|
0.9879925180204854284895657185866125811469,
|
|
10541
10548
|
],
|
|
10542
10549
|
[
|
|
10543
|
-
-0.
|
|
10550
|
+
-0.09501250983763744,
|
|
10544
10551
|
0.0950125098376374401853193354249580631303,
|
|
10545
|
-
-0.
|
|
10552
|
+
-0.2816035507792589,
|
|
10546
10553
|
0.281603550779258913230460501460496106486,
|
|
10547
|
-
-0.
|
|
10554
|
+
-0.45801677765722737,
|
|
10548
10555
|
0.45801677765722738634241944298357757354,
|
|
10549
|
-
-0.
|
|
10556
|
+
-0.6178762444026438,
|
|
10550
10557
|
0.6178762444026437484466717640487910189918,
|
|
10551
|
-
-0.
|
|
10558
|
+
-0.755404408355003,
|
|
10552
10559
|
0.7554044083550030338951011948474422683538,
|
|
10553
|
-
-0.
|
|
10560
|
+
-0.8656312023878318,
|
|
10554
10561
|
0.8656312023878317438804678977123931323873,
|
|
10555
|
-
-0.
|
|
10562
|
+
-0.9445750230732326,
|
|
10556
10563
|
0.9445750230732325760779884155346083450911,
|
|
10557
|
-
-0.
|
|
10564
|
+
-0.9894009349916499,
|
|
10558
10565
|
0.9894009349916499325961541734503326274262,
|
|
10559
10566
|
],
|
|
10560
10567
|
[
|
|
10561
|
-
0, -0.
|
|
10568
|
+
0, -0.17848418149584785,
|
|
10562
10569
|
0.1784841814958478558506774936540655574754,
|
|
10563
|
-
-0.
|
|
10570
|
+
-0.3512317634538763,
|
|
10564
10571
|
0.3512317634538763152971855170953460050405,
|
|
10565
|
-
-0.
|
|
10572
|
+
-0.5126905370864769,
|
|
10566
10573
|
0.5126905370864769678862465686295518745829,
|
|
10567
|
-
-0.
|
|
10574
|
+
-0.6576711592166907,
|
|
10568
10575
|
0.6576711592166907658503022166430023351478,
|
|
10569
|
-
-0.
|
|
10576
|
+
-0.7815140038968014,
|
|
10570
10577
|
0.7815140038968014069252300555204760502239,
|
|
10571
|
-
-0.
|
|
10578
|
+
-0.8802391537269859,
|
|
10572
10579
|
0.8802391537269859021229556944881556926234,
|
|
10573
|
-
-0.
|
|
10580
|
+
-0.9506755217687678,
|
|
10574
10581
|
0.9506755217687677612227169578958030214433,
|
|
10575
|
-
-0.
|
|
10582
|
+
-0.9905754753144174,
|
|
10576
10583
|
0.9905754753144173356754340199406652765077,
|
|
10577
10584
|
],
|
|
10578
10585
|
[
|
|
10579
|
-
-0.
|
|
10586
|
+
-0.0847750130417353,
|
|
10580
10587
|
0.0847750130417353012422618529357838117333,
|
|
10581
|
-
-0.
|
|
10588
|
+
-0.2518862256915055,
|
|
10582
10589
|
0.2518862256915055095889728548779112301628,
|
|
10583
|
-
-0.
|
|
10590
|
+
-0.41175116146284263,
|
|
10584
10591
|
0.4117511614628426460359317938330516370789,
|
|
10585
|
-
-0.
|
|
10592
|
+
-0.5597708310739475,
|
|
10586
10593
|
0.5597708310739475346078715485253291369276,
|
|
10587
|
-
-0.
|
|
10594
|
+
-0.6916870430603532,
|
|
10588
10595
|
0.6916870430603532078748910812888483894522,
|
|
10589
|
-
-0.
|
|
10596
|
+
-0.8037049589725231,
|
|
10590
10597
|
0.8037049589725231156824174550145907971032,
|
|
10591
|
-
-0.
|
|
10598
|
+
-0.8926024664975557,
|
|
10592
10599
|
0.8926024664975557392060605911271455154078,
|
|
10593
|
-
-0.
|
|
10600
|
+
-0.9558239495713977,
|
|
10594
10601
|
0.9558239495713977551811958929297763099728,
|
|
10595
|
-
-0.
|
|
10602
|
+
-0.9915651684209309,
|
|
10596
10603
|
0.9915651684209309467300160047061507702525,
|
|
10597
10604
|
],
|
|
10598
10605
|
[
|
|
10599
|
-
0, -0.
|
|
10606
|
+
0, -0.16035864564022537,
|
|
10600
10607
|
0.1603586456402253758680961157407435495048,
|
|
10601
|
-
-0.
|
|
10608
|
+
-0.31656409996362983,
|
|
10602
10609
|
0.3165640999636298319901173288498449178922,
|
|
10603
|
-
-0.
|
|
10610
|
+
-0.46457074137596094,
|
|
10604
10611
|
0.4645707413759609457172671481041023679762,
|
|
10605
|
-
-0.
|
|
10612
|
+
-0.600545304661681,
|
|
10606
10613
|
0.6005453046616810234696381649462392798683,
|
|
10607
|
-
-0.
|
|
10614
|
+
-0.7209661773352294,
|
|
10608
10615
|
0.7209661773352293786170958608237816296571,
|
|
10609
|
-
-0.
|
|
10616
|
+
-0.8227146565371428,
|
|
10610
10617
|
0.8227146565371428249789224867127139017745,
|
|
10611
|
-
-0.
|
|
10618
|
+
-0.9031559036148179,
|
|
10612
10619
|
0.9031559036148179016426609285323124878093,
|
|
10613
|
-
-0.
|
|
10620
|
+
-0.96020815213483,
|
|
10614
10621
|
0.960208152134830030852778840687651526615,
|
|
10615
|
-
-0.
|
|
10622
|
+
-0.9924068438435844,
|
|
10616
10623
|
0.9924068438435844031890176702532604935893,
|
|
10617
10624
|
],
|
|
10618
10625
|
[
|
|
10619
|
-
-0.
|
|
10626
|
+
-0.07652652113349734,
|
|
10620
10627
|
0.0765265211334973337546404093988382110047,
|
|
10621
|
-
-0.
|
|
10628
|
+
-0.22778585114164507,
|
|
10622
10629
|
0.227785851141645078080496195368574624743,
|
|
10623
|
-
-0.
|
|
10630
|
+
-0.37370608871541955,
|
|
10624
10631
|
0.3737060887154195606725481770249272373957,
|
|
10625
|
-
-0.
|
|
10632
|
+
-0.5108670019508271,
|
|
10626
10633
|
0.5108670019508270980043640509552509984254,
|
|
10627
|
-
-0.
|
|
10634
|
+
-0.636053680726515,
|
|
10628
10635
|
0.6360536807265150254528366962262859367433,
|
|
10629
|
-
-0.
|
|
10636
|
+
-0.7463319064601508,
|
|
10630
10637
|
0.7463319064601507926143050703556415903107,
|
|
10631
|
-
-0.
|
|
10638
|
+
-0.8391169718222188,
|
|
10632
10639
|
0.8391169718222188233945290617015206853296,
|
|
10633
|
-
-0.
|
|
10640
|
+
-0.912234428251326,
|
|
10634
10641
|
0.9122344282513259058677524412032981130491,
|
|
10635
|
-
-0.
|
|
10642
|
+
-0.9639719272779138,
|
|
10636
10643
|
0.963971927277913791267666131197277221912,
|
|
10637
|
-
-0.
|
|
10644
|
+
-0.9931285991850949,
|
|
10638
10645
|
0.9931285991850949247861223884713202782226,
|
|
10639
10646
|
],
|
|
10640
10647
|
[
|
|
10641
|
-
0, -0.
|
|
10648
|
+
0, -0.1455618541608951,
|
|
10642
10649
|
0.1455618541608950909370309823386863301163,
|
|
10643
|
-
-0.
|
|
10650
|
+
-0.2880213168024011,
|
|
10644
10651
|
0.288021316802401096600792516064600319909,
|
|
10645
|
-
-0.
|
|
10652
|
+
-0.4243421202074388,
|
|
10646
10653
|
0.4243421202074387835736688885437880520964,
|
|
10647
|
-
-0.
|
|
10654
|
+
-0.5516188358872198,
|
|
10648
10655
|
0.551618835887219807059018796724313286622,
|
|
10649
|
-
-0.
|
|
10656
|
+
-0.6671388041974123,
|
|
10650
10657
|
0.667138804197412319305966669990339162597,
|
|
10651
|
-
-0.
|
|
10658
|
+
-0.7684399634756779,
|
|
10652
10659
|
0.7684399634756779086158778513062280348209,
|
|
10653
|
-
-0.
|
|
10660
|
+
-0.8533633645833173,
|
|
10654
10661
|
0.8533633645833172836472506385875676702761,
|
|
10655
|
-
-0.
|
|
10662
|
+
-0.9200993341504008,
|
|
10656
10663
|
0.9200993341504008287901871337149688941591,
|
|
10657
|
-
-0.
|
|
10664
|
+
-0.9672268385663063,
|
|
10658
10665
|
0.9672268385663062943166222149076951614246,
|
|
10659
|
-
-0.
|
|
10666
|
+
-0.9937521706203895,
|
|
10660
10667
|
0.9937521706203895002602420359379409291933,
|
|
10661
10668
|
],
|
|
10662
10669
|
[
|
|
10663
|
-
-0.
|
|
10670
|
+
-0.06973927331972223,
|
|
10664
10671
|
0.0697392733197222212138417961186280818222,
|
|
10665
|
-
-0.
|
|
10672
|
+
-0.20786042668822127,
|
|
10666
10673
|
0.2078604266882212854788465339195457342156,
|
|
10667
|
-
-0.
|
|
10674
|
+
-0.34193582089208424,
|
|
10668
10675
|
0.3419358208920842251581474204273796195591,
|
|
10669
|
-
-0.
|
|
10676
|
+
-0.469355837986757,
|
|
10670
10677
|
0.4693558379867570264063307109664063460953,
|
|
10671
|
-
-0.
|
|
10678
|
+
-0.5876404035069116,
|
|
10672
10679
|
0.5876404035069115929588769276386473488776,
|
|
10673
|
-
-0.
|
|
10680
|
+
-0.6944872631866827,
|
|
10674
10681
|
0.6944872631866827800506898357622567712673,
|
|
10675
|
-
-0.
|
|
10682
|
+
-0.7878168059792081,
|
|
10676
10683
|
0.7878168059792081620042779554083515213881,
|
|
10677
|
-
-0.
|
|
10684
|
+
-0.8658125777203002,
|
|
10678
10685
|
0.8658125777203001365364256370193787290847,
|
|
10679
|
-
-0.
|
|
10686
|
+
-0.926956772187174,
|
|
10680
10687
|
0.9269567721871740005206929392590531966353,
|
|
10681
|
-
-0.
|
|
10688
|
+
-0.9700604978354287,
|
|
10682
10689
|
0.9700604978354287271239509867652687108059,
|
|
10683
|
-
-0.
|
|
10690
|
+
-0.9942945854823992,
|
|
10684
10691
|
0.994294585482399292073031421161298980393,
|
|
10685
10692
|
],
|
|
10686
10693
|
[
|
|
10687
|
-
0, -0.
|
|
10694
|
+
0, -0.1332568242984661,
|
|
10688
10695
|
0.1332568242984661109317426822417661370104,
|
|
10689
|
-
-0.
|
|
10696
|
+
-0.26413568097034495,
|
|
10690
10697
|
0.264135680970344930533869538283309602979,
|
|
10691
|
-
-0.
|
|
10698
|
+
-0.3903010380302908,
|
|
10692
10699
|
0.390301038030290831421488872880605458578,
|
|
10693
|
-
-0.
|
|
10700
|
+
-0.5095014778460075,
|
|
10694
10701
|
0.5095014778460075496897930478668464305448,
|
|
10695
|
-
-0.
|
|
10702
|
+
-0.6196098757636461,
|
|
10696
10703
|
0.6196098757636461563850973116495956533871,
|
|
10697
|
-
-0.
|
|
10704
|
+
-0.7186613631319502,
|
|
10698
10705
|
0.7186613631319501944616244837486188483299,
|
|
10699
|
-
-0.
|
|
10706
|
+
-0.8048884016188399,
|
|
10700
10707
|
0.8048884016188398921511184069967785579414,
|
|
10701
|
-
-0.
|
|
10708
|
+
-0.8767523582704416,
|
|
10702
10709
|
0.8767523582704416673781568859341456716389,
|
|
10703
|
-
-0.
|
|
10710
|
+
-0.9329710868260161,
|
|
10704
10711
|
0.9329710868260161023491969890384229782357,
|
|
10705
|
-
-0.
|
|
10712
|
+
-0.9725424712181152,
|
|
10706
10713
|
0.9725424712181152319560240768207773751816,
|
|
10707
|
-
-0.
|
|
10714
|
+
-0.9947693349975522,
|
|
10708
10715
|
0.9947693349975521235239257154455743605736,
|
|
10709
10716
|
],
|
|
10710
10717
|
[
|
|
10711
|
-
-0.
|
|
10718
|
+
-0.06405689286260563,
|
|
10712
10719
|
0.0640568928626056260850430826247450385909,
|
|
10713
|
-
-0.
|
|
10720
|
+
-0.1911188674736163,
|
|
10714
10721
|
0.1911188674736163091586398207570696318404,
|
|
10715
|
-
-0.
|
|
10722
|
+
-0.3150426796961634,
|
|
10716
10723
|
0.3150426796961633743867932913198102407864,
|
|
10717
|
-
-0.
|
|
10724
|
+
-0.4337935076260451,
|
|
10718
10725
|
0.4337935076260451384870842319133497124524,
|
|
10719
|
-
-0.
|
|
10726
|
+
-0.5454214713888396,
|
|
10720
10727
|
0.5454214713888395356583756172183723700107,
|
|
10721
|
-
-0.
|
|
10728
|
+
-0.6480936519369755,
|
|
10722
10729
|
0.6480936519369755692524957869107476266696,
|
|
10723
|
-
-0.
|
|
10730
|
+
-0.7401241915785544,
|
|
10724
10731
|
0.7401241915785543642438281030999784255232,
|
|
10725
|
-
-0.
|
|
10732
|
+
-0.820001985973903,
|
|
10726
10733
|
0.8200019859739029219539498726697452080761,
|
|
10727
|
-
-0.
|
|
10734
|
+
-0.8864155270044011,
|
|
10728
10735
|
0.8864155270044010342131543419821967550873,
|
|
10729
|
-
-0.
|
|
10736
|
+
-0.9382745520027328,
|
|
10730
10737
|
0.9382745520027327585236490017087214496548,
|
|
10731
|
-
-0.
|
|
10738
|
+
-0.9747285559713095,
|
|
10732
10739
|
0.9747285559713094981983919930081690617411,
|
|
10733
|
-
-0.
|
|
10740
|
+
-0.9951872199970213,
|
|
10734
10741
|
0.9951872199970213601799974097007368118745,
|
|
10735
10742
|
],
|
|
10736
10743
|
];
|
|
@@ -11490,8 +11497,8 @@
|
|
|
11490
11497
|
return null;
|
|
11491
11498
|
}
|
|
11492
11499
|
static getPointOnLine(dist, P1x, P1y, P2x, P2y, fromX, fromY) {
|
|
11493
|
-
fromX = fromX !== null && fromX !==
|
|
11494
|
-
fromY = fromY !== null && fromY !==
|
|
11500
|
+
fromX = fromX !== null && fromX !== undefined ? fromX : P1x;
|
|
11501
|
+
fromY = fromY !== null && fromY !== undefined ? fromY : P1y;
|
|
11495
11502
|
const len = this.getLineLength(P1x, P1y, P2x, P2y);
|
|
11496
11503
|
if (len < 1e-10) {
|
|
11497
11504
|
return { x: P1x, y: P1y };
|
|
@@ -12633,7 +12640,11 @@
|
|
|
12633
12640
|
class Image extends Shape {
|
|
12634
12641
|
constructor(attrs) {
|
|
12635
12642
|
super(attrs);
|
|
12636
|
-
this.
|
|
12643
|
+
this._loadListener = () => {
|
|
12644
|
+
this._requestDraw();
|
|
12645
|
+
};
|
|
12646
|
+
this.on('imageChange.konva', (props) => {
|
|
12647
|
+
this._removeImageLoad(props.oldVal);
|
|
12637
12648
|
this._setImageLoad();
|
|
12638
12649
|
});
|
|
12639
12650
|
this._setImageLoad();
|
|
@@ -12649,11 +12660,19 @@
|
|
|
12649
12660
|
return;
|
|
12650
12661
|
}
|
|
12651
12662
|
if (image && image['addEventListener']) {
|
|
12652
|
-
image['addEventListener']('load',
|
|
12653
|
-
|
|
12654
|
-
|
|
12663
|
+
image['addEventListener']('load', this._loadListener);
|
|
12664
|
+
}
|
|
12665
|
+
}
|
|
12666
|
+
_removeImageLoad(image) {
|
|
12667
|
+
if (image && image['removeEventListener']) {
|
|
12668
|
+
image['removeEventListener']('load', this._loadListener);
|
|
12655
12669
|
}
|
|
12656
12670
|
}
|
|
12671
|
+
destroy() {
|
|
12672
|
+
this._removeImageLoad(this.image());
|
|
12673
|
+
super.destroy();
|
|
12674
|
+
return this;
|
|
12675
|
+
}
|
|
12657
12676
|
_useBufferCanvas() {
|
|
12658
12677
|
const hasCornerRadius = !!this.cornerRadius();
|
|
12659
12678
|
const hasShadow = this.hasShadow();
|
|
@@ -12718,11 +12737,11 @@
|
|
|
12718
12737
|
}
|
|
12719
12738
|
getWidth() {
|
|
12720
12739
|
var _a, _b;
|
|
12721
|
-
return (_a = this.attrs.width) !== null && _a !==
|
|
12740
|
+
return (_a = this.attrs.width) !== null && _a !== undefined ? _a : (_b = this.image()) === null || _b === undefined ? undefined : _b.width;
|
|
12722
12741
|
}
|
|
12723
12742
|
getHeight() {
|
|
12724
12743
|
var _a, _b;
|
|
12725
|
-
return (_a = this.attrs.height) !== null && _a !==
|
|
12744
|
+
return (_a = this.attrs.height) !== null && _a !== undefined ? _a : (_b = this.image()) === null || _b === undefined ? undefined : _b.height;
|
|
12726
12745
|
}
|
|
12727
12746
|
/**
|
|
12728
12747
|
* load image from given url and create `Konva.Image` instance
|
|
@@ -14157,11 +14176,16 @@
|
|
|
14157
14176
|
return [...string].reduce((acc, char, index, array) => {
|
|
14158
14177
|
// Handle emoji with skin tone modifiers and ZWJ sequences
|
|
14159
14178
|
if (/\p{Emoji}/u.test(char)) {
|
|
14160
|
-
if
|
|
14161
|
-
|
|
14162
|
-
|
|
14179
|
+
// Check if next character is a modifier or ZWJ sequence
|
|
14180
|
+
const nextChar = array[index + 1];
|
|
14181
|
+
if (nextChar && /\p{Emoji_Modifier}|\u200D/u.test(nextChar)) {
|
|
14182
|
+
// If we have a modifier, combine with current emoji
|
|
14183
|
+
acc.push(char + nextChar);
|
|
14184
|
+
// Skip the next character since we've used it
|
|
14185
|
+
array[index + 1] = '';
|
|
14163
14186
|
}
|
|
14164
14187
|
else {
|
|
14188
|
+
// No modifier - treat as separate emoji
|
|
14165
14189
|
acc.push(char);
|
|
14166
14190
|
}
|
|
14167
14191
|
}
|
|
@@ -14174,7 +14198,8 @@
|
|
|
14174
14198
|
acc[acc.length - 1] += char;
|
|
14175
14199
|
}
|
|
14176
14200
|
// Handle other characters
|
|
14177
|
-
else {
|
|
14201
|
+
else if (char) {
|
|
14202
|
+
// Only push if not an empty string (skipped modifier)
|
|
14178
14203
|
acc.push(char);
|
|
14179
14204
|
}
|
|
14180
14205
|
return acc;
|
|
@@ -14534,17 +14559,17 @@
|
|
|
14534
14559
|
const scaleFactor = fontSize / 100;
|
|
14535
14560
|
// Note, fallback values are from chrome browser with 100px font size and font-family "Arial"
|
|
14536
14561
|
return {
|
|
14537
|
-
actualBoundingBoxAscent: (_a = metrics.actualBoundingBoxAscent) !== null && _a !==
|
|
14538
|
-
actualBoundingBoxDescent: (_b = metrics.actualBoundingBoxDescent) !== null && _b !==
|
|
14539
|
-
actualBoundingBoxLeft: (_c = metrics.actualBoundingBoxLeft) !== null && _c !==
|
|
14540
|
-
actualBoundingBoxRight: (_d = metrics.actualBoundingBoxRight) !== null && _d !==
|
|
14541
|
-
alphabeticBaseline: (_e = metrics.alphabeticBaseline) !== null && _e !==
|
|
14542
|
-
emHeightAscent: (_f = metrics.emHeightAscent) !== null && _f !==
|
|
14543
|
-
emHeightDescent: (_g = metrics.emHeightDescent) !== null && _g !==
|
|
14544
|
-
fontBoundingBoxAscent: (_h = metrics.fontBoundingBoxAscent) !== null && _h !==
|
|
14545
|
-
fontBoundingBoxDescent: (_j = metrics.fontBoundingBoxDescent) !== null && _j !==
|
|
14546
|
-
hangingBaseline: (_k = metrics.hangingBaseline) !== null && _k !==
|
|
14547
|
-
ideographicBaseline: (_l = metrics.ideographicBaseline) !== null && _l !==
|
|
14562
|
+
actualBoundingBoxAscent: (_a = metrics.actualBoundingBoxAscent) !== null && _a !== undefined ? _a : 71.58203125 * scaleFactor,
|
|
14563
|
+
actualBoundingBoxDescent: (_b = metrics.actualBoundingBoxDescent) !== null && _b !== undefined ? _b : 0, // Remains zero as there is no descent in the provided metrics
|
|
14564
|
+
actualBoundingBoxLeft: (_c = metrics.actualBoundingBoxLeft) !== null && _c !== undefined ? _c : -7.421875 * scaleFactor,
|
|
14565
|
+
actualBoundingBoxRight: (_d = metrics.actualBoundingBoxRight) !== null && _d !== undefined ? _d : 75.732421875 * scaleFactor,
|
|
14566
|
+
alphabeticBaseline: (_e = metrics.alphabeticBaseline) !== null && _e !== undefined ? _e : 0, // Remains zero as it's typically relative to the baseline itself
|
|
14567
|
+
emHeightAscent: (_f = metrics.emHeightAscent) !== null && _f !== undefined ? _f : 100 * scaleFactor,
|
|
14568
|
+
emHeightDescent: (_g = metrics.emHeightDescent) !== null && _g !== undefined ? _g : -20 * scaleFactor,
|
|
14569
|
+
fontBoundingBoxAscent: (_h = metrics.fontBoundingBoxAscent) !== null && _h !== undefined ? _h : 91 * scaleFactor,
|
|
14570
|
+
fontBoundingBoxDescent: (_j = metrics.fontBoundingBoxDescent) !== null && _j !== undefined ? _j : 21 * scaleFactor,
|
|
14571
|
+
hangingBaseline: (_k = metrics.hangingBaseline) !== null && _k !== undefined ? _k : 72.80000305175781 * scaleFactor,
|
|
14572
|
+
ideographicBaseline: (_l = metrics.ideographicBaseline) !== null && _l !== undefined ? _l : -21 * scaleFactor,
|
|
14548
14573
|
width: metrics.width,
|
|
14549
14574
|
height: fontSize, // Typically set to the font size
|
|
14550
14575
|
};
|
|
@@ -14599,9 +14624,12 @@
|
|
|
14599
14624
|
* use binary search to find the longest substring that
|
|
14600
14625
|
* that would fit in the specified width
|
|
14601
14626
|
*/
|
|
14602
|
-
let low = 0, high = line.length,
|
|
14627
|
+
let low = 0, high = stringToArray(line).length, // Convert to array for proper emoji handling
|
|
14628
|
+
match = '', matchWidth = 0;
|
|
14603
14629
|
while (low < high) {
|
|
14604
|
-
const mid = (low + high) >>> 1,
|
|
14630
|
+
const mid = (low + high) >>> 1,
|
|
14631
|
+
// Convert array indices to string
|
|
14632
|
+
lineArray = stringToArray(line), substr = lineArray.slice(0, mid + 1).join(''), substrWidth = this._getTextWidth(substr) + additionalWidth;
|
|
14605
14633
|
if (substrWidth <= maxWidth) {
|
|
14606
14634
|
low = mid + 1;
|
|
14607
14635
|
match = substr;
|
|
@@ -14620,21 +14648,23 @@
|
|
|
14620
14648
|
// a fitting substring was found
|
|
14621
14649
|
if (wrapAtWord) {
|
|
14622
14650
|
// try to find a space or dash where wrapping could be done
|
|
14623
|
-
|
|
14624
|
-
const
|
|
14651
|
+
const lineArray = stringToArray(line);
|
|
14652
|
+
const matchArray = stringToArray(match);
|
|
14653
|
+
const nextChar = lineArray[matchArray.length];
|
|
14625
14654
|
const nextIsSpaceOrDash = nextChar === SPACE || nextChar === DASH;
|
|
14655
|
+
let wrapIndex;
|
|
14626
14656
|
if (nextIsSpaceOrDash && matchWidth <= maxWidth) {
|
|
14627
|
-
wrapIndex =
|
|
14657
|
+
wrapIndex = matchArray.length;
|
|
14628
14658
|
}
|
|
14629
14659
|
else {
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14660
|
+
// Find last space or dash in the array
|
|
14661
|
+
const lastSpaceIndex = matchArray.lastIndexOf(SPACE);
|
|
14662
|
+
const lastDashIndex = matchArray.lastIndexOf(DASH);
|
|
14663
|
+
wrapIndex = Math.max(lastSpaceIndex, lastDashIndex) + 1;
|
|
14633
14664
|
}
|
|
14634
14665
|
if (wrapIndex > 0) {
|
|
14635
|
-
// re-cut the substring found at the space/dash position
|
|
14636
14666
|
low = wrapIndex;
|
|
14637
|
-
match =
|
|
14667
|
+
match = lineArray.slice(0, low).join('');
|
|
14638
14668
|
matchWidth = this._getTextWidth(match);
|
|
14639
14669
|
}
|
|
14640
14670
|
}
|
|
@@ -14653,13 +14683,12 @@
|
|
|
14653
14683
|
*/
|
|
14654
14684
|
break;
|
|
14655
14685
|
}
|
|
14656
|
-
|
|
14657
|
-
|
|
14686
|
+
// Convert remaining text using array operations
|
|
14687
|
+
const lineArray = stringToArray(line);
|
|
14688
|
+
line = lineArray.slice(low).join('').trimLeft();
|
|
14658
14689
|
if (line.length > 0) {
|
|
14659
|
-
// Check if the remaining text would fit on one line
|
|
14660
14690
|
lineWidth = this._getTextWidth(line);
|
|
14661
14691
|
if (lineWidth <= maxWidth) {
|
|
14662
|
-
// if it does, add the line and break out of the loop
|
|
14663
14692
|
this._addTextLine(line);
|
|
14664
14693
|
currentHeightPx += lineHeightPx;
|
|
14665
14694
|
textWidth = Math.max(textWidth, lineWidth);
|
|
@@ -14702,7 +14731,7 @@
|
|
|
14702
14731
|
* 1. the current line is the last line
|
|
14703
14732
|
* 2. wrap is NONE
|
|
14704
14733
|
* @param {Number} currentHeightPx
|
|
14705
|
-
* @returns
|
|
14734
|
+
* @returns {Boolean}
|
|
14706
14735
|
*/
|
|
14707
14736
|
_shouldHandleEllipsis(currentHeightPx) {
|
|
14708
14737
|
const fontSize = +this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, height = this.attrs.height, fixedHeight = height !== AUTO && height !== undefined, padding = this.padding(), maxHeightPx = height - padding * 2, wrap = this.wrap(), shouldWrap = wrap !== NONE;
|
|
@@ -15611,7 +15640,6 @@
|
|
|
15611
15640
|
'bottom-center',
|
|
15612
15641
|
'bottom-right',
|
|
15613
15642
|
];
|
|
15614
|
-
const MAX_SAFE_INTEGER = 100000000;
|
|
15615
15643
|
function getCenter(shape) {
|
|
15616
15644
|
return {
|
|
15617
15645
|
x: shape.x +
|
|
@@ -15762,10 +15790,12 @@
|
|
|
15762
15790
|
this.update();
|
|
15763
15791
|
}
|
|
15764
15792
|
};
|
|
15765
|
-
|
|
15766
|
-
|
|
15767
|
-
|
|
15768
|
-
|
|
15793
|
+
if (node._attrsAffectingSize.length) {
|
|
15794
|
+
const additionalEvents = node._attrsAffectingSize
|
|
15795
|
+
.map((prop) => prop + 'Change.' + this._getEventNamespace())
|
|
15796
|
+
.join(' ');
|
|
15797
|
+
node.on(additionalEvents, onChange);
|
|
15798
|
+
}
|
|
15769
15799
|
node.on(TRANSFORM_CHANGE_STR.map((e) => e + `.${this._getEventNamespace()}`).join(' '), onChange);
|
|
15770
15800
|
node.on(`absoluteTransformChange.${this._getEventNamespace()}`, onChange);
|
|
15771
15801
|
this._proxyDrag(node);
|
|
@@ -15896,8 +15926,8 @@
|
|
|
15896
15926
|
const node = this.getNode();
|
|
15897
15927
|
if (!node) {
|
|
15898
15928
|
return {
|
|
15899
|
-
x: -
|
|
15900
|
-
y: -
|
|
15929
|
+
x: -1e8,
|
|
15930
|
+
y: -1e8,
|
|
15901
15931
|
width: 0,
|
|
15902
15932
|
height: 0,
|
|
15903
15933
|
rotation: 0,
|
|
@@ -16297,13 +16327,13 @@
|
|
|
16297
16327
|
activeTransformersCount--;
|
|
16298
16328
|
this._fire('transformend', { evt: e, target: node });
|
|
16299
16329
|
// redraw layer to restore hit graph
|
|
16300
|
-
(_a = this.getLayer()) === null || _a ===
|
|
16330
|
+
(_a = this.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
|
|
16301
16331
|
if (node) {
|
|
16302
16332
|
this._nodes.forEach((target) => {
|
|
16303
16333
|
var _a;
|
|
16304
16334
|
target._fire('transformend', { evt: e, target });
|
|
16305
16335
|
// redraw layer to restore hit graph
|
|
16306
|
-
(_a = target.getLayer()) === null || _a ===
|
|
16336
|
+
(_a = target.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
|
|
16307
16337
|
});
|
|
16308
16338
|
}
|
|
16309
16339
|
this._movingAnchorName = null;
|
|
@@ -16432,7 +16462,7 @@
|
|
|
16432
16462
|
.multiply(localTransform);
|
|
16433
16463
|
const attrs = newLocalTransform.decompose();
|
|
16434
16464
|
node.setAttrs(attrs);
|
|
16435
|
-
(_a = node.getLayer()) === null || _a ===
|
|
16465
|
+
(_a = node.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
|
|
16436
16466
|
});
|
|
16437
16467
|
this.rotation(Util._getRotation(newAttrs.rotation));
|
|
16438
16468
|
// trigger transform event AFTER we update rotation
|
|
@@ -16554,7 +16584,7 @@
|
|
|
16554
16584
|
styleFunc(node);
|
|
16555
16585
|
});
|
|
16556
16586
|
}
|
|
16557
|
-
(_a = this.getLayer()) === null || _a ===
|
|
16587
|
+
(_a = this.getLayer()) === null || _a === undefined ? undefined : _a.batchDraw();
|
|
16558
16588
|
}
|
|
16559
16589
|
/**
|
|
16560
16590
|
* determine if transformer is in active transform
|