@inweb/viewer-visualize 27.6.3 → 27.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/dist/viewer-visualize.js
CHANGED
|
@@ -4619,7 +4619,7 @@
|
|
|
4619
4619
|
: {};
|
|
4620
4620
|
const Konva$2 = {
|
|
4621
4621
|
_global: glob,
|
|
4622
|
-
version: '10.
|
|
4622
|
+
version: '10.3.0',
|
|
4623
4623
|
isBrowser: detectBrowser(),
|
|
4624
4624
|
isUnminified: /param/.test(function (param) { }.toString()),
|
|
4625
4625
|
dblClickWindow: 400,
|
|
@@ -6300,6 +6300,9 @@ js: import "konva/skia-backend";
|
|
|
6300
6300
|
nodesToFireEvents.push(node);
|
|
6301
6301
|
});
|
|
6302
6302
|
nodesToFireEvents.forEach((node) => {
|
|
6303
|
+
if (!node.getStage()) {
|
|
6304
|
+
return;
|
|
6305
|
+
}
|
|
6303
6306
|
node.fire('dragmove', {
|
|
6304
6307
|
type: 'dragmove',
|
|
6305
6308
|
target: node,
|
|
@@ -6983,12 +6986,15 @@ js: import "konva/skia-backend";
|
|
|
6983
6986
|
this._filterUpToDate = true;
|
|
6984
6987
|
return filterCanvas;
|
|
6985
6988
|
}
|
|
6986
|
-
on(
|
|
6989
|
+
on(...args) {
|
|
6990
|
+
const evtStr = args[0];
|
|
6991
|
+
const selectorOrHandler = args[1];
|
|
6992
|
+
args[2];
|
|
6987
6993
|
if (this._cache) {
|
|
6988
6994
|
this._cache.delete(ALL_LISTENERS);
|
|
6989
6995
|
}
|
|
6990
|
-
if (
|
|
6991
|
-
return this._delegate.apply(this,
|
|
6996
|
+
if (args.length === 3) {
|
|
6997
|
+
return this._delegate.apply(this, args);
|
|
6992
6998
|
}
|
|
6993
6999
|
const events = evtStr.split(SPACE$1);
|
|
6994
7000
|
for (let n = 0; n < events.length; n++) {
|
|
@@ -6999,7 +7005,7 @@ js: import "konva/skia-backend";
|
|
|
6999
7005
|
if (!this.eventListeners[baseEvent]) {
|
|
7000
7006
|
this.eventListeners[baseEvent] = [];
|
|
7001
7007
|
}
|
|
7002
|
-
this.eventListeners[baseEvent].push({ name, handler });
|
|
7008
|
+
this.eventListeners[baseEvent].push({ name, handler: selectorOrHandler });
|
|
7003
7009
|
}
|
|
7004
7010
|
return this;
|
|
7005
7011
|
}
|
|
@@ -7058,12 +7064,18 @@ js: import "konva/skia-backend";
|
|
|
7058
7064
|
handler.call(targets[i], evt);
|
|
7059
7065
|
}
|
|
7060
7066
|
});
|
|
7067
|
+
return this;
|
|
7061
7068
|
}
|
|
7062
7069
|
remove() {
|
|
7063
7070
|
if (this.isDragging()) {
|
|
7064
7071
|
this.stopDrag();
|
|
7065
7072
|
}
|
|
7066
7073
|
DD._dragElements.delete(this._id);
|
|
7074
|
+
DD._dragElements.forEach((elem, key) => {
|
|
7075
|
+
if (this.isAncestorOf(elem.node)) {
|
|
7076
|
+
DD._dragElements.delete(key);
|
|
7077
|
+
}
|
|
7078
|
+
});
|
|
7067
7079
|
this._remove();
|
|
7068
7080
|
return this;
|
|
7069
7081
|
}
|
|
@@ -7924,14 +7936,23 @@ js: import "konva/skia-backend";
|
|
|
7924
7936
|
evt.type = eventType;
|
|
7925
7937
|
const topListeners = this._getProtoListeners(eventType);
|
|
7926
7938
|
if (topListeners) {
|
|
7927
|
-
|
|
7928
|
-
|
|
7939
|
+
const list = topListeners.slice();
|
|
7940
|
+
for (let i = 0; i < list.length; i++) {
|
|
7941
|
+
list[i].handler.call(this, evt);
|
|
7929
7942
|
}
|
|
7930
7943
|
}
|
|
7931
7944
|
const selfListeners = this.eventListeners[eventType];
|
|
7932
7945
|
if (selfListeners) {
|
|
7933
|
-
|
|
7934
|
-
|
|
7946
|
+
const list = selfListeners.slice();
|
|
7947
|
+
const origLen = list.length;
|
|
7948
|
+
for (let i = 0; i < list.length; i++) {
|
|
7949
|
+
list[i].handler.call(this, evt);
|
|
7950
|
+
}
|
|
7951
|
+
const liveListeners = this.eventListeners[eventType];
|
|
7952
|
+
if (liveListeners) {
|
|
7953
|
+
for (let i = origLen; i < liveListeners.length; i++) {
|
|
7954
|
+
liveListeners[i].handler.call(this, evt);
|
|
7955
|
+
}
|
|
7935
7956
|
}
|
|
7936
7957
|
}
|
|
7937
7958
|
}
|
|
@@ -7959,6 +7980,7 @@ js: import "konva/skia-backend";
|
|
|
7959
7980
|
},
|
|
7960
7981
|
dragStatus: 'ready',
|
|
7961
7982
|
pointerId,
|
|
7983
|
+
startEvent: evt,
|
|
7962
7984
|
});
|
|
7963
7985
|
}
|
|
7964
7986
|
startDrag(evt, bubbleEvent = true) {
|
|
@@ -7970,7 +7992,7 @@ js: import "konva/skia-backend";
|
|
|
7970
7992
|
this.fire('dragstart', {
|
|
7971
7993
|
type: 'dragstart',
|
|
7972
7994
|
target: this,
|
|
7973
|
-
evt: evt && evt.evt,
|
|
7995
|
+
evt: (elem.startEvent && elem.startEvent.evt) || (evt && evt.evt),
|
|
7974
7996
|
}, bubbleEvent);
|
|
7975
7997
|
}
|
|
7976
7998
|
_setDragPosition(evt, elem) {
|
|
@@ -8108,7 +8130,7 @@ js: import "konva/skia-backend";
|
|
|
8108
8130
|
Node.prototype.nodeType = 'Node';
|
|
8109
8131
|
Node.prototype._attrsAffectingSize = [];
|
|
8110
8132
|
Node.prototype.eventListeners = {};
|
|
8111
|
-
Node.prototype.on
|
|
8133
|
+
Node.prototype.on(TRANSFORM_CHANGE_STR$1, function () {
|
|
8112
8134
|
if (this._batchingTransformChange) {
|
|
8113
8135
|
this._needClearTransformCache = true;
|
|
8114
8136
|
return;
|
|
@@ -8116,13 +8138,13 @@ js: import "konva/skia-backend";
|
|
|
8116
8138
|
this._clearCache(TRANSFORM);
|
|
8117
8139
|
this._clearSelfAndDescendantCache(ABSOLUTE_TRANSFORM);
|
|
8118
8140
|
});
|
|
8119
|
-
Node.prototype.on
|
|
8141
|
+
Node.prototype.on('visibleChange.konva', function () {
|
|
8120
8142
|
this._clearSelfAndDescendantCache(VISIBLE);
|
|
8121
8143
|
});
|
|
8122
|
-
Node.prototype.on
|
|
8144
|
+
Node.prototype.on('listeningChange.konva', function () {
|
|
8123
8145
|
this._clearSelfAndDescendantCache(LISTENING);
|
|
8124
8146
|
});
|
|
8125
|
-
Node.prototype.on
|
|
8147
|
+
Node.prototype.on('opacityChange.konva', function () {
|
|
8126
8148
|
this._clearSelfAndDescendantCache(ABSOLUTE_OPACITY);
|
|
8127
8149
|
});
|
|
8128
8150
|
const addGetterSetter = Factory.addGetterSetter;
|
|
@@ -9682,11 +9704,11 @@ js: import "konva/skia-backend";
|
|
|
9682
9704
|
Shape.prototype.nodeType = 'Shape';
|
|
9683
9705
|
_registerNode(Shape);
|
|
9684
9706
|
Shape.prototype.eventListeners = {};
|
|
9685
|
-
Shape.prototype.on
|
|
9686
|
-
Shape.prototype.on
|
|
9687
|
-
Shape.prototype.on
|
|
9688
|
-
Shape.prototype.on
|
|
9689
|
-
Shape.prototype.on
|
|
9707
|
+
Shape.prototype.on('shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearHasShadowCache);
|
|
9708
|
+
Shape.prototype.on('shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva', _clearGetShadowRGBACache);
|
|
9709
|
+
Shape.prototype.on('fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva', _clearFillPatternCache);
|
|
9710
|
+
Shape.prototype.on('fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva', _clearLinearGradientCache);
|
|
9711
|
+
Shape.prototype.on('fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva', _clearRadialGradientCache);
|
|
9690
9712
|
Factory.addGetterSetter(Shape, 'stroke', undefined, getStringOrGradientValidator());
|
|
9691
9713
|
Factory.addGetterSetter(Shape, 'strokeWidth', 2, getNumberValidator());
|
|
9692
9714
|
Factory.addGetterSetter(Shape, 'fillAfterStrokeEnabled', false);
|
|
@@ -13237,6 +13259,39 @@ js: import "konva/skia-backend";
|
|
|
13237
13259
|
'ellipsis',
|
|
13238
13260
|
'letterSpacing',
|
|
13239
13261
|
], attrChangeListLen = ATTR_CHANGE_LIST$1.length;
|
|
13262
|
+
let _shadowOpacityBuggy = null;
|
|
13263
|
+
function hasShadowOpacityBug() {
|
|
13264
|
+
if (_shadowOpacityBuggy !== null) {
|
|
13265
|
+
return _shadowOpacityBuggy;
|
|
13266
|
+
}
|
|
13267
|
+
_shadowOpacityBuggy = false;
|
|
13268
|
+
try {
|
|
13269
|
+
const c = document.createElement('canvas');
|
|
13270
|
+
c.width = 10;
|
|
13271
|
+
c.height = 10;
|
|
13272
|
+
const ctx = c.getContext(CONTEXT_2D);
|
|
13273
|
+
if (ctx) {
|
|
13274
|
+
ctx.globalAlpha = 0;
|
|
13275
|
+
ctx.shadowColor = 'black';
|
|
13276
|
+
ctx.shadowBlur = 5;
|
|
13277
|
+
ctx.shadowOffsetX = 5;
|
|
13278
|
+
ctx.shadowOffsetY = 5;
|
|
13279
|
+
ctx.fillStyle = 'black';
|
|
13280
|
+
ctx.font = '10px Arial';
|
|
13281
|
+
ctx.fillText('X', 0, 10);
|
|
13282
|
+
const data = ctx.getImageData(0, 0, 10, 10).data;
|
|
13283
|
+
for (let i = 3; i < data.length; i += 4) {
|
|
13284
|
+
if (data[i] > 0) {
|
|
13285
|
+
_shadowOpacityBuggy = true;
|
|
13286
|
+
break;
|
|
13287
|
+
}
|
|
13288
|
+
}
|
|
13289
|
+
}
|
|
13290
|
+
}
|
|
13291
|
+
catch (e) {
|
|
13292
|
+
}
|
|
13293
|
+
return _shadowOpacityBuggy;
|
|
13294
|
+
}
|
|
13240
13295
|
function normalizeFontFamily(fontFamily) {
|
|
13241
13296
|
return fontFamily
|
|
13242
13297
|
.split(',')
|
|
@@ -13619,6 +13674,9 @@ js: import "konva/skia-backend";
|
|
|
13619
13674
|
if (hasLine && hasShadow) {
|
|
13620
13675
|
return true;
|
|
13621
13676
|
}
|
|
13677
|
+
if (hasShadow && this.getAbsoluteOpacity() !== 1 && hasShadowOpacityBug()) {
|
|
13678
|
+
return true;
|
|
13679
|
+
}
|
|
13622
13680
|
return super._useBufferCanvas();
|
|
13623
13681
|
}
|
|
13624
13682
|
}
|
|
@@ -13670,7 +13728,7 @@ js: import "konva/skia-backend";
|
|
|
13670
13728
|
this._readDataAttribute();
|
|
13671
13729
|
this._setTextData();
|
|
13672
13730
|
});
|
|
13673
|
-
this.on('textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva', this._setTextData);
|
|
13731
|
+
this.on('textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva directionChange.konva', this._setTextData);
|
|
13674
13732
|
this._setTextData();
|
|
13675
13733
|
}
|
|
13676
13734
|
_getTextPathLength() {
|
|
@@ -13785,6 +13843,9 @@ js: import "konva/skia-backend";
|
|
|
13785
13843
|
}
|
|
13786
13844
|
_setTextData() {
|
|
13787
13845
|
const charArr = stringToArray(this.text());
|
|
13846
|
+
if (this.direction() === 'rtl') {
|
|
13847
|
+
charArr.reverse();
|
|
13848
|
+
}
|
|
13788
13849
|
const chars = [];
|
|
13789
13850
|
let width = 0;
|
|
13790
13851
|
for (let i = 0; i < charArr.length; i++) {
|
|
@@ -13794,7 +13855,7 @@ js: import "konva/skia-backend";
|
|
|
13794
13855
|
});
|
|
13795
13856
|
width += chars[i].width;
|
|
13796
13857
|
}
|
|
13797
|
-
const { height } = this._getTextSize(this.attrs.text);
|
|
13858
|
+
const { width: fullTextWidth, height } = this._getTextSize(this.attrs.text);
|
|
13798
13859
|
this.textWidth = width;
|
|
13799
13860
|
this.textHeight = height;
|
|
13800
13861
|
this.glyphInfo = [];
|
|
@@ -13804,6 +13865,7 @@ js: import "konva/skia-backend";
|
|
|
13804
13865
|
const letterSpacing = this.letterSpacing();
|
|
13805
13866
|
const align = this.align();
|
|
13806
13867
|
const kerningFunc = this.kerningFunc();
|
|
13868
|
+
const kerningAdjustment = Math.max(0, width - fullTextWidth);
|
|
13807
13869
|
const textWidth = Math.max(this.textWidth + ((this.attrs.text || '').length - 1) * letterSpacing, 0);
|
|
13808
13870
|
let offset = 0;
|
|
13809
13871
|
if (align === 'center') {
|
|
@@ -13823,7 +13885,11 @@ js: import "konva/skia-backend";
|
|
|
13823
13885
|
const numberOfSpaces = this.text().split(' ').length - 1;
|
|
13824
13886
|
glyphWidth += (this.pathLength - textWidth) / numberOfSpaces;
|
|
13825
13887
|
}
|
|
13826
|
-
const
|
|
13888
|
+
const charEndLength = offsetToGlyph + glyphWidth;
|
|
13889
|
+
const charEndPoint = this._getPointAtLength(charEndLength > this.pathLength &&
|
|
13890
|
+
charEndLength - this.pathLength <= kerningAdjustment
|
|
13891
|
+
? this.pathLength
|
|
13892
|
+
: charEndLength);
|
|
13827
13893
|
if (!charEndPoint) {
|
|
13828
13894
|
return;
|
|
13829
13895
|
}
|
|
@@ -13914,6 +13980,7 @@ js: import "konva/skia-backend";
|
|
|
13914
13980
|
Factory.addGetterSetter(TextPath, 'text', EMPTY_STRING);
|
|
13915
13981
|
Factory.addGetterSetter(TextPath, 'textDecoration', '');
|
|
13916
13982
|
Factory.addGetterSetter(TextPath, 'kerningFunc', undefined);
|
|
13983
|
+
Factory.addGetterSetter(TextPath, 'direction', 'inherit');
|
|
13917
13984
|
|
|
13918
13985
|
const EVENTS_NAME = 'tr-konva';
|
|
13919
13986
|
const ATTR_CHANGE_LIST = [
|
|
@@ -14053,6 +14120,7 @@ js: import "konva/skia-backend";
|
|
|
14053
14120
|
super(config);
|
|
14054
14121
|
this._movingAnchorName = null;
|
|
14055
14122
|
this._transforming = false;
|
|
14123
|
+
this._elementsCreated = false;
|
|
14056
14124
|
this._createElements();
|
|
14057
14125
|
this._handleMouseMove = this._handleMouseMove.bind(this);
|
|
14058
14126
|
this._handleMouseUp = this._handleMouseUp.bind(this);
|
|
@@ -14272,6 +14340,7 @@ js: import "konva/skia-backend";
|
|
|
14272
14340
|
this._createAnchor(name);
|
|
14273
14341
|
});
|
|
14274
14342
|
this._createAnchor('rotater');
|
|
14343
|
+
this._elementsCreated = true;
|
|
14275
14344
|
}
|
|
14276
14345
|
_createAnchor(name) {
|
|
14277
14346
|
const anchor = new Rect({
|
|
@@ -14894,6 +14963,13 @@ js: import "konva/skia-backend";
|
|
|
14894
14963
|
this._removeEvents();
|
|
14895
14964
|
return this;
|
|
14896
14965
|
}
|
|
14966
|
+
add(...children) {
|
|
14967
|
+
if (this._elementsCreated) {
|
|
14968
|
+
Util.error('You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead.');
|
|
14969
|
+
return this;
|
|
14970
|
+
}
|
|
14971
|
+
return super.add(...children);
|
|
14972
|
+
}
|
|
14897
14973
|
toObject() {
|
|
14898
14974
|
return Node.prototype.toObject.call(this);
|
|
14899
14975
|
}
|