@visactor/vrender 0.19.0-alpha.1 → 0.19.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/cjs/index.d.ts +1 -1
- package/cjs/index.js +10 -11
- package/cjs/index.js.map +1 -1
- package/dist/index.js +413 -184
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1723,6 +1723,11 @@
|
|
|
1723
1723
|
value: function createDom(params) {
|
|
1724
1724
|
return this._env || this.setEnv("browser"), this.envContribution.createDom(params);
|
|
1725
1725
|
}
|
|
1726
|
+
}, {
|
|
1727
|
+
key: "updateDom",
|
|
1728
|
+
value: function updateDom(dom, params) {
|
|
1729
|
+
return this._env || this.setEnv("browser"), this.envContribution.updateDom(dom, params);
|
|
1730
|
+
}
|
|
1726
1731
|
}, {
|
|
1727
1732
|
key: "getElementTop",
|
|
1728
1733
|
value: function getElementTop(dom) {
|
|
@@ -3512,6 +3517,52 @@
|
|
|
3512
3517
|
}();
|
|
3513
3518
|
TextMeasure.ALPHABET_CHAR_SET = "abcdefghijklmnopqrstuvwxyz", TextMeasure.NUMBERS_CHAR_SET = "0123456789", TextMeasure.FULL_SIZE_CHAR = "字";
|
|
3514
3519
|
|
|
3520
|
+
var calculateAnchorOfBounds = function calculateAnchorOfBounds(bounds, anchorType) {
|
|
3521
|
+
var x1 = bounds.x1,
|
|
3522
|
+
x2 = bounds.x2,
|
|
3523
|
+
y1 = bounds.y1,
|
|
3524
|
+
y2 = bounds.y2,
|
|
3525
|
+
rectWidth = Math.abs(x2 - x1),
|
|
3526
|
+
rectHeight = Math.abs(y2 - y1);
|
|
3527
|
+
var anchorX = (x1 + x2) / 2,
|
|
3528
|
+
anchorY = (y1 + y2) / 2,
|
|
3529
|
+
sx = 0,
|
|
3530
|
+
sy = 0;
|
|
3531
|
+
switch (anchorType) {
|
|
3532
|
+
case "top":
|
|
3533
|
+
case "inside-top":
|
|
3534
|
+
sy = -.5;
|
|
3535
|
+
break;
|
|
3536
|
+
case "bottom":
|
|
3537
|
+
case "inside-bottom":
|
|
3538
|
+
sy = .5;
|
|
3539
|
+
break;
|
|
3540
|
+
case "left":
|
|
3541
|
+
case "inside-left":
|
|
3542
|
+
sx = -.5;
|
|
3543
|
+
break;
|
|
3544
|
+
case "right":
|
|
3545
|
+
case "inside-right":
|
|
3546
|
+
sx = .5;
|
|
3547
|
+
break;
|
|
3548
|
+
case "top-right":
|
|
3549
|
+
sx = .5, sy = -.5;
|
|
3550
|
+
break;
|
|
3551
|
+
case "top-left":
|
|
3552
|
+
sx = -.5, sy = -.5;
|
|
3553
|
+
break;
|
|
3554
|
+
case "bottom-right":
|
|
3555
|
+
sx = .5, sy = .5;
|
|
3556
|
+
break;
|
|
3557
|
+
case "bottom-left":
|
|
3558
|
+
sx = -.5, sy = .5;
|
|
3559
|
+
}
|
|
3560
|
+
return anchorX += sx * rectWidth, anchorY += sy * rectHeight, {
|
|
3561
|
+
x: anchorX,
|
|
3562
|
+
y: anchorY
|
|
3563
|
+
};
|
|
3564
|
+
};
|
|
3565
|
+
|
|
3515
3566
|
var hasConsole = "undefined" != typeof console;
|
|
3516
3567
|
function log(method, level, input) {
|
|
3517
3568
|
var args = [level].concat([].slice.call(input));
|
|
@@ -3635,6 +3686,24 @@
|
|
|
3635
3686
|
}();
|
|
3636
3687
|
Logger._instance = null;
|
|
3637
3688
|
|
|
3689
|
+
var styleStringToObject = function styleStringToObject() {
|
|
3690
|
+
var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
|
|
3691
|
+
var res = {};
|
|
3692
|
+
return styleStr.split(";").forEach(function (item) {
|
|
3693
|
+
if (item) {
|
|
3694
|
+
var arr = item.split(":");
|
|
3695
|
+
if (2 === arr.length) {
|
|
3696
|
+
var key = arr[0].trim(),
|
|
3697
|
+
value = arr[1].trim();
|
|
3698
|
+
key && value && (res[key] = value);
|
|
3699
|
+
}
|
|
3700
|
+
}
|
|
3701
|
+
}), res;
|
|
3702
|
+
};
|
|
3703
|
+
var lowerCamelCaseToMiddle = function lowerCamelCaseToMiddle(str) {
|
|
3704
|
+
return str.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
3705
|
+
};
|
|
3706
|
+
|
|
3638
3707
|
var circleThreshold = tau - 1e-8;
|
|
3639
3708
|
var BoundsContext = /*#__PURE__*/function () {
|
|
3640
3709
|
function BoundsContext(bounds) {
|
|
@@ -5100,6 +5169,8 @@
|
|
|
5100
5169
|
pickStrokeBuffer: 0
|
|
5101
5170
|
};
|
|
5102
5171
|
var DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
5172
|
+
forceBoundsWidth: void 0,
|
|
5173
|
+
forceBoundsHeight: void 0,
|
|
5103
5174
|
opacity: 1,
|
|
5104
5175
|
background: null,
|
|
5105
5176
|
backgroundOpacity: 1,
|
|
@@ -5126,6 +5197,7 @@
|
|
|
5126
5197
|
};
|
|
5127
5198
|
var DefaultAttribute = Object.assign(Object.assign(Object.assign({
|
|
5128
5199
|
strokeSeg: null,
|
|
5200
|
+
renderable: !0,
|
|
5129
5201
|
pickable: !0,
|
|
5130
5202
|
childrenPickable: !0,
|
|
5131
5203
|
fillPickable: !0,
|
|
@@ -5252,6 +5324,7 @@
|
|
|
5252
5324
|
textBaseline: "top",
|
|
5253
5325
|
layoutDirection: "horizontal",
|
|
5254
5326
|
textConfig: [],
|
|
5327
|
+
forceBreakLine: !1,
|
|
5255
5328
|
maxHeight: void 0,
|
|
5256
5329
|
maxWidth: void 0,
|
|
5257
5330
|
singleLine: !1
|
|
@@ -5328,7 +5401,11 @@
|
|
|
5328
5401
|
function applyFillStyle(ctx, character) {
|
|
5329
5402
|
var fillStyle = character && character.fill || defaultFormatting.fill;
|
|
5330
5403
|
if (!fillStyle) return void (ctx.globalAlpha = 0);
|
|
5331
|
-
|
|
5404
|
+
var _character$fillOpacit = character.fillOpacity,
|
|
5405
|
+
fillOpacity = _character$fillOpacit === void 0 ? 1 : _character$fillOpacit,
|
|
5406
|
+
_character$opacity = character.opacity,
|
|
5407
|
+
opacity = _character$opacity === void 0 ? 1 : _character$opacity;
|
|
5408
|
+
ctx.globalAlpha = fillOpacity * opacity, ctx.fillStyle = fillStyle;
|
|
5332
5409
|
var fontSize = character.fontSize || 16;
|
|
5333
5410
|
switch (character.script) {
|
|
5334
5411
|
case "super":
|
|
@@ -5347,7 +5424,11 @@
|
|
|
5347
5424
|
function applyStrokeStyle(ctx, character) {
|
|
5348
5425
|
var strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
5349
5426
|
if (!strokeStyle) return void (ctx.globalAlpha = 0);
|
|
5350
|
-
|
|
5427
|
+
var _character$strokeOpac = character.strokeOpacity,
|
|
5428
|
+
strokeOpacity = _character$strokeOpac === void 0 ? 1 : _character$strokeOpac,
|
|
5429
|
+
_character$opacity2 = character.opacity,
|
|
5430
|
+
opacity = _character$opacity2 === void 0 ? 1 : _character$opacity2;
|
|
5431
|
+
ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle;
|
|
5351
5432
|
var fontSize = character.fontSize || 16;
|
|
5352
5433
|
switch (character.script) {
|
|
5353
5434
|
case "super":
|
|
@@ -5679,13 +5760,14 @@
|
|
|
5679
5760
|
}, {
|
|
5680
5761
|
key: "clipTextWithSuffix",
|
|
5681
5762
|
value: function clipTextWithSuffix(text, options, width, suffix, wordBreak, position) {
|
|
5763
|
+
var forceSuffix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
|
|
5682
5764
|
if ("" === suffix) return this.clipText(text, options, width, wordBreak);
|
|
5683
5765
|
if (0 === text.length) return {
|
|
5684
5766
|
str: "",
|
|
5685
5767
|
width: 0
|
|
5686
5768
|
};
|
|
5687
5769
|
var length = this.measureTextWidth(text, options);
|
|
5688
|
-
if (length <= width) return {
|
|
5770
|
+
if (!forceSuffix && length <= width) return {
|
|
5689
5771
|
str: text,
|
|
5690
5772
|
width: length
|
|
5691
5773
|
};
|
|
@@ -5694,12 +5776,16 @@
|
|
|
5694
5776
|
str: "",
|
|
5695
5777
|
width: 0
|
|
5696
5778
|
};
|
|
5779
|
+
if (forceSuffix && length + suffixWidth <= width) return {
|
|
5780
|
+
str: text + suffix,
|
|
5781
|
+
width: length + suffixWidth
|
|
5782
|
+
};
|
|
5697
5783
|
width -= suffixWidth;
|
|
5698
5784
|
var data = this._clipText(text, options, width, 0, text.length - 1, position, suffix);
|
|
5699
5785
|
if (wordBreak && data.str !== text) {
|
|
5700
5786
|
var index = testLetter(text, data.str.length);
|
|
5701
|
-
index !== data.str.length && (data.
|
|
5702
|
-
}
|
|
5787
|
+
index !== data.str.length && (data.result = text.substring(0, index), data.width = this.measureTextWidth(data.str, options));
|
|
5788
|
+
} else forceSuffix && data.str === text && (data.result = text + suffix);
|
|
5703
5789
|
return data.str = data.result, data.width += suffixWidth, data;
|
|
5704
5790
|
}
|
|
5705
5791
|
}]);
|
|
@@ -6585,7 +6671,6 @@
|
|
|
6585
6671
|
symbol: DefaultSymbolAttribute,
|
|
6586
6672
|
text: DefaultTextAttribute,
|
|
6587
6673
|
rect: DefaultRectAttribute,
|
|
6588
|
-
rect3d: DefaultRect3dAttribute,
|
|
6589
6674
|
polygon: DefaultPolygonAttribute,
|
|
6590
6675
|
richtext: DefaultRichTextAttribute,
|
|
6591
6676
|
richtextIcon: DefaultRichTextIconAttribute,
|
|
@@ -6604,7 +6689,6 @@
|
|
|
6604
6689
|
symbol: Object.assign({}, defaultThemeObj.symbol),
|
|
6605
6690
|
text: Object.assign({}, defaultThemeObj.text),
|
|
6606
6691
|
rect: Object.assign({}, defaultThemeObj.rect),
|
|
6607
|
-
rect3d: Object.assign({}, defaultThemeObj.rect3d),
|
|
6608
6692
|
polygon: Object.assign({}, defaultThemeObj.polygon),
|
|
6609
6693
|
richtext: Object.assign({}, defaultThemeObj.richtext),
|
|
6610
6694
|
richtextIcon: Object.assign({}, defaultThemeObj.richtextIcon),
|
|
@@ -7532,7 +7616,12 @@
|
|
|
7532
7616
|
for (; overTargetAncestor && overTargetAncestor !== _this.rootTarget.parent && overTargetAncestor !== e.target;) overTargetAncestor = overTargetAncestor.parent;
|
|
7533
7617
|
if (!overTargetAncestor || overTargetAncestor === _this.rootTarget.parent) {
|
|
7534
7618
|
var enterEvent = _this.clonePointerEvent(e, "pointerenter");
|
|
7535
|
-
|
|
7619
|
+
enterEvent.eventPhase = enterEvent.AT_TARGET;
|
|
7620
|
+
var currentTarget = enterEvent.target;
|
|
7621
|
+
var outTargetAncestors = new Set();
|
|
7622
|
+
var ancestor = outTarget;
|
|
7623
|
+
for (; ancestor && ancestor !== _this.rootTarget;) outTargetAncestors.add(ancestor), ancestor = ancestor.parent;
|
|
7624
|
+
for (; currentTarget && currentTarget !== outTarget && currentTarget !== _this.rootTarget.parent;) outTargetAncestors.has(currentTarget) || (enterEvent.currentTarget = currentTarget, _this.notifyTarget(enterEvent), isMouse && _this.notifyTarget(enterEvent, "mouseenter")), currentTarget = currentTarget.parent;
|
|
7536
7625
|
_this.freeEvent(enterEvent);
|
|
7537
7626
|
}
|
|
7538
7627
|
_this.freeEvent(overEvent);
|
|
@@ -7776,8 +7865,6 @@
|
|
|
7776
7865
|
}();
|
|
7777
7866
|
|
|
7778
7867
|
var EventTarget = {
|
|
7779
|
-
pickable: !0,
|
|
7780
|
-
visible: !0,
|
|
7781
7868
|
dispatchEvent: function dispatchEvent(e) {
|
|
7782
7869
|
var _a;
|
|
7783
7870
|
if (!(e instanceof FederatedEvent)) throw new Error("DisplayObject cannot propagate events outside of the Federated Events API");
|
|
@@ -11813,19 +11900,17 @@
|
|
|
11813
11900
|
var _a, _b, _c, _d;
|
|
11814
11901
|
if (hasAnimation) {
|
|
11815
11902
|
var keys = Object.keys(attrs),
|
|
11816
|
-
|
|
11903
|
+
noWorkAttrs = this.getNoWorkAnimateAttr(),
|
|
11817
11904
|
animateAttrs = {};
|
|
11818
11905
|
var noAnimateAttrs;
|
|
11819
|
-
|
|
11820
|
-
|
|
11821
|
-
}) : keys.forEach(function (key) {
|
|
11822
|
-
noWorkAAttr[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = attrs[key];
|
|
11906
|
+
keys.forEach(function (key) {
|
|
11907
|
+
noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? _this3.getDefaultAttribute(key) : attrs[key];
|
|
11823
11908
|
});
|
|
11824
11909
|
var animate = this.animate();
|
|
11825
11910
|
animate.stateNames = stateNames, animate.to(animateAttrs, null !== (_b = null === (_a = this.stateAnimateConfig) || void 0 === _a ? void 0 : _a.duration) && void 0 !== _b ? _b : DefaultStateAnimateConfig.duration, null !== (_d = null === (_c = this.stateAnimateConfig) || void 0 === _c ? void 0 : _c.easing) && void 0 !== _d ? _d : DefaultStateAnimateConfig.easing), noAnimateAttrs && this.setAttributes(noAnimateAttrs, !1, {
|
|
11826
11911
|
type: exports.AttributeUpdateType.STATE
|
|
11827
11912
|
});
|
|
11828
|
-
} else this.setAttributes(attrs, !1, {
|
|
11913
|
+
} else this.stopStateAnimates(), this.setAttributes(attrs, !1, {
|
|
11829
11914
|
type: exports.AttributeUpdateType.STATE
|
|
11830
11915
|
});
|
|
11831
11916
|
}
|
|
@@ -11842,6 +11927,14 @@
|
|
|
11842
11927
|
newNormalAttrs[key] = _this4.getNormalAttribute(key);
|
|
11843
11928
|
}), this.normalAttrs = newNormalAttrs;
|
|
11844
11929
|
}
|
|
11930
|
+
}, {
|
|
11931
|
+
key: "stopStateAnimates",
|
|
11932
|
+
value: function stopStateAnimates() {
|
|
11933
|
+
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "end";
|
|
11934
|
+
this.animates && this.animates.forEach(function (animate) {
|
|
11935
|
+
animate.stateNames && animate.stop(type);
|
|
11936
|
+
});
|
|
11937
|
+
}
|
|
11845
11938
|
}, {
|
|
11846
11939
|
key: "getNormalAttribute",
|
|
11847
11940
|
value: function getNormalAttribute(key) {
|
|
@@ -13222,7 +13315,7 @@
|
|
|
13222
13315
|
}
|
|
13223
13316
|
function drawPathProxy(graphic, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
13224
13317
|
if (!graphic.pathProxy) return !1;
|
|
13225
|
-
var themeAttributes = getTheme(graphic, null == params ? void 0 : params.theme)[graphic.type],
|
|
13318
|
+
var themeAttributes = getTheme(graphic, null == params ? void 0 : params.theme)[graphic.type.replace("3d", "")],
|
|
13226
13319
|
_graphic$attribute = graphic.attribute,
|
|
13227
13320
|
_graphic$attribute$fi = _graphic$attribute.fill,
|
|
13228
13321
|
fill = _graphic$attribute$fi === void 0 ? themeAttributes.fill : _graphic$attribute$fi,
|
|
@@ -13644,6 +13737,15 @@
|
|
|
13644
13737
|
var buf = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
13645
13738
|
return "middle" === baseline ? -lineHeight / 2 : "top" === baseline ? 0 : "bottom" === baseline ? buf - lineHeight : baseline && "alphabetic" !== baseline ? 0 : (fontSize || (fontSize = lineHeight), -(lineHeight - fontSize) / 2 - .79 * fontSize);
|
|
13646
13739
|
}
|
|
13740
|
+
function textAttributesToStyle(attrs) {
|
|
13741
|
+
var style = {};
|
|
13742
|
+
return ["textAlign", "fontFamily", "fontVariant", "fontStyle", "fontWeight"].forEach(function (key) {
|
|
13743
|
+
attrs[key] && (style[lowerCamelCaseToMiddle(key)] = attrs[key]);
|
|
13744
|
+
}), ["fontSize", "lineHeight"].forEach(function (key) {
|
|
13745
|
+
var styleKey = lowerCamelCaseToMiddle(key);
|
|
13746
|
+
isNil$1(attrs[key]) || (style[styleKey] = /^[0-9]*$/.test("".concat(attrs[key])) ? "".concat(attrs[key], "px") : "".concat(attrs[key]));
|
|
13747
|
+
}), attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"), attrs.fill && isString$1(attrs.fill) && (style.color = attrs.fill), style;
|
|
13748
|
+
}
|
|
13647
13749
|
|
|
13648
13750
|
var CanvasTextLayout = /*#__PURE__*/function () {
|
|
13649
13751
|
function CanvasTextLayout(fontFamily, options, textMeasure) {
|
|
@@ -13889,7 +13991,7 @@
|
|
|
13889
13991
|
var str = lines[i];
|
|
13890
13992
|
var needCut = !0;
|
|
13891
13993
|
if (i === lineCountLimit - 1) {
|
|
13892
|
-
var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
|
|
13994
|
+
var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
|
|
13893
13995
|
linesLayout.push({
|
|
13894
13996
|
str: _clip.str,
|
|
13895
13997
|
width: _clip.width
|
|
@@ -15513,7 +15615,7 @@
|
|
|
15513
15615
|
vertices: [],
|
|
15514
15616
|
edges: []
|
|
15515
15617
|
},
|
|
15516
|
-
rectTheme = getTheme(this).
|
|
15618
|
+
rectTheme = getTheme(this).rect,
|
|
15517
15619
|
_this$attribute = this.attribute,
|
|
15518
15620
|
x1 = _this$attribute.x1,
|
|
15519
15621
|
y1 = _this$attribute.y1,
|
|
@@ -15772,22 +15874,22 @@
|
|
|
15772
15874
|
_height = _this$lines$i.height;
|
|
15773
15875
|
if (top + _height < this[this.directionKey.top] || top + _height > this[this.directionKey.top] + frameHeight) return lastLineTag;
|
|
15774
15876
|
var lastLine = !1;
|
|
15775
|
-
this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, drawIcon);
|
|
15877
|
+
this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight && (lastLine = !0, lastLineTag = !0), this.lines[i].draw(ctx, lastLine, this.lines[i][this.directionKey.left] + deltaX, this.lines[i][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);
|
|
15776
15878
|
} else {
|
|
15777
15879
|
var detalHeight = Math.floor((frameHeight - this.actualHeight) / 2);
|
|
15778
15880
|
"vertical" === this.layoutDirection ? deltaX += detalHeight : deltaY += detalHeight;
|
|
15779
|
-
for (var _i = 0; _i < this.lines.length; _i++) this.lines[_i].draw(ctx, !1, this.lines[_i][this.directionKey.left] + deltaX, this.lines[_i][this.directionKey.top] + deltaY, drawIcon);
|
|
15881
|
+
for (var _i = 0; _i < this.lines.length; _i++) this.lines[_i].draw(ctx, !1, this.lines[_i][this.directionKey.left] + deltaX, this.lines[_i][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);
|
|
15780
15882
|
}
|
|
15781
15883
|
} else if ("bottom" === this.verticalDirection && "vertical" !== this.layoutDirection) for (var _i2 = 0; _i2 < this.lines.length; _i2++) {
|
|
15782
15884
|
var _this$lines$_i = this.lines[_i2];
|
|
15783
15885
|
_this$lines$_i.top;
|
|
15784
15886
|
var _height2 = _this$lines$_i.height,
|
|
15785
15887
|
y = frameHeight - this.lines[_i2].top - this.lines[_i2].height;
|
|
15786
|
-
if (0 === frameHeight) this.lines[_i2].draw(ctx, !1, deltaX, y + deltaY, drawIcon);else {
|
|
15888
|
+
if (0 === frameHeight) this.lines[_i2].draw(ctx, !1, deltaX, y + deltaY, this.ellipsis, drawIcon);else {
|
|
15787
15889
|
if (y + _height2 > this[this.directionKey.top] + frameHeight || y < this[this.directionKey.top]) return lastLineTag;
|
|
15788
15890
|
{
|
|
15789
15891
|
var _lastLine = !1;
|
|
15790
|
-
this.ellipsis && this.lines[_i2 + 1] && y - this.lines[_i2 + 1].height < this[this.directionKey.top] && (_lastLine = !0, lastLineTag = !0), this.lines[_i2].draw(ctx, _lastLine, deltaX, y + deltaY, drawIcon);
|
|
15892
|
+
this.ellipsis && this.lines[_i2 + 1] && y - this.lines[_i2 + 1].height < this[this.directionKey.top] && (_lastLine = !0, lastLineTag = !0), this.lines[_i2].draw(ctx, _lastLine, deltaX, y + deltaY, this.ellipsis, drawIcon);
|
|
15791
15893
|
}
|
|
15792
15894
|
}
|
|
15793
15895
|
} else {
|
|
@@ -15797,11 +15899,11 @@
|
|
|
15797
15899
|
var _this$lines$_i2 = this.lines[_i3],
|
|
15798
15900
|
_top2 = _this$lines$_i2.top,
|
|
15799
15901
|
_height3 = _this$lines$_i2.height;
|
|
15800
|
-
if (0 === frameHeight) this.lines[_i3].draw(ctx, !1, this.lines[_i3][this.directionKey.left] + deltaX, this.lines[_i3][this.directionKey.top] + deltaY, drawIcon);else {
|
|
15902
|
+
if (0 === frameHeight) this.lines[_i3].draw(ctx, !1, this.lines[_i3][this.directionKey.left] + deltaX, this.lines[_i3][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);else {
|
|
15801
15903
|
if (_top2 + _height3 < this[this.directionKey.top] || _top2 + _height3 > this[this.directionKey.top] + frameHeight) return lastLineTag;
|
|
15802
15904
|
{
|
|
15803
15905
|
var _lastLine2 = !1;
|
|
15804
|
-
this.ellipsis && this.lines[_i3 + 1] && this.lines[_i3 + 1].top + this.lines[_i3 + 1].height > this[this.directionKey.top] + frameHeight && (_lastLine2 = !0, lastLineTag = !0), this.lines[_i3].draw(ctx, _lastLine2, this.lines[_i3][this.directionKey.left] + deltaX, this.lines[_i3][this.directionKey.top] + deltaY, drawIcon);
|
|
15906
|
+
this.ellipsis && this.lines[_i3 + 1] && this.lines[_i3 + 1].top + this.lines[_i3 + 1].height > this[this.directionKey.top] + frameHeight && (_lastLine2 = !0, lastLineTag = !0), this.lines[_i3].draw(ctx, _lastLine2, this.lines[_i3][this.directionKey.left] + deltaX, this.lines[_i3][this.directionKey.top] + deltaY, this.ellipsis, drawIcon);
|
|
15805
15907
|
}
|
|
15806
15908
|
}
|
|
15807
15909
|
}
|
|
@@ -16172,12 +16274,15 @@
|
|
|
16172
16274
|
}
|
|
16173
16275
|
}, {
|
|
16174
16276
|
key: "draw",
|
|
16175
|
-
value: function draw(ctx, lastLine, x, y, drawIcon) {
|
|
16277
|
+
value: function draw(ctx, lastLine, x, y, drawEllipsis, drawIcon) {
|
|
16176
16278
|
var _this2 = this;
|
|
16177
|
-
if (lastLine) {
|
|
16279
|
+
if (drawEllipsis && (lastLine || this.paragraphs.some(function (p) {
|
|
16280
|
+
return p.overflow;
|
|
16281
|
+
}))) {
|
|
16178
16282
|
var otherParagraphWidth = 0;
|
|
16179
16283
|
for (var i = this.paragraphs.length - 1; i >= 0; i--) {
|
|
16180
16284
|
var paragraph = this.paragraphs[i];
|
|
16285
|
+
if (paragraph.overflow) continue;
|
|
16181
16286
|
if (paragraph instanceof RichTextIcon) break;
|
|
16182
16287
|
if ("vertical" === this.direction && "vertical" !== paragraph.direction) {
|
|
16183
16288
|
paragraph.verticalEllipsis = !0;
|
|
@@ -16424,7 +16529,10 @@
|
|
|
16424
16529
|
fontFamily = _this$attribute.fontFamily,
|
|
16425
16530
|
fontStyle = _this$attribute.fontStyle,
|
|
16426
16531
|
fontWeight = _this$attribute.fontWeight,
|
|
16427
|
-
lineWidth = _this$attribute.lineWidth
|
|
16532
|
+
lineWidth = _this$attribute.lineWidth,
|
|
16533
|
+
opacity = _this$attribute.opacity,
|
|
16534
|
+
fillOpacity = _this$attribute.fillOpacity,
|
|
16535
|
+
strokeOpacity = _this$attribute.strokeOpacity;
|
|
16428
16536
|
return Object.assign({
|
|
16429
16537
|
fill: fill,
|
|
16430
16538
|
stroke: stroke,
|
|
@@ -16432,7 +16540,10 @@
|
|
|
16432
16540
|
fontFamily: fontFamily,
|
|
16433
16541
|
fontStyle: fontStyle,
|
|
16434
16542
|
fontWeight: fontWeight,
|
|
16435
|
-
lineWidth: lineWidth
|
|
16543
|
+
lineWidth: lineWidth,
|
|
16544
|
+
opacity: opacity,
|
|
16545
|
+
fillOpacity: fillOpacity,
|
|
16546
|
+
strokeOpacity: strokeOpacity
|
|
16436
16547
|
}, config);
|
|
16437
16548
|
}
|
|
16438
16549
|
}, {
|
|
@@ -16454,6 +16565,7 @@
|
|
|
16454
16565
|
textBaseline = _this$attribute2.textBaseline,
|
|
16455
16566
|
layoutDirection = _this$attribute2.layoutDirection,
|
|
16456
16567
|
singleLine = _this$attribute2.singleLine,
|
|
16568
|
+
forceBreakLine = _this$attribute2.forceBreakLine,
|
|
16457
16569
|
paragraphs = [];
|
|
16458
16570
|
for (var i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
|
|
16459
16571
|
var config = this.combinedStyleToCharacter(textConfig[i]),
|
|
@@ -16478,7 +16590,14 @@
|
|
|
16478
16590
|
richTextHeightEnable = "number" == typeof height && Number.isFinite(height) && height > 0 && (!maxHeightFinite || height <= maxHeight),
|
|
16479
16591
|
frame = new Frame(0, 0, (richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0) || 0, (richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0) || 0, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection || "horizontal", !richTextWidthEnable && maxWidthFinite, !richTextHeightEnable && maxHeightFinite, singleLine || !1, null === (_a = this._frameCache) || void 0 === _a ? void 0 : _a.icons),
|
|
16480
16592
|
wrapper = new Wrapper(frame);
|
|
16481
|
-
|
|
16593
|
+
if (forceBreakLine) {
|
|
16594
|
+
var lineCount = 0,
|
|
16595
|
+
skip = !1;
|
|
16596
|
+
for (var _i = 0; _i < paragraphs.length; _i++) {
|
|
16597
|
+
var p = paragraphs[_i];
|
|
16598
|
+
skip ? (p.overflow = !0, p.left = 1 / 0, p.top = 1 / 0, !p.newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p)) : wrapper.deal(p), frame.lines.length !== lineCount && (lineCount = frame.lines.length, wrapper.lineBuffer.length = 0, p.overflow = !0, p.left = 1e3, p.top = 1e3, frame.lines[frame.lines.length - 1].paragraphs.push(p), skip = !0), p.newLine && (skip = !1);
|
|
16599
|
+
}
|
|
16600
|
+
} else for (var _i2 = 0; _i2 < paragraphs.length; _i2++) wrapper.deal(paragraphs[_i2]);
|
|
16482
16601
|
wrapper.send();
|
|
16483
16602
|
if (!("horizontal" === frame.layoutDirection ? richTextWidthEnable : richTextHeightEnable)) {
|
|
16484
16603
|
var frameSize = frame.getActualSizeWidthEllipsis();
|
|
@@ -17671,6 +17790,8 @@
|
|
|
17671
17790
|
}, {
|
|
17672
17791
|
key: "updateGroupAABBBounds",
|
|
17673
17792
|
value: function updateGroupAABBBounds(attribute, groupTheme, aabbBounds, graphic) {
|
|
17793
|
+
var originalAABBBounds = aabbBounds;
|
|
17794
|
+
aabbBounds = aabbBounds.clone();
|
|
17674
17795
|
var width = attribute.width,
|
|
17675
17796
|
height = attribute.height,
|
|
17676
17797
|
path = attribute.path,
|
|
@@ -17678,12 +17799,12 @@
|
|
|
17678
17799
|
clip = _attribute$clip === void 0 ? groupTheme.clip : _attribute$clip;
|
|
17679
17800
|
path && path.length ? path.forEach(function (g) {
|
|
17680
17801
|
aabbBounds.union(g.AABBBounds);
|
|
17681
|
-
}) : null != width && null != height && aabbBounds.set(0, 0, width, height), clip || graphic.forEachChildren(function (node) {
|
|
17802
|
+
}) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), clip || graphic.forEachChildren(function (node) {
|
|
17682
17803
|
aabbBounds.union(node.AABBBounds);
|
|
17683
17804
|
});
|
|
17684
17805
|
var tb1 = this.tempAABBBounds1,
|
|
17685
17806
|
tb2 = this.tempAABBBounds2;
|
|
17686
|
-
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, graphic), aabbBounds;
|
|
17807
|
+
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, graphic), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
|
|
17687
17808
|
}
|
|
17688
17809
|
}, {
|
|
17689
17810
|
key: "updateGlyphAABBBounds",
|
|
@@ -17692,6 +17813,22 @@
|
|
|
17692
17813
|
aabbBounds.union(node.AABBBounds);
|
|
17693
17814
|
}), aabbBounds) : aabbBounds;
|
|
17694
17815
|
}
|
|
17816
|
+
}, {
|
|
17817
|
+
key: "updateHTMLTextAABBBounds",
|
|
17818
|
+
value: function updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
|
|
17819
|
+
var textAlign = attribute.textAlign,
|
|
17820
|
+
textBaseline = attribute.textBaseline;
|
|
17821
|
+
if (null != attribute.forceBoundsHeight) {
|
|
17822
|
+
var h = isNumber$1(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
|
|
17823
|
+
dy = textLayoutOffsetY(textBaseline, h, h);
|
|
17824
|
+
aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
|
|
17825
|
+
}
|
|
17826
|
+
if (null != attribute.forceBoundsWidth) {
|
|
17827
|
+
var w = isNumber$1(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
|
|
17828
|
+
dx = textDrawOffsetX(textAlign, w);
|
|
17829
|
+
aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
|
|
17830
|
+
}
|
|
17831
|
+
}
|
|
17695
17832
|
}, {
|
|
17696
17833
|
key: "updateRichTextAABBBounds",
|
|
17697
17834
|
value: function updateRichTextAABBBounds(attribute, richtextTheme, aabbBounds, graphic) {
|
|
@@ -17743,7 +17880,7 @@
|
|
|
17743
17880
|
aabbBounds.translate(deltaX, deltaY);
|
|
17744
17881
|
var tb1 = this.tempAABBBounds1,
|
|
17745
17882
|
tb2 = this.tempAABBBounds2;
|
|
17746
|
-
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, graphic), aabbBounds;
|
|
17883
|
+
return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || this.updateHTMLTextAABBBounds(attribute, richtextTheme, aabbBounds), this.transformAABBBounds(attribute, aabbBounds, richtextTheme, !1, graphic), aabbBounds;
|
|
17747
17884
|
}
|
|
17748
17885
|
}, {
|
|
17749
17886
|
key: "updateTextAABBBounds",
|
|
@@ -17768,7 +17905,7 @@
|
|
|
17768
17905
|
var shadowBlurHalfWidth = shadowBlur / Math.abs(scaleX + scaleY);
|
|
17769
17906
|
boundStroke(tb1, shadowBlurHalfWidth, !0, strokeBoundsBuffer), aabbBounds.union(tb1);
|
|
17770
17907
|
}
|
|
17771
|
-
return this.combindShadowAABBBounds(aabbBounds, graphic), transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix), aabbBounds;
|
|
17908
|
+
return this.combindShadowAABBBounds(aabbBounds, graphic), null == attribute.forceBoundsHeight && null == attribute.forceBoundsWidth || this.updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds), transformBoundsWithMatrix(aabbBounds, aabbBounds, graphic.transMatrix), aabbBounds;
|
|
17772
17909
|
}
|
|
17773
17910
|
}, {
|
|
17774
17911
|
key: "updatePathAABBBounds",
|
|
@@ -18092,6 +18229,7 @@
|
|
|
18092
18229
|
key: "_validCheck",
|
|
18093
18230
|
value: function _validCheck(attribute, theme, aabbBounds, graphic) {
|
|
18094
18231
|
if (!graphic) return !0;
|
|
18232
|
+
if (null != attribute.forceBoundsHeight || null != attribute.forceBoundsWidth) return !0;
|
|
18095
18233
|
if (!graphic.valid) return aabbBounds.clear(), !1;
|
|
18096
18234
|
var _attribute$visible = attribute.visible,
|
|
18097
18235
|
visible = _attribute$visible === void 0 ? theme.visible : _attribute$visible;
|
|
@@ -18157,6 +18295,9 @@
|
|
|
18157
18295
|
key: "beforeRenderStep",
|
|
18158
18296
|
value: function beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
|
|
18159
18297
|
this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(function (c) {
|
|
18298
|
+
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
18299
|
+
if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
|
|
18300
|
+
}
|
|
18160
18301
|
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
18161
18302
|
});
|
|
18162
18303
|
}
|
|
@@ -18164,6 +18305,9 @@
|
|
|
18164
18305
|
key: "afterRenderStep",
|
|
18165
18306
|
value: function afterRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
|
|
18166
18307
|
this._afterRenderContribitions && this._afterRenderContribitions.forEach(function (c) {
|
|
18308
|
+
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
18309
|
+
if (!(Array.isArray(c.supportedAppName) ? c.supportedAppName : [c.supportedAppName]).includes(graphic.stage.params.context.appName)) return;
|
|
18310
|
+
}
|
|
18167
18311
|
c.drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params);
|
|
18168
18312
|
});
|
|
18169
18313
|
}
|
|
@@ -18284,6 +18428,8 @@
|
|
|
18284
18428
|
value: function _draw(graphic, defaultAttr, computed3dMatrix, drawContext, params) {
|
|
18285
18429
|
var context = drawContext.context;
|
|
18286
18430
|
if (!context) return;
|
|
18431
|
+
var renderable = graphic.attribute.renderable;
|
|
18432
|
+
if (!1 === renderable) return;
|
|
18287
18433
|
context.highPerformanceSave();
|
|
18288
18434
|
var data = this.transform(graphic, defaultAttr, context, computed3dMatrix),
|
|
18289
18435
|
x = data.x,
|
|
@@ -19281,13 +19427,18 @@
|
|
|
19281
19427
|
key: "drawShape",
|
|
19282
19428
|
value: function drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb) {
|
|
19283
19429
|
var _rect$attribute4 = rect.attribute,
|
|
19284
|
-
|
|
19285
|
-
|
|
19286
|
-
_rect$attribute4$
|
|
19287
|
-
|
|
19430
|
+
x1 = _rect$attribute4.x1,
|
|
19431
|
+
y1 = _rect$attribute4.y1,
|
|
19432
|
+
_rect$attribute4$x = _rect$attribute4.x,
|
|
19433
|
+
originX = _rect$attribute4$x === void 0 ? groupAttribute.x : _rect$attribute4$x,
|
|
19434
|
+
_rect$attribute4$y = _rect$attribute4.y,
|
|
19435
|
+
originY = _rect$attribute4$y === void 0 ? groupAttribute.y : _rect$attribute4$y,
|
|
19288
19436
|
_rect$attribute4$stro = _rect$attribute4.stroke,
|
|
19289
19437
|
stroke = _rect$attribute4$stro === void 0 ? groupAttribute.stroke : _rect$attribute4$stro;
|
|
19290
|
-
|
|
19438
|
+
var _rect$attribute5 = rect.attribute,
|
|
19439
|
+
width = _rect$attribute5.width,
|
|
19440
|
+
height = _rect$attribute5.height;
|
|
19441
|
+
if (width = (null != width ? width : x1 - originX) || 0, height = (null != height ? height : y1 - originY) || 0, Array.isArray(stroke) && stroke.some(function (s) {
|
|
19291
19442
|
return !1 === s;
|
|
19292
19443
|
})) {
|
|
19293
19444
|
if (context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute), context.beginPath(), context.moveTo(x, y), stroke[0] ? context.lineTo(x + width, y) : context.moveTo(x + width, y), stroke[1] ? context.lineTo(x + width, y + height) : context.moveTo(x + width, y + height), stroke[2] ? context.lineTo(x, y + height) : context.moveTo(x, y + height), stroke[3]) {
|
|
@@ -20643,9 +20794,14 @@
|
|
|
20643
20794
|
backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
|
|
20644
20795
|
_graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
|
|
20645
20796
|
backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
|
|
20646
|
-
var
|
|
20797
|
+
var matrix,
|
|
20647
20798
|
background = graphic.attribute.background;
|
|
20648
20799
|
if (!background) return;
|
|
20800
|
+
var restore = function restore() {
|
|
20801
|
+
"richtext" === graphic.type && (context.restore(), context.save(), matrix && context.setTransformFromMatrix(matrix, !0, 1));
|
|
20802
|
+
};
|
|
20803
|
+
var b;
|
|
20804
|
+
"richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
|
|
20649
20805
|
var shouldReCalBounds = isObject$1(background) && background.background,
|
|
20650
20806
|
onlyTranslate = graphic.transMatrix.onlyTranslate();
|
|
20651
20807
|
if (shouldReCalBounds) {
|
|
@@ -20670,13 +20826,13 @@
|
|
|
20670
20826
|
})).clone());
|
|
20671
20827
|
if (graphic.backgroundImg && graphic.resources) {
|
|
20672
20828
|
var res = graphic.resources.get(background);
|
|
20673
|
-
if ("success" !== res.state || !res.data) return;
|
|
20829
|
+
if ("success" !== res.state || !res.data) return void restore();
|
|
20674
20830
|
context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.highPerformanceRestore(), context.setTransformForCurrent();
|
|
20675
20831
|
} else {
|
|
20676
20832
|
var backgroundCornerRadius = graphic.attribute.backgroundCornerRadius;
|
|
20677
20833
|
context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
|
|
20678
20834
|
}
|
|
20679
|
-
shouldReCalBounds && boundsAllocate.free(b);
|
|
20835
|
+
shouldReCalBounds && boundsAllocate.free(b), restore();
|
|
20680
20836
|
}
|
|
20681
20837
|
}]);
|
|
20682
20838
|
}(DefaultBaseBackgroundRenderContribution);
|
|
@@ -20867,7 +21023,7 @@
|
|
|
20867
21023
|
strokeOpacity: fillOpacity
|
|
20868
21024
|
};
|
|
20869
21025
|
if (underline) {
|
|
20870
|
-
attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.setLineDash(underlineDash), context.beginPath();
|
|
21026
|
+
attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
|
|
20871
21027
|
var dy = y + offsetY + fontSize + underlineOffset;
|
|
20872
21028
|
context.moveTo(x + offsetX, dy, z), context.lineTo(x + offsetX + w, dy, z), context.stroke();
|
|
20873
21029
|
}
|
|
@@ -20903,7 +21059,7 @@
|
|
|
20903
21059
|
};
|
|
20904
21060
|
var deltaY = -3;
|
|
20905
21061
|
if (underline) {
|
|
20906
|
-
attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.setLineDash(underlineDash), context.beginPath();
|
|
21062
|
+
attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), underlineDash && context.setLineDash(underlineDash), context.beginPath();
|
|
20907
21063
|
var dy = y + offsetY + fontSize + deltaY + underlineOffset;
|
|
20908
21064
|
context.moveTo(x + 0, dy, z), context.lineTo(x + 0 + w, dy, z), context.stroke();
|
|
20909
21065
|
}
|
|
@@ -21434,14 +21590,14 @@
|
|
|
21434
21590
|
value: function render(groups, params) {
|
|
21435
21591
|
this.renderTreeRoots = groups, this.drawParams = params;
|
|
21436
21592
|
var updateBounds = params.updateBounds;
|
|
21437
|
-
this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params);
|
|
21593
|
+
this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params), this.drawParams = null;
|
|
21438
21594
|
}
|
|
21439
21595
|
}]);
|
|
21440
21596
|
}();
|
|
21441
21597
|
exports.DefaultRenderService = __decorate$1i([injectable(), __param$E(0, inject(DrawContribution)), __metadata$_("design:paramtypes", [Object])], exports.DefaultRenderService);
|
|
21442
21598
|
|
|
21443
21599
|
var renderModule$1 = new ContainerModule(function (bind) {
|
|
21444
|
-
bind(RenderService).to(exports.DefaultRenderService)
|
|
21600
|
+
bind(RenderService).to(exports.DefaultRenderService);
|
|
21445
21601
|
});
|
|
21446
21602
|
|
|
21447
21603
|
var GraphicPicker = Symbol["for"]("GraphicPicker");
|
|
@@ -22121,7 +22277,7 @@
|
|
|
22121
22277
|
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
22122
22278
|
}).forEach(function (group) {
|
|
22123
22279
|
group.isContainer ? _this2.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : _this2.renderItem(group, drawContext);
|
|
22124
|
-
}), context.restore(), context.
|
|
22280
|
+
}), context.restore(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1, context.draw();
|
|
22125
22281
|
}
|
|
22126
22282
|
}, {
|
|
22127
22283
|
key: "doRegister",
|
|
@@ -23029,7 +23185,7 @@
|
|
|
23029
23185
|
var HtmlAttributePlugin = /*#__PURE__*/function () {
|
|
23030
23186
|
function HtmlAttributePlugin() {
|
|
23031
23187
|
_classCallCheck(this, HtmlAttributePlugin);
|
|
23032
|
-
this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.
|
|
23188
|
+
this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.htmlMap = {}, this.renderId = 0;
|
|
23033
23189
|
}
|
|
23034
23190
|
return _createClass(HtmlAttributePlugin, [{
|
|
23035
23191
|
key: "activate",
|
|
@@ -23037,10 +23193,6 @@
|
|
|
23037
23193
|
var _this = this;
|
|
23038
23194
|
this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, function (stage) {
|
|
23039
23195
|
stage && stage === _this.pluginService.stage && _this.drawHTML(context.stage.renderService);
|
|
23040
|
-
}), application.graphicService.hooks.onRemove.tap(this.key, function (graphic) {
|
|
23041
|
-
_this.removeDom(graphic);
|
|
23042
|
-
}), application.graphicService.hooks.onRelease.tap(this.key, function (graphic) {
|
|
23043
|
-
_this.removeDom(graphic);
|
|
23044
23196
|
});
|
|
23045
23197
|
}
|
|
23046
23198
|
}, {
|
|
@@ -23051,99 +23203,176 @@
|
|
|
23051
23203
|
return item.name !== _this2.key;
|
|
23052
23204
|
}), application.graphicService.hooks.onRemove.unTap(this.key), application.graphicService.hooks.onRelease.unTap(this.key), this.release();
|
|
23053
23205
|
}
|
|
23206
|
+
}, {
|
|
23207
|
+
key: "getWrapContainer",
|
|
23208
|
+
value: function getWrapContainer(stage, userContainer, domParams) {
|
|
23209
|
+
var nativeContainer;
|
|
23210
|
+
return nativeContainer = userContainer ? "string" == typeof userContainer ? application.global.getElementById(userContainer) : userContainer : stage.window.getContainer(), {
|
|
23211
|
+
wrapContainer: application.global.createDom(Object.assign({
|
|
23212
|
+
tagName: "div",
|
|
23213
|
+
parent: nativeContainer
|
|
23214
|
+
}, domParams)),
|
|
23215
|
+
nativeContainer: nativeContainer
|
|
23216
|
+
};
|
|
23217
|
+
}
|
|
23218
|
+
}, {
|
|
23219
|
+
key: "parseDefaultStyleFromGraphic",
|
|
23220
|
+
value: function parseDefaultStyleFromGraphic(graphic) {
|
|
23221
|
+
var attrs = "text" === graphic.type && graphic.attribute ? graphic.attribute : getTheme(graphic).text;
|
|
23222
|
+
return textAttributesToStyle(attrs);
|
|
23223
|
+
}
|
|
23224
|
+
}, {
|
|
23225
|
+
key: "getTransformOfText",
|
|
23226
|
+
value: function getTransformOfText(graphic) {
|
|
23227
|
+
var textTheme = getTheme(graphic).text,
|
|
23228
|
+
_graphic$attribute = graphic.attribute,
|
|
23229
|
+
_graphic$attribute$te = _graphic$attribute.textAlign,
|
|
23230
|
+
textAlign = _graphic$attribute$te === void 0 ? textTheme.textAlign : _graphic$attribute$te,
|
|
23231
|
+
_graphic$attribute$te2 = _graphic$attribute.textBaseline,
|
|
23232
|
+
textBaseline = _graphic$attribute$te2 === void 0 ? textTheme.textBaseline : _graphic$attribute$te2,
|
|
23233
|
+
cssAttrs = graphic.globalTransMatrix.toTransformAttrs(),
|
|
23234
|
+
rotateDeg = cssAttrs.rotateDeg,
|
|
23235
|
+
scaleX = cssAttrs.scaleX,
|
|
23236
|
+
scaleY = cssAttrs.scaleY,
|
|
23237
|
+
translateMap = {
|
|
23238
|
+
left: "0",
|
|
23239
|
+
start: "0",
|
|
23240
|
+
end: "-100%",
|
|
23241
|
+
center: "-50%",
|
|
23242
|
+
right: "-100%",
|
|
23243
|
+
top: "0",
|
|
23244
|
+
middle: "-50%",
|
|
23245
|
+
bottom: "-100%",
|
|
23246
|
+
alphabetic: "-79%"
|
|
23247
|
+
},
|
|
23248
|
+
originMap = {
|
|
23249
|
+
left: "0",
|
|
23250
|
+
start: "0",
|
|
23251
|
+
end: "100%",
|
|
23252
|
+
center: "50%",
|
|
23253
|
+
right: "100%",
|
|
23254
|
+
top: "0",
|
|
23255
|
+
middle: "50%",
|
|
23256
|
+
bottom: "100%",
|
|
23257
|
+
alphabetic: "79%"
|
|
23258
|
+
};
|
|
23259
|
+
return {
|
|
23260
|
+
textAlign: textAlign,
|
|
23261
|
+
transform: "translate(".concat(translateMap[textAlign], ",").concat(translateMap[textBaseline], ") rotate(").concat(rotateDeg, "deg) scaleX(").concat(scaleX, ") scaleY(").concat(scaleY, ")"),
|
|
23262
|
+
transformOrigin: "".concat(originMap[textAlign], " ").concat(originMap[textBaseline])
|
|
23263
|
+
};
|
|
23264
|
+
}
|
|
23265
|
+
}, {
|
|
23266
|
+
key: "updateStyleOfWrapContainer",
|
|
23267
|
+
value: function updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, options) {
|
|
23268
|
+
var pointerEvents = options.pointerEvents;
|
|
23269
|
+
var calculateStyle = this.parseDefaultStyleFromGraphic(graphic);
|
|
23270
|
+
calculateStyle.display = !1 !== graphic.attribute.visible ? "block" : "none", calculateStyle.pointerEvents = !0 === pointerEvents ? "all" : pointerEvents || "none", wrapContainer.style.position || (wrapContainer.style.position = "absolute", nativeContainer.style.position = "relative");
|
|
23271
|
+
var left = 0,
|
|
23272
|
+
top = 0;
|
|
23273
|
+
var b = graphic.globalAABBBounds;
|
|
23274
|
+
var anchorType = options.anchorType;
|
|
23275
|
+
if (isNil$1(anchorType) && (anchorType = "text" === graphic.type ? "position" : "boundsLeftTop"), "boundsLeftTop" === anchorType && (anchorType = "top-left"), "position" === anchorType || b.empty()) {
|
|
23276
|
+
var matrix = graphic.globalTransMatrix;
|
|
23277
|
+
left = matrix.e, top = matrix.f;
|
|
23278
|
+
} else {
|
|
23279
|
+
var anchor = calculateAnchorOfBounds(b, anchorType);
|
|
23280
|
+
left = anchor.x, top = anchor.y;
|
|
23281
|
+
}
|
|
23282
|
+
var containerTL = application.global.getElementTopLeft(nativeContainer, !1),
|
|
23283
|
+
windowTL = stage.window.getTopLeft(!1),
|
|
23284
|
+
offsetX = left + windowTL.left - containerTL.left,
|
|
23285
|
+
offsetTop = top + windowTL.top - containerTL.top;
|
|
23286
|
+
if (calculateStyle.left = "".concat(offsetX, "px"), calculateStyle.top = "".concat(offsetTop, "px"), "text" === graphic.type && "position" === anchorType && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), this.getTransformOfText(graphic))), isFunction$1(options.style)) {
|
|
23287
|
+
var userStyle = options.style({
|
|
23288
|
+
top: offsetTop,
|
|
23289
|
+
left: offsetX,
|
|
23290
|
+
width: b.width(),
|
|
23291
|
+
height: b.height()
|
|
23292
|
+
}, graphic, wrapContainer);
|
|
23293
|
+
userStyle && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), userStyle));
|
|
23294
|
+
} else isObject$1(options.style) ? calculateStyle = Object.assign(Object.assign({}, calculateStyle), options.style) : isString$1(options.style) && options.style && (calculateStyle = Object.assign(Object.assign({}, calculateStyle), styleStringToObject(options.style)));
|
|
23295
|
+
application.global.updateDom(wrapContainer, {
|
|
23296
|
+
width: options.width,
|
|
23297
|
+
height: options.width,
|
|
23298
|
+
style: calculateStyle
|
|
23299
|
+
});
|
|
23300
|
+
}
|
|
23301
|
+
}, {
|
|
23302
|
+
key: "clearCacheContainer",
|
|
23303
|
+
value: function clearCacheContainer() {
|
|
23304
|
+
var _this3 = this;
|
|
23305
|
+
this.htmlMap && Object.keys(this.htmlMap).forEach(function (key) {
|
|
23306
|
+
_this3.htmlMap[key] && _this3.htmlMap[key].renderId !== _this3.renderId && _this3.removeElement(key);
|
|
23307
|
+
}), this.renderId += 1;
|
|
23308
|
+
}
|
|
23054
23309
|
}, {
|
|
23055
23310
|
key: "drawHTML",
|
|
23056
23311
|
value: function drawHTML(renderService) {
|
|
23057
|
-
var
|
|
23312
|
+
var _this4 = this;
|
|
23058
23313
|
"browser" === application.global.env && (renderService.renderTreeRoots.sort(function (a, b) {
|
|
23059
23314
|
var _a, _b;
|
|
23060
23315
|
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
23061
23316
|
}).forEach(function (group) {
|
|
23062
|
-
|
|
23063
|
-
}), this.
|
|
23064
|
-
_this3.currentDomContainerSet.has(item) || item.parentElement && item.parentElement.removeChild(item);
|
|
23065
|
-
}), this.lastDomContainerSet = new Set(this.currentDomContainerSet), this.currentDomContainerSet.clear());
|
|
23317
|
+
_this4.renderGroupHTML(group);
|
|
23318
|
+
}), this.clearCacheContainer());
|
|
23066
23319
|
}
|
|
23067
23320
|
}, {
|
|
23068
23321
|
key: "renderGroupHTML",
|
|
23069
23322
|
value: function renderGroupHTML(group) {
|
|
23070
|
-
var
|
|
23323
|
+
var _this5 = this;
|
|
23071
23324
|
this.renderGraphicHTML(group), group.forEachChildren(function (g) {
|
|
23072
|
-
g.isContainer ?
|
|
23325
|
+
g.isContainer ? _this5.renderGroupHTML(g) : _this5.renderGraphicHTML(g);
|
|
23073
23326
|
});
|
|
23074
23327
|
}
|
|
23075
23328
|
}, {
|
|
23076
|
-
key: "
|
|
23077
|
-
value: function
|
|
23078
|
-
|
|
23079
|
-
|
|
23080
|
-
|
|
23329
|
+
key: "removeElement",
|
|
23330
|
+
value: function removeElement(id) {
|
|
23331
|
+
if (!this.htmlMap || !this.htmlMap[id]) return;
|
|
23332
|
+
var wrapContainer = this.htmlMap[id].wrapContainer;
|
|
23333
|
+
wrapContainer && application.global.removeDom(wrapContainer), this.htmlMap[id] = null;
|
|
23081
23334
|
}
|
|
23082
23335
|
}, {
|
|
23083
23336
|
key: "renderGraphicHTML",
|
|
23084
23337
|
value: function renderGraphicHTML(graphic) {
|
|
23338
|
+
var _a;
|
|
23085
23339
|
var html = graphic.attribute.html;
|
|
23086
|
-
if (!html) return
|
|
23087
|
-
item.dom && item.dom.parentElement.removeChild(item.dom);
|
|
23088
|
-
}), graphic.bindDom.clear()));
|
|
23340
|
+
if (!html) return;
|
|
23089
23341
|
var stage = graphic.stage;
|
|
23090
23342
|
if (!stage) return;
|
|
23091
23343
|
var dom = html.dom,
|
|
23092
|
-
container = html.container
|
|
23093
|
-
|
|
23094
|
-
|
|
23095
|
-
|
|
23096
|
-
|
|
23097
|
-
|
|
23098
|
-
|
|
23099
|
-
|
|
23100
|
-
|
|
23101
|
-
|
|
23102
|
-
if (!lastDom || container && container !== lastDom.container) {
|
|
23103
|
-
var nativeDom;
|
|
23104
|
-
graphic.bindDom.forEach(function (_ref) {
|
|
23105
|
-
var wrapGroup = _ref.wrapGroup;
|
|
23106
|
-
application.global.removeDom(wrapGroup);
|
|
23107
|
-
}), "string" == typeof dom ? (nativeDom = new DOMParser().parseFromString(dom, "text/html").firstChild, nativeDom.lastChild && (nativeDom = nativeDom.lastChild.firstChild)) : nativeDom = dom;
|
|
23108
|
-
var _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
|
|
23109
|
-
nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
|
|
23110
|
-
tagName: "div",
|
|
23111
|
-
width: width,
|
|
23112
|
-
height: height,
|
|
23113
|
-
style: style,
|
|
23114
|
-
parent: nativeContainer
|
|
23115
|
-
}), wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
|
|
23116
|
-
dom: nativeDom,
|
|
23344
|
+
container = html.container;
|
|
23345
|
+
if (!dom) return;
|
|
23346
|
+
var id = isNil$1(html.id) ? "".concat(null !== (_a = graphic.id) && void 0 !== _a ? _a : graphic._uid, "_react") : html.id;
|
|
23347
|
+
if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container && this.removeElement(id), this.htmlMap && this.htmlMap[id]) "string" == typeof dom ? this.htmlMap[id].wrapContainer.innerHTML = dom : dom !== this.htmlMap[id].wrapContainer.firstChild && (this.htmlMap[id].wrapContainer.removeChild(this.htmlMap[id].wrapContainer.firstChild), this.htmlMap[id].wrapContainer.appendChild(dom));else {
|
|
23348
|
+
var _this$getWrapContaine = this.getWrapContainer(stage, container),
|
|
23349
|
+
_wrapContainer = _this$getWrapContaine.wrapContainer,
|
|
23350
|
+
_nativeContainer = _this$getWrapContaine.nativeContainer;
|
|
23351
|
+
_wrapContainer && ("string" == typeof dom ? _wrapContainer.innerHTML = dom : _wrapContainer.appendChild(dom), this.htmlMap || (this.htmlMap = {}), this.htmlMap[id] = {
|
|
23352
|
+
wrapContainer: _wrapContainer,
|
|
23353
|
+
nativeContainer: _nativeContainer,
|
|
23117
23354
|
container: container,
|
|
23118
|
-
|
|
23119
|
-
})
|
|
23120
|
-
}
|
|
23121
|
-
|
|
23122
|
-
var
|
|
23123
|
-
|
|
23124
|
-
|
|
23125
|
-
|
|
23126
|
-
var matrix = graphic.globalTransMatrix;
|
|
23127
|
-
left = matrix.e, top = matrix.f;
|
|
23128
|
-
} else left = b.x1, top = b.y1;
|
|
23129
|
-
var containerTL = application.global.getElementTopLeft(nativeContainer, !1),
|
|
23130
|
-
windowTL = stage.window.getTopLeft(!1),
|
|
23131
|
-
offsetX = left + windowTL.left - containerTL.left,
|
|
23132
|
-
offsetTop = top + windowTL.top - containerTL.top;
|
|
23133
|
-
wrapGroup.style.left = "".concat(offsetX, "px"), wrapGroup.style.top = "".concat(offsetTop, "px"), this.currentDomContainerSet.add(wrapGroup);
|
|
23355
|
+
renderId: this.renderId
|
|
23356
|
+
});
|
|
23357
|
+
}
|
|
23358
|
+
if (!this.htmlMap || !this.htmlMap[id]) return;
|
|
23359
|
+
var _this$htmlMap$id = this.htmlMap[id],
|
|
23360
|
+
wrapContainer = _this$htmlMap$id.wrapContainer,
|
|
23361
|
+
nativeContainer = _this$htmlMap$id.nativeContainer;
|
|
23362
|
+
this.updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, html), this.htmlMap[id].renderId = this.renderId;
|
|
23134
23363
|
}
|
|
23135
23364
|
}, {
|
|
23136
23365
|
key: "release",
|
|
23137
23366
|
value: function release() {
|
|
23138
|
-
"browser" === application.global.env &&
|
|
23367
|
+
"browser" === application.global.env && this.removeAllDom(this.pluginService.stage.defaultLayer);
|
|
23139
23368
|
}
|
|
23140
23369
|
}, {
|
|
23141
23370
|
key: "removeAllDom",
|
|
23142
23371
|
value: function removeAllDom(g) {
|
|
23143
|
-
var
|
|
23144
|
-
this.
|
|
23145
|
-
|
|
23146
|
-
});
|
|
23372
|
+
var _this6 = this;
|
|
23373
|
+
this.htmlMap && (Object.keys(this.htmlMap).forEach(function (key) {
|
|
23374
|
+
_this6.removeElement(key);
|
|
23375
|
+
}), this.htmlMap = null);
|
|
23147
23376
|
}
|
|
23148
23377
|
}]);
|
|
23149
23378
|
}();
|
|
@@ -23241,7 +23470,7 @@
|
|
|
23241
23470
|
}), !isFinite(boundsLegal)) return;
|
|
23242
23471
|
width = childrenWidth, height = childrenHeight;
|
|
23243
23472
|
}
|
|
23244
|
-
p.attribute.width = width, p.attribute.height = height, this.tempBounds.copy(p._AABBBounds);
|
|
23473
|
+
null == p.attribute.width ? p.attribute.width = width : width = p.attribute.width, null == p.attribute.height ? p.attribute.height = height : height = p.attribute.height, this.tempBounds.copy(p._AABBBounds);
|
|
23245
23474
|
var result = {
|
|
23246
23475
|
main: {
|
|
23247
23476
|
len: width,
|
|
@@ -23282,7 +23511,7 @@
|
|
|
23282
23511
|
}), tempMainL = 0, tempCrossL = 0) : (mainList.push({
|
|
23283
23512
|
idx: i - 1,
|
|
23284
23513
|
mainLen: tempMainL,
|
|
23285
|
-
crossLen:
|
|
23514
|
+
crossLen: tempCrossL
|
|
23286
23515
|
}), tempMainL = mainLen, tempCrossL = crossLen) : (tempMainL += mainLen, tempCrossL = Math.max(tempCrossL, crossLen));
|
|
23287
23516
|
}), mainList.push({
|
|
23288
23517
|
idx: mianLenArray.length - 1,
|
|
@@ -23383,7 +23612,7 @@
|
|
|
23383
23612
|
}
|
|
23384
23613
|
} else if ("flex-end" === justifyContent) {
|
|
23385
23614
|
var _pos = main.len;
|
|
23386
|
-
for (var _i =
|
|
23615
|
+
for (var _i = currSeg.idx; _i >= lastIdx; _i--) {
|
|
23387
23616
|
_pos -= mianLenArray[_i].mainLen;
|
|
23388
23617
|
var _posBaseLeftTop = _pos + getPadding(children[_i], main.field),
|
|
23389
23618
|
_b = this.getAABBBounds(children[_i]);
|
|
@@ -23664,74 +23893,57 @@
|
|
|
23664
23893
|
function ReactAttributePlugin() {
|
|
23665
23894
|
var _this;
|
|
23666
23895
|
_classCallCheck(this, ReactAttributePlugin);
|
|
23667
|
-
_this = _callSuper(this, ReactAttributePlugin, arguments), _this.name = "ReactAttributePlugin", _this.activeEvent = "onRegister", _this._uid = Generator.GenAutoIncrementId(), _this.key = _this.name + _this._uid;
|
|
23896
|
+
_this = _callSuper(this, ReactAttributePlugin, arguments), _this.name = "ReactAttributePlugin", _this.activeEvent = "onRegister", _this._uid = Generator.GenAutoIncrementId(), _this.key = _this.name + _this._uid, _this.htmlMap = {};
|
|
23668
23897
|
return _this;
|
|
23669
23898
|
}
|
|
23670
23899
|
_inherits(ReactAttributePlugin, _HtmlAttributePlugin);
|
|
23671
23900
|
return _createClass(ReactAttributePlugin, [{
|
|
23672
|
-
key: "
|
|
23673
|
-
value: function
|
|
23674
|
-
|
|
23675
|
-
|
|
23676
|
-
|
|
23901
|
+
key: "removeElement",
|
|
23902
|
+
value: function removeElement(id) {
|
|
23903
|
+
if (!this.htmlMap || !this.htmlMap[id]) return;
|
|
23904
|
+
var _this$htmlMap$id = this.htmlMap[id],
|
|
23905
|
+
root = _this$htmlMap$id.root,
|
|
23906
|
+
wrapContainer = _this$htmlMap$id.wrapContainer;
|
|
23907
|
+
if (root) {
|
|
23908
|
+
application.global.getRequestAnimationFrame()(function () {
|
|
23909
|
+
root.unmount();
|
|
23910
|
+
});
|
|
23911
|
+
}
|
|
23912
|
+
wrapContainer && application.global.removeDom(wrapContainer), this.htmlMap[id] = null;
|
|
23677
23913
|
}
|
|
23678
23914
|
}, {
|
|
23679
23915
|
key: "renderGraphicHTML",
|
|
23680
23916
|
value: function renderGraphicHTML(graphic) {
|
|
23917
|
+
var _a;
|
|
23681
23918
|
var react = graphic.attribute.react;
|
|
23682
|
-
if (!react) return
|
|
23683
|
-
item.root && item.root.unmount();
|
|
23684
|
-
}), graphic.bindDom.clear()));
|
|
23919
|
+
if (!react) return;
|
|
23685
23920
|
var stage = graphic.stage;
|
|
23686
23921
|
if (!stage) return;
|
|
23687
23922
|
var ReactDOM = stage.params.ReactDOM,
|
|
23688
23923
|
element = react.element,
|
|
23689
|
-
container = react.container
|
|
23690
|
-
width = react.width,
|
|
23691
|
-
height = react.height,
|
|
23692
|
-
style = react.style,
|
|
23693
|
-
_react$anchorType = react.anchorType,
|
|
23694
|
-
anchorType = _react$anchorType === void 0 ? "boundsLeftTop" : _react$anchorType,
|
|
23695
|
-
pointerEvents = react.pointerEvents;
|
|
23924
|
+
container = react.container;
|
|
23696
23925
|
if (!(element && ReactDOM && ReactDOM.createRoot)) return;
|
|
23697
|
-
|
|
23698
|
-
|
|
23699
|
-
|
|
23700
|
-
|
|
23701
|
-
|
|
23702
|
-
|
|
23703
|
-
|
|
23704
|
-
|
|
23705
|
-
|
|
23706
|
-
|
|
23707
|
-
|
|
23708
|
-
width: width,
|
|
23709
|
-
height: height,
|
|
23710
|
-
style: style,
|
|
23711
|
-
parent: nativeContainer
|
|
23712
|
-
}), wrapGroup) {
|
|
23713
|
-
var root = ReactDOM.createRoot(wrapGroup);
|
|
23714
|
-
root.render(element), graphic.bindDom.set(element, {
|
|
23715
|
-
dom: element,
|
|
23926
|
+
var id = isNil$1(react.id) ? "".concat(null !== (_a = graphic.id) && void 0 !== _a ? _a : graphic._uid, "_react") : react.id;
|
|
23927
|
+
if (this.htmlMap && this.htmlMap[id] && container && container !== this.htmlMap[id].container && this.removeElement(id), this.htmlMap && this.htmlMap[id]) this.htmlMap[id].root.render(element);else {
|
|
23928
|
+
var _this$getWrapContaine = this.getWrapContainer(stage, container),
|
|
23929
|
+
_wrapContainer = _this$getWrapContaine.wrapContainer,
|
|
23930
|
+
_nativeContainer = _this$getWrapContaine.nativeContainer;
|
|
23931
|
+
if (_wrapContainer) {
|
|
23932
|
+
var root = ReactDOM.createRoot(_wrapContainer);
|
|
23933
|
+
root.render(element), this.htmlMap || (this.htmlMap = {}), this.htmlMap[id] = {
|
|
23934
|
+
root: root,
|
|
23935
|
+
wrapContainer: _wrapContainer,
|
|
23936
|
+
nativeContainer: _nativeContainer,
|
|
23716
23937
|
container: container,
|
|
23717
|
-
|
|
23718
|
-
|
|
23719
|
-
});
|
|
23938
|
+
renderId: this.renderId
|
|
23939
|
+
};
|
|
23720
23940
|
}
|
|
23721
|
-
}
|
|
23722
|
-
|
|
23723
|
-
var
|
|
23724
|
-
|
|
23725
|
-
|
|
23726
|
-
|
|
23727
|
-
var matrix = graphic.globalTransMatrix;
|
|
23728
|
-
left = matrix.e, top = matrix.f;
|
|
23729
|
-
} else left = b.x1, top = b.y1;
|
|
23730
|
-
var containerTL = application.global.getElementTopLeft(nativeContainer, !1),
|
|
23731
|
-
windowTL = stage.window.getTopLeft(!1),
|
|
23732
|
-
offsetX = left + windowTL.left - containerTL.left,
|
|
23733
|
-
offsetTop = top + windowTL.top - containerTL.top;
|
|
23734
|
-
wrapGroup.style.left = "".concat(offsetX, "px"), wrapGroup.style.top = "".concat(offsetTop, "px");
|
|
23941
|
+
}
|
|
23942
|
+
if (!this.htmlMap || !this.htmlMap[id]) return;
|
|
23943
|
+
var _this$htmlMap$id2 = this.htmlMap[id],
|
|
23944
|
+
wrapContainer = _this$htmlMap$id2.wrapContainer,
|
|
23945
|
+
nativeContainer = _this$htmlMap$id2.nativeContainer;
|
|
23946
|
+
this.updateStyleOfWrapContainer(graphic, stage, wrapContainer, nativeContainer, react), this.htmlMap[id].renderId = this.renderId;
|
|
23735
23947
|
}
|
|
23736
23948
|
}]);
|
|
23737
23949
|
}(HtmlAttributePlugin);
|
|
@@ -24273,7 +24485,7 @@
|
|
|
24273
24485
|
value: function release() {
|
|
24274
24486
|
_get(_getPrototypeOf(Stage.prototype), "release", this).call(this), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(function (layer) {
|
|
24275
24487
|
layer.release();
|
|
24276
|
-
}), this.interactiveLayer && this.interactiveLayer.release(), this.window.release();
|
|
24488
|
+
}), this.interactiveLayer && this.interactiveLayer.release(), this.window.release(), this.ticker.remTimeline(this.timeline), this.renderService.renderTreeRoots = [];
|
|
24277
24489
|
}
|
|
24278
24490
|
}, {
|
|
24279
24491
|
key: "setStage",
|
|
@@ -24349,6 +24561,12 @@
|
|
|
24349
24561
|
value: function getCursor() {
|
|
24350
24562
|
return this._cursor;
|
|
24351
24563
|
}
|
|
24564
|
+
}, {
|
|
24565
|
+
key: "eventPointTransform",
|
|
24566
|
+
value: function eventPointTransform(e) {
|
|
24567
|
+
var point = this.global.mapToCanvasPoint(e, this.window.getContext().canvas.nativeCanvas);
|
|
24568
|
+
return this.stage.window.pointTransform(point.x, point.y);
|
|
24569
|
+
}
|
|
24352
24570
|
}]);
|
|
24353
24571
|
}(Group);
|
|
24354
24572
|
|
|
@@ -24899,6 +25117,11 @@
|
|
|
24899
25117
|
value: function createDom(params) {
|
|
24900
25118
|
return null;
|
|
24901
25119
|
}
|
|
25120
|
+
}, {
|
|
25121
|
+
key: "updateDom",
|
|
25122
|
+
value: function updateDom(dom, params) {
|
|
25123
|
+
return !1;
|
|
25124
|
+
}
|
|
24902
25125
|
}, {
|
|
24903
25126
|
key: "getDynamicCanvasCount",
|
|
24904
25127
|
value: function getDynamicCanvasCount() {
|
|
@@ -25752,7 +25975,7 @@
|
|
|
25752
25975
|
key: "drawShape",
|
|
25753
25976
|
value: function drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
25754
25977
|
var _a;
|
|
25755
|
-
var rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).
|
|
25978
|
+
var rectAttribute = getTheme(rect, null == params ? void 0 : params.theme).rect,
|
|
25756
25979
|
_rect$attribute = rect.attribute,
|
|
25757
25980
|
_rect$attribute$fill = _rect$attribute.fill,
|
|
25758
25981
|
fill = _rect$attribute$fill === void 0 ? rectAttribute.fill : _rect$attribute$fill,
|
|
@@ -29090,9 +29313,9 @@
|
|
|
29090
29313
|
if (target && !isRoot) {
|
|
29091
29314
|
var handlePointerMove = function handlePointerMove(moveEvent) {
|
|
29092
29315
|
if (dragstartTriggered || (moveEvent.type = "dragstart", null == target || target.dispatchEvent(moveEvent), dragstartTriggered = !0), moveEvent.type = "drag", null == target || target.dispatchEvent(moveEvent), !isRoot) {
|
|
29093
|
-
target.pickable = !1;
|
|
29316
|
+
target.attribute.pickable = !1;
|
|
29094
29317
|
var elemBelow = (null == rootNode ? void 0 : rootNode.pick(moveEvent.global.x, moveEvent.global.y)).graphic;
|
|
29095
|
-
target.pickable = !0, currentDroppable !== elemBelow && (currentDroppable && (moveEvent.type = "dragleave", moveEvent.target = currentDroppable, currentDroppable.dispatchEvent(moveEvent)), elemBelow && (moveEvent.type = "dragenter", moveEvent.target = elemBelow, elemBelow.dispatchEvent(moveEvent)), currentDroppable = elemBelow, currentDroppable && (moveEvent.type = "dragover", moveEvent.target = currentDroppable, currentDroppable.dispatchEvent(moveEvent)));
|
|
29318
|
+
target.attribute.pickable = !0, currentDroppable !== elemBelow && (currentDroppable && (moveEvent.type = "dragleave", moveEvent.target = currentDroppable, currentDroppable.dispatchEvent(moveEvent)), elemBelow && (moveEvent.type = "dragenter", moveEvent.target = elemBelow, elemBelow.dispatchEvent(moveEvent)), currentDroppable = elemBelow, currentDroppable && (moveEvent.type = "dragover", moveEvent.target = currentDroppable, currentDroppable.dispatchEvent(moveEvent)));
|
|
29096
29319
|
}
|
|
29097
29320
|
};
|
|
29098
29321
|
var currentDroppable,
|
|
@@ -29890,7 +30113,7 @@
|
|
|
29890
30113
|
value: function setLineDash(segments) {
|
|
29891
30114
|
var a = arguments,
|
|
29892
30115
|
_context = this.nativeContext;
|
|
29893
|
-
this.nativeContext.setLineDash ? _context.setLineDash(a[0]) : "mozDash" in _context ? _context.mozDash = a[0] : "webkitLineDash" in _context && (_context.webkitLineDash = a[0]);
|
|
30116
|
+
this.nativeContext.setLineDash ? a[0] && _context.setLineDash(a[0]) : "mozDash" in _context ? _context.mozDash = a[0] : "webkitLineDash" in _context && (_context.webkitLineDash = a[0]);
|
|
29894
30117
|
}
|
|
29895
30118
|
}, {
|
|
29896
30119
|
key: "stroke",
|
|
@@ -30011,7 +30234,7 @@
|
|
|
30011
30234
|
lineCap = _attribute$lineCap === void 0 ? defaultParams.lineCap : _attribute$lineCap,
|
|
30012
30235
|
_attribute$miterLimit = attribute.miterLimit,
|
|
30013
30236
|
miterLimit = _attribute$miterLimit === void 0 ? defaultParams.miterLimit : _attribute$miterLimit;
|
|
30014
|
-
_context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
30237
|
+
_context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
30015
30238
|
}
|
|
30016
30239
|
}
|
|
30017
30240
|
}, {
|
|
@@ -30669,19 +30892,24 @@
|
|
|
30669
30892
|
value: function removeDom(dom) {
|
|
30670
30893
|
return dom.parentElement.removeChild(dom), !0;
|
|
30671
30894
|
}
|
|
30895
|
+
}, {
|
|
30896
|
+
key: "updateDom",
|
|
30897
|
+
value: function updateDom(dom, params) {
|
|
30898
|
+
var width = params.width,
|
|
30899
|
+
height = params.height,
|
|
30900
|
+
style = params.style;
|
|
30901
|
+
return style && (isString$1(style) ? dom.setAttribute("style", style) : Object.keys(style).forEach(function (k) {
|
|
30902
|
+
dom.style[k] = style[k];
|
|
30903
|
+
})), null != width && (dom.style.width = "".concat(width, "px")), null != height && (dom.style.height = "".concat(height, "px")), !0;
|
|
30904
|
+
}
|
|
30672
30905
|
}, {
|
|
30673
30906
|
key: "createDom",
|
|
30674
30907
|
value: function createDom(params) {
|
|
30675
30908
|
var _params$tagName = params.tagName,
|
|
30676
30909
|
tagName = _params$tagName === void 0 ? "div" : _params$tagName,
|
|
30677
|
-
width = params.width,
|
|
30678
|
-
height = params.height,
|
|
30679
|
-
style = params.style,
|
|
30680
30910
|
parent = params.parent,
|
|
30681
30911
|
element = document.createElement(tagName);
|
|
30682
|
-
if (
|
|
30683
|
-
element.setAttribute(k, style[k]);
|
|
30684
|
-
})), null != width && (element.style.width = "".concat(width, "px")), null != height && (element.style.height = "".concat(height, "px")), parent) {
|
|
30912
|
+
if (this.updateDom(element, params), parent) {
|
|
30685
30913
|
var pd = isString$1(parent) ? this.getElementById(parent) : parent;
|
|
30686
30914
|
pd && pd.appendChild && pd.appendChild(element);
|
|
30687
30915
|
}
|
|
@@ -31470,7 +31698,7 @@
|
|
|
31470
31698
|
if (this.nativeContext.setLineDash) {
|
|
31471
31699
|
var lineDash = a[0];
|
|
31472
31700
|
if (0 === lineDash[0] && 0 === lineDash[1]) return;
|
|
31473
|
-
_context.setLineDash(lineDash);
|
|
31701
|
+
lineDash && _context.setLineDash(lineDash);
|
|
31474
31702
|
}
|
|
31475
31703
|
}
|
|
31476
31704
|
}, {
|
|
@@ -31495,7 +31723,7 @@
|
|
|
31495
31723
|
lineCap = _attribute$lineCap === void 0 ? defaultParams.lineCap : _attribute$lineCap,
|
|
31496
31724
|
_attribute$miterLimit = attribute.miterLimit,
|
|
31497
31725
|
miterLimit = _attribute$miterLimit === void 0 ? defaultParams.miterLimit : _attribute$miterLimit;
|
|
31498
|
-
_context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
31726
|
+
_context.globalAlpha = strokeOpacity * opacity, _context.lineWidth = getScaledStroke(this, lineWidth, this.dpr), _context.strokeStyle = createColor(this, stroke, params, offsetX, offsetY), _context.lineJoin = lineJoin, 0 === lineDash[0] && 0 === lineDash[1] || lineDash && _context.setLineDash(lineDash), _context.lineCap = lineCap, _context.miterLimit = miterLimit;
|
|
31499
31727
|
}
|
|
31500
31728
|
}
|
|
31501
31729
|
}, {
|
|
@@ -32377,7 +32605,7 @@
|
|
|
32377
32605
|
lineCap = _attribute$lineCap === void 0 ? defaultParams.lineCap : _attribute$lineCap,
|
|
32378
32606
|
_attribute$miterLimit = attribute.miterLimit,
|
|
32379
32607
|
miterLimit = _attribute$miterLimit === void 0 ? defaultParams.miterLimit : _attribute$miterLimit;
|
|
32380
|
-
_context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(getScaledStroke(this, lineWidth, this.dpr)), _context.setStrokeStyle(createColor(this, stroke, params, offsetX, offsetY)), _context.setLineJoin(lineJoin), _context.setLineDash(lineDash), _context.setLineCap(lineCap), _context.setMiterLimit(miterLimit);
|
|
32608
|
+
_context.setGlobalAlpha(strokeOpacity * opacity), _context.setLineWidth(getScaledStroke(this, lineWidth, this.dpr)), _context.setStrokeStyle(createColor(this, stroke, params, offsetX, offsetY)), _context.setLineJoin(lineJoin), lineDash && _context.setLineDash(lineDash), _context.setLineCap(lineCap), _context.setMiterLimit(miterLimit);
|
|
32381
32609
|
}
|
|
32382
32610
|
}
|
|
32383
32611
|
}, {
|
|
@@ -34897,7 +35125,7 @@
|
|
|
34897
35125
|
|
|
34898
35126
|
var roughModule = _roughModule;
|
|
34899
35127
|
|
|
34900
|
-
const version = "0.19.0
|
|
35128
|
+
const version = "0.19.0";
|
|
34901
35129
|
preLoadAllModule();
|
|
34902
35130
|
if (isBrowserEnv()) {
|
|
34903
35131
|
loadBrowserEnv(container);
|
|
@@ -35451,6 +35679,7 @@
|
|
|
35451
35679
|
exports.symbolMathPickModule = symbolMathPickModule;
|
|
35452
35680
|
exports.symbolModule = symbolModule;
|
|
35453
35681
|
exports.taroEnvModule = taroEnvModule;
|
|
35682
|
+
exports.textAttributesToStyle = textAttributesToStyle;
|
|
35454
35683
|
exports.textCanvasPickModule = textCanvasPickModule;
|
|
35455
35684
|
exports.textDrawOffsetX = textDrawOffsetX;
|
|
35456
35685
|
exports.textDrawOffsetY = textDrawOffsetY;
|