@inweb/viewer-visualize 27.1.5 → 27.1.6
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/dist/viewer-visualize.js
CHANGED
|
@@ -4351,7 +4351,7 @@
|
|
|
4351
4351
|
: {};
|
|
4352
4352
|
const Konva$2 = {
|
|
4353
4353
|
_global: glob,
|
|
4354
|
-
version: '10.0
|
|
4354
|
+
version: '10.2.0',
|
|
4355
4355
|
isBrowser: detectBrowser(),
|
|
4356
4356
|
isUnminified: /param/.test(function (param) { }.toString()),
|
|
4357
4357
|
dblClickWindow: 400,
|
|
@@ -4723,7 +4723,7 @@ js: import "konva/skia-backend";
|
|
|
4723
4723
|
let _isCanvasFarblingActive = null;
|
|
4724
4724
|
const req = (typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame) ||
|
|
4725
4725
|
function (f) {
|
|
4726
|
-
setTimeout(f,
|
|
4726
|
+
setTimeout(f, 16);
|
|
4727
4727
|
};
|
|
4728
4728
|
const Util = {
|
|
4729
4729
|
_isElement(obj) {
|
|
@@ -6520,8 +6520,8 @@ js: import "konva/skia-backend";
|
|
|
6520
6520
|
}
|
|
6521
6521
|
clearCache() {
|
|
6522
6522
|
if (this._cache.has(CANVAS)) {
|
|
6523
|
-
const { scene, filter, hit
|
|
6524
|
-
Util.releaseCanvas(scene, filter, hit
|
|
6523
|
+
const { scene, filter, hit } = this._cache.get(CANVAS);
|
|
6524
|
+
Util.releaseCanvas(scene._canvas, filter._canvas, hit._canvas);
|
|
6525
6525
|
this._cache.delete(CANVAS);
|
|
6526
6526
|
}
|
|
6527
6527
|
this._clearSelfAndDescendantCache();
|
|
@@ -6604,11 +6604,11 @@ js: import "konva/skia-backend";
|
|
|
6604
6604
|
sceneContext.stroke();
|
|
6605
6605
|
sceneContext.restore();
|
|
6606
6606
|
}
|
|
6607
|
+
Util.releaseCanvas(bufferCanvas._canvas);
|
|
6607
6608
|
this._cache.set(CANVAS, {
|
|
6608
6609
|
scene: cachedSceneCanvas,
|
|
6609
6610
|
filter: cachedFilterCanvas,
|
|
6610
6611
|
hit: cachedHitCanvas,
|
|
6611
|
-
buffer: bufferCanvas,
|
|
6612
6612
|
x: x,
|
|
6613
6613
|
y: y,
|
|
6614
6614
|
});
|
|
@@ -7633,19 +7633,20 @@ js: import "konva/skia-backend";
|
|
|
7633
7633
|
}
|
|
7634
7634
|
}
|
|
7635
7635
|
_getProtoListeners(eventType) {
|
|
7636
|
-
var _a, _b
|
|
7637
|
-
const
|
|
7636
|
+
var _a, _b;
|
|
7637
|
+
const { nodeType } = this;
|
|
7638
|
+
const allListeners = Node.protoListenerMap.get(nodeType) || {};
|
|
7638
7639
|
let events = allListeners === null || allListeners === void 0 ? void 0 : allListeners[eventType];
|
|
7639
7640
|
if (events === undefined) {
|
|
7640
7641
|
events = [];
|
|
7641
7642
|
let obj = Object.getPrototypeOf(this);
|
|
7642
7643
|
while (obj) {
|
|
7643
|
-
const hierarchyEvents = (
|
|
7644
|
+
const hierarchyEvents = (_b = (_a = obj.eventListeners) === null || _a === void 0 ? void 0 : _a[eventType]) !== null && _b !== void 0 ? _b : [];
|
|
7644
7645
|
events.push(...hierarchyEvents);
|
|
7645
7646
|
obj = Object.getPrototypeOf(obj);
|
|
7646
7647
|
}
|
|
7647
7648
|
allListeners[eventType] = events;
|
|
7648
|
-
|
|
7649
|
+
Node.protoListenerMap.set(nodeType, allListeners);
|
|
7649
7650
|
}
|
|
7650
7651
|
return events;
|
|
7651
7652
|
}
|
|
@@ -7835,6 +7836,7 @@ js: import "konva/skia-backend";
|
|
|
7835
7836
|
return no;
|
|
7836
7837
|
}
|
|
7837
7838
|
}
|
|
7839
|
+
Node.protoListenerMap = new Map();
|
|
7838
7840
|
Node.prototype.nodeType = 'Node';
|
|
7839
7841
|
Node.prototype._attrsAffectingSize = [];
|
|
7840
7842
|
Node.prototype.eventListeners = {};
|
|
@@ -9292,7 +9294,15 @@ js: import "konva/skia-backend";
|
|
|
9292
9294
|
stage = this.getStage();
|
|
9293
9295
|
const bc = bufferCanvas || stage.bufferCanvas;
|
|
9294
9296
|
const bufferContext = bc.getContext();
|
|
9295
|
-
|
|
9297
|
+
if (bufferCanvas) {
|
|
9298
|
+
bufferContext.save();
|
|
9299
|
+
bufferContext.setTransform(1, 0, 0, 1, 0, 0);
|
|
9300
|
+
bufferContext.clearRect(0, 0, bc.width, bc.height);
|
|
9301
|
+
bufferContext.restore();
|
|
9302
|
+
}
|
|
9303
|
+
else {
|
|
9304
|
+
bufferContext.clear();
|
|
9305
|
+
}
|
|
9296
9306
|
bufferContext.save();
|
|
9297
9307
|
bufferContext._applyLineJoin(this);
|
|
9298
9308
|
bufferContext._applyMiterLimit(this);
|
|
@@ -10585,6 +10595,35 @@ js: import "konva/skia-backend";
|
|
|
10585
10595
|
}
|
|
10586
10596
|
return allPoints;
|
|
10587
10597
|
}
|
|
10598
|
+
function getBezierExtremaPoints(points) {
|
|
10599
|
+
const axisPoints = [
|
|
10600
|
+
[points[0], points[2], points[4], points[6]],
|
|
10601
|
+
[points[1], points[3], points[5], points[7]],
|
|
10602
|
+
];
|
|
10603
|
+
const extremaTs = [];
|
|
10604
|
+
for (const axis of axisPoints) {
|
|
10605
|
+
const a = -3 * axis[0] + 9 * axis[1] - 9 * axis[2] + 3 * axis[3];
|
|
10606
|
+
if (a !== 0) {
|
|
10607
|
+
const b = 6 * axis[0] - 12 * axis[1] + 6 * axis[2];
|
|
10608
|
+
const c = -3 * axis[0] + 3 * axis[1];
|
|
10609
|
+
const discriminant = b * b - 4 * a * c;
|
|
10610
|
+
if (discriminant >= 0) {
|
|
10611
|
+
const d = Math.sqrt(discriminant);
|
|
10612
|
+
extremaTs.push((-b + d) / (2 * a));
|
|
10613
|
+
extremaTs.push((-b - d) / (2 * a));
|
|
10614
|
+
}
|
|
10615
|
+
}
|
|
10616
|
+
}
|
|
10617
|
+
return extremaTs
|
|
10618
|
+
.filter((t) => t > 0 && t < 1)
|
|
10619
|
+
.flatMap((t) => axisPoints.map((axis) => {
|
|
10620
|
+
const mt = 1 - t;
|
|
10621
|
+
return (mt * mt * mt * axis[0] +
|
|
10622
|
+
3 * mt * mt * t * axis[1] +
|
|
10623
|
+
3 * mt * t * t * axis[2] +
|
|
10624
|
+
t * t * t * axis[3]);
|
|
10625
|
+
}));
|
|
10626
|
+
}
|
|
10588
10627
|
class Line extends Shape {
|
|
10589
10628
|
constructor(config) {
|
|
10590
10629
|
super(config);
|
|
@@ -10686,6 +10725,15 @@ js: import "konva/skia-backend";
|
|
|
10686
10725
|
points[points.length - 1],
|
|
10687
10726
|
];
|
|
10688
10727
|
}
|
|
10728
|
+
else if (this.bezier()) {
|
|
10729
|
+
points = [
|
|
10730
|
+
points[0],
|
|
10731
|
+
points[1],
|
|
10732
|
+
...getBezierExtremaPoints(this.points()),
|
|
10733
|
+
points[points.length - 2],
|
|
10734
|
+
points[points.length - 1],
|
|
10735
|
+
];
|
|
10736
|
+
}
|
|
10689
10737
|
else {
|
|
10690
10738
|
points = this.points();
|
|
10691
10739
|
}
|
|
@@ -12975,7 +13023,7 @@ js: import "konva/skia-backend";
|
|
|
12975
13023
|
if (!this.text()) {
|
|
12976
13024
|
return;
|
|
12977
13025
|
}
|
|
12978
|
-
let padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), charRenderFunc = this.charRenderFunc(), fill = this.fill(), textDecoration = this.textDecoration(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;
|
|
13026
|
+
let padding = this.padding(), fontSize = this.fontSize(), lineHeightPx = this.lineHeight() * fontSize, verticalAlign = this.verticalAlign(), direction = this.direction(), alignY = 0, align = this.align(), totalWidth = this.getWidth(), letterSpacing = this.letterSpacing(), charRenderFunc = this.charRenderFunc(), fill = this.fill(), textDecoration = this.textDecoration(), underlineOffset = this.underlineOffset(), shouldUnderline = textDecoration.indexOf('underline') !== -1, shouldLineThrough = textDecoration.indexOf('line-through') !== -1, n;
|
|
12979
13027
|
direction = direction === INHERIT ? context.direction : direction;
|
|
12980
13028
|
let translateY = lineHeightPx / 2;
|
|
12981
13029
|
let baseline = MIDDLE;
|
|
@@ -13013,9 +13061,9 @@ js: import "konva/skia-backend";
|
|
|
13013
13061
|
if (shouldUnderline) {
|
|
13014
13062
|
context.save();
|
|
13015
13063
|
context.beginPath();
|
|
13016
|
-
const yOffset = !Konva$2.legacyTextRendering
|
|
13064
|
+
const yOffset = underlineOffset !== null && underlineOffset !== void 0 ? underlineOffset : (!Konva$2.legacyTextRendering
|
|
13017
13065
|
? Math.round(fontSize / 4)
|
|
13018
|
-
: Math.round(fontSize / 2);
|
|
13066
|
+
: Math.round(fontSize / 2));
|
|
13019
13067
|
const x = lineTranslateX;
|
|
13020
13068
|
const y = translateY + lineTranslateY + yOffset;
|
|
13021
13069
|
context.moveTo(x, y);
|
|
@@ -13334,6 +13382,7 @@ js: import "konva/skia-backend";
|
|
|
13334
13382
|
Factory.addGetterSetter(Text, 'letterSpacing', 0, getNumberValidator());
|
|
13335
13383
|
Factory.addGetterSetter(Text, 'text', '', getStringValidator());
|
|
13336
13384
|
Factory.addGetterSetter(Text, 'textDecoration', '');
|
|
13385
|
+
Factory.addGetterSetter(Text, 'underlineOffset', undefined, getNumberValidator());
|
|
13337
13386
|
Factory.addGetterSetter(Text, 'charRenderFunc', undefined);
|
|
13338
13387
|
|
|
13339
13388
|
const EMPTY_STRING = '', NORMAL = 'normal';
|
|
@@ -13602,6 +13651,7 @@ js: import "konva/skia-backend";
|
|
|
13602
13651
|
const ATTR_CHANGE_LIST = [
|
|
13603
13652
|
'resizeEnabledChange',
|
|
13604
13653
|
'rotateAnchorOffsetChange',
|
|
13654
|
+
'rotateAnchorAngleChange',
|
|
13605
13655
|
'rotateEnabledChange',
|
|
13606
13656
|
'enabledAnchorsChange',
|
|
13607
13657
|
'anchorSizeChange',
|
|
@@ -13999,11 +14049,38 @@ js: import "konva/skia-backend";
|
|
|
13999
14049
|
sceneFunc(ctx, shape) {
|
|
14000
14050
|
const tr = shape.getParent();
|
|
14001
14051
|
const padding = tr.padding();
|
|
14052
|
+
const width = shape.width();
|
|
14053
|
+
const height = shape.height();
|
|
14002
14054
|
ctx.beginPath();
|
|
14003
|
-
ctx.rect(-padding, -padding,
|
|
14004
|
-
ctx.moveTo(shape.width() / 2, -padding);
|
|
14055
|
+
ctx.rect(-padding, -padding, width + padding * 2, height + padding * 2);
|
|
14005
14056
|
if (tr.rotateEnabled() && tr.rotateLineVisible()) {
|
|
14006
|
-
|
|
14057
|
+
const rotateAnchorAngle = tr.rotateAnchorAngle();
|
|
14058
|
+
const rotateAnchorOffset = tr.rotateAnchorOffset();
|
|
14059
|
+
const rad = Util.degToRad(rotateAnchorAngle);
|
|
14060
|
+
const dirX = Math.sin(rad);
|
|
14061
|
+
const dirY = -Math.cos(rad);
|
|
14062
|
+
const cx = width / 2;
|
|
14063
|
+
const cy = height / 2;
|
|
14064
|
+
let t = Infinity;
|
|
14065
|
+
if (dirY < 0) {
|
|
14066
|
+
t = Math.min(t, -cy / dirY);
|
|
14067
|
+
}
|
|
14068
|
+
else if (dirY > 0) {
|
|
14069
|
+
t = Math.min(t, (height - cy) / dirY);
|
|
14070
|
+
}
|
|
14071
|
+
if (dirX < 0) {
|
|
14072
|
+
t = Math.min(t, -cx / dirX);
|
|
14073
|
+
}
|
|
14074
|
+
else if (dirX > 0) {
|
|
14075
|
+
t = Math.min(t, (width - cx) / dirX);
|
|
14076
|
+
}
|
|
14077
|
+
const edgeX = cx + dirX * t;
|
|
14078
|
+
const edgeY = cy + dirY * t;
|
|
14079
|
+
const sign = Util._sign(height);
|
|
14080
|
+
const endX = edgeX + dirX * rotateAnchorOffset * sign;
|
|
14081
|
+
const endY = edgeY + dirY * rotateAnchorOffset * sign;
|
|
14082
|
+
ctx.moveTo(edgeX, edgeY);
|
|
14083
|
+
ctx.lineTo(endX, endY);
|
|
14007
14084
|
}
|
|
14008
14085
|
ctx.fillStrokeShape(shape);
|
|
14009
14086
|
},
|
|
@@ -14085,7 +14162,8 @@ js: import "konva/skia-backend";
|
|
|
14085
14162
|
const attrs = this._getNodeRect();
|
|
14086
14163
|
x = anchorNode.x() - attrs.width / 2;
|
|
14087
14164
|
y = -anchorNode.y() + attrs.height / 2;
|
|
14088
|
-
|
|
14165
|
+
const rotateAnchorAngleRad = Konva$2.getAngle(this.rotateAnchorAngle());
|
|
14166
|
+
let delta = Math.atan2(-y, x) + Math.PI / 2 - rotateAnchorAngleRad;
|
|
14089
14167
|
if (attrs.height < 0) {
|
|
14090
14168
|
delta -= Math.PI;
|
|
14091
14169
|
}
|
|
@@ -14480,9 +14558,32 @@ js: import "konva/skia-backend";
|
|
|
14480
14558
|
offsetY: anchorSize / 2 - padding,
|
|
14481
14559
|
visible: resizeEnabled && enabledAnchors.indexOf('bottom-right') >= 0,
|
|
14482
14560
|
});
|
|
14561
|
+
const rotateAnchorAngle = this.rotateAnchorAngle();
|
|
14562
|
+
const rotateAnchorOffset = this.rotateAnchorOffset();
|
|
14563
|
+
const rad = Util.degToRad(rotateAnchorAngle);
|
|
14564
|
+
const dirX = Math.sin(rad);
|
|
14565
|
+
const dirY = -Math.cos(rad);
|
|
14566
|
+
const cx = width / 2;
|
|
14567
|
+
const cy = height / 2;
|
|
14568
|
+
let t = Infinity;
|
|
14569
|
+
if (dirY < 0) {
|
|
14570
|
+
t = Math.min(t, -cy / dirY);
|
|
14571
|
+
}
|
|
14572
|
+
else if (dirY > 0) {
|
|
14573
|
+
t = Math.min(t, (height - cy) / dirY);
|
|
14574
|
+
}
|
|
14575
|
+
if (dirX < 0) {
|
|
14576
|
+
t = Math.min(t, -cx / dirX);
|
|
14577
|
+
}
|
|
14578
|
+
else if (dirX > 0) {
|
|
14579
|
+
t = Math.min(t, (width - cx) / dirX);
|
|
14580
|
+
}
|
|
14581
|
+
const edgeX = cx + dirX * t;
|
|
14582
|
+
const edgeY = cy + dirY * t;
|
|
14583
|
+
const sign = Util._sign(height);
|
|
14483
14584
|
this._batchChangeChild('.rotater', {
|
|
14484
|
-
x:
|
|
14485
|
-
y:
|
|
14585
|
+
x: edgeX + dirX * rotateAnchorOffset * sign,
|
|
14586
|
+
y: edgeY + dirY * rotateAnchorOffset * sign - padding * dirY,
|
|
14486
14587
|
visible: this.rotateEnabled(),
|
|
14487
14588
|
});
|
|
14488
14589
|
this._batchChangeChild('.back', {
|
|
@@ -14570,6 +14671,7 @@ js: import "konva/skia-backend";
|
|
|
14570
14671
|
Factory.addGetterSetter(Transformer, 'rotateLineVisible', true);
|
|
14571
14672
|
Factory.addGetterSetter(Transformer, 'rotationSnaps', []);
|
|
14572
14673
|
Factory.addGetterSetter(Transformer, 'rotateAnchorOffset', 50, getNumberValidator());
|
|
14674
|
+
Factory.addGetterSetter(Transformer, 'rotateAnchorAngle', 0, getNumberValidator());
|
|
14573
14675
|
Factory.addGetterSetter(Transformer, 'rotateAnchorCursor', 'crosshair');
|
|
14574
14676
|
Factory.addGetterSetter(Transformer, 'rotationSnapTolerance', 5, getNumberValidator());
|
|
14575
14677
|
Factory.addGetterSetter(Transformer, 'borderEnabled', true);
|