@visactor/vrender 0.16.14-alpha.6 → 0.16.14
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 +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.js +191 -40
- 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/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -21,5 +21,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
|
|
22
22
|
const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits");
|
|
23
23
|
|
|
24
|
-
exports.version = "0.16.14
|
|
24
|
+
exports.version = "0.16.14", (0, vrender_kits_1.loadAllModule)(vrender_core_1.container),
|
|
25
25
|
__exportStar(require("@visactor/vrender-core"), exports), __exportStar(require("@visactor/vrender-kits"), exports);
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,yDAAuD;AAG1C,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,yDAAuD;AAG1C,QAAA,OAAO,GAAG,SAAS,CAAC;AAEjC,IAAA,4BAAa,EAAC,wBAAS,CAAC,CAAC;AAEzB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import { container } from '@visactor/vrender-core';\nimport { loadAllModule } from '@visactor/vrender-kits';\n\n// 导出版本号\nexport const version = \"0.16.14\";\n\nloadAllModule(container);\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
|
package/dist/index.js
CHANGED
|
@@ -4591,9 +4591,13 @@
|
|
|
4591
4591
|
_this$_userSpec$textB = _this$_userSpec.textBaseline,
|
|
4592
4592
|
textBaseline = _this$_userSpec$textB === void 0 ? null != baseline ? baseline : "middle" : _this$_userSpec$textB,
|
|
4593
4593
|
ellipsis = _this$_userSpec.ellipsis,
|
|
4594
|
-
limit = _this$_userSpec.limit
|
|
4595
|
-
|
|
4594
|
+
limit = _this$_userSpec.limit;
|
|
4595
|
+
var _this$_userSpec$lineH = this._userSpec.lineHeight,
|
|
4596
4596
|
lineHeight = _this$_userSpec$lineH === void 0 ? fontSize : _this$_userSpec$lineH;
|
|
4597
|
+
if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
4598
|
+
var scale = Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100;
|
|
4599
|
+
lineHeight = fontSize * scale;
|
|
4600
|
+
}
|
|
4597
4601
|
return {
|
|
4598
4602
|
fontStyle: fontStyle,
|
|
4599
4603
|
fontVariant: fontVariant,
|
|
@@ -4669,6 +4673,7 @@
|
|
|
4669
4673
|
}, {
|
|
4670
4674
|
key: "_measureWithNaiveCanvas",
|
|
4671
4675
|
value: function _measureWithNaiveCanvas(text) {
|
|
4676
|
+
var _a;
|
|
4672
4677
|
if (!this.initContext()) return this._quickMeasureWithoutCanvas(text);
|
|
4673
4678
|
var metrics = this._context.measureText(text),
|
|
4674
4679
|
_this$textSpec2 = this.textSpec,
|
|
@@ -4676,7 +4681,7 @@
|
|
|
4676
4681
|
lineHeight = _this$textSpec2.lineHeight;
|
|
4677
4682
|
return {
|
|
4678
4683
|
width: metrics.width,
|
|
4679
|
-
height: null
|
|
4684
|
+
height: null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize
|
|
4680
4685
|
};
|
|
4681
4686
|
}
|
|
4682
4687
|
}, {
|
|
@@ -4706,6 +4711,7 @@
|
|
|
4706
4711
|
}, {
|
|
4707
4712
|
key: "_quickMeasureWithoutCanvas",
|
|
4708
4713
|
value: function _quickMeasureWithoutCanvas(text) {
|
|
4714
|
+
var _a;
|
|
4709
4715
|
var totalSize = {
|
|
4710
4716
|
width: 0,
|
|
4711
4717
|
height: 0
|
|
@@ -4718,11 +4724,12 @@
|
|
|
4718
4724
|
size = ["F", "W"].includes(eastAsianCharacterInfo(_char2)) ? 1 : .53;
|
|
4719
4725
|
totalSize.width += size * fontSize;
|
|
4720
4726
|
}
|
|
4721
|
-
return totalSize.height = null
|
|
4727
|
+
return totalSize.height = null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize, totalSize;
|
|
4722
4728
|
}
|
|
4723
4729
|
}, {
|
|
4724
4730
|
key: "_measureReduce",
|
|
4725
4731
|
value: function _measureReduce(text, processor) {
|
|
4732
|
+
var _a;
|
|
4726
4733
|
var _this$textSpec4 = this.textSpec,
|
|
4727
4734
|
fontSize = _this$textSpec4.fontSize,
|
|
4728
4735
|
lineHeight = _this$textSpec4.lineHeight,
|
|
@@ -4739,7 +4746,7 @@
|
|
|
4739
4746
|
width: textArr.reduce(function (maxWidth, cur) {
|
|
4740
4747
|
return Math.max(maxWidth, processor(cur).width);
|
|
4741
4748
|
}, 0),
|
|
4742
|
-
height: textArr.length * ((null
|
|
4749
|
+
height: textArr.length * ((null !== (_a = lineHeight) && void 0 !== _a ? _a : fontSize) + 1) + 1
|
|
4743
4750
|
};
|
|
4744
4751
|
}
|
|
4745
4752
|
return processor(text.toString());
|
|
@@ -6285,7 +6292,10 @@
|
|
|
6285
6292
|
direction: "horizontal",
|
|
6286
6293
|
wordBreak: "break-all",
|
|
6287
6294
|
ignoreBuf: !1,
|
|
6288
|
-
verticalMode: 0
|
|
6295
|
+
verticalMode: 0,
|
|
6296
|
+
whiteSpace: "no-wrap",
|
|
6297
|
+
heightLimit: 1 / 0,
|
|
6298
|
+
lineClamp: 1 / 0
|
|
6289
6299
|
};
|
|
6290
6300
|
var DefaultStyle = Object.assign(Object.assign(Object.assign({
|
|
6291
6301
|
opacity: 1,
|
|
@@ -9944,6 +9954,12 @@
|
|
|
9944
9954
|
}();
|
|
9945
9955
|
RafBasedSTO.TimeOut = 1e3 / 60;
|
|
9946
9956
|
var rafBasedSto = new RafBasedSTO();
|
|
9957
|
+
var calculateLineHeight = function calculateLineHeight(lineHeight, fontSize) {
|
|
9958
|
+
if (isString$1(lineHeight) && "%" === lineHeight[lineHeight.length - 1]) {
|
|
9959
|
+
return fontSize * (Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100);
|
|
9960
|
+
}
|
|
9961
|
+
return lineHeight;
|
|
9962
|
+
};
|
|
9947
9963
|
|
|
9948
9964
|
var IncreaseCount = /*#__PURE__*/function (_ACustomAnimate) {
|
|
9949
9965
|
_inherits(IncreaseCount, _ACustomAnimate);
|
|
@@ -14480,7 +14496,7 @@
|
|
|
14480
14496
|
return CanvasTextLayout;
|
|
14481
14497
|
}();
|
|
14482
14498
|
|
|
14483
|
-
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
14499
|
+
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
14484
14500
|
var Text = /*#__PURE__*/function (_Graphic) {
|
|
14485
14501
|
_inherits(Text, _Graphic);
|
|
14486
14502
|
var _super = _createSuper(Text);
|
|
@@ -14554,6 +14570,117 @@
|
|
|
14554
14570
|
paddingArray = parsePadding(boundsPadding);
|
|
14555
14571
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
14556
14572
|
}
|
|
14573
|
+
}, {
|
|
14574
|
+
key: "updateWrapAABBBounds",
|
|
14575
|
+
value: function updateWrapAABBBounds(text) {
|
|
14576
|
+
var _a, _b, _c, _d;
|
|
14577
|
+
var textTheme = getTheme(this).text,
|
|
14578
|
+
_this$attribute = this.attribute,
|
|
14579
|
+
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
14580
|
+
fontFamily = _this$attribute$fontF === void 0 ? textTheme.fontFamily : _this$attribute$fontF,
|
|
14581
|
+
_this$attribute$textA = _this$attribute.textAlign,
|
|
14582
|
+
textAlign = _this$attribute$textA === void 0 ? textTheme.textAlign : _this$attribute$textA,
|
|
14583
|
+
_this$attribute$textB = _this$attribute.textBaseline,
|
|
14584
|
+
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
14585
|
+
_this$attribute$fontS = _this$attribute.fontSize,
|
|
14586
|
+
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
14587
|
+
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
14588
|
+
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
14589
|
+
maxLineWidth = _this$attribute.maxLineWidth,
|
|
14590
|
+
_this$attribute$strok = _this$attribute.stroke,
|
|
14591
|
+
stroke = _this$attribute$strok === void 0 ? textTheme.stroke : _this$attribute$strok,
|
|
14592
|
+
_this$attribute$lineW = _this$attribute.lineWidth,
|
|
14593
|
+
lineWidth = _this$attribute$lineW === void 0 ? textTheme.lineWidth : _this$attribute$lineW,
|
|
14594
|
+
_this$attribute$wordB = _this$attribute.wordBreak,
|
|
14595
|
+
wordBreak = _this$attribute$wordB === void 0 ? textTheme.wordBreak : _this$attribute$wordB,
|
|
14596
|
+
_this$attribute$fontW = _this$attribute.fontWeight,
|
|
14597
|
+
fontWeight = _this$attribute$fontW === void 0 ? textTheme.fontWeight : _this$attribute$fontW,
|
|
14598
|
+
_this$attribute$ignor = _this$attribute.ignoreBuf,
|
|
14599
|
+
ignoreBuf = _this$attribute$ignor === void 0 ? textTheme.ignoreBuf : _this$attribute$ignor,
|
|
14600
|
+
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
14601
|
+
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
14602
|
+
lineClamp = _this$attribute.lineClamp,
|
|
14603
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
14604
|
+
buf = ignoreBuf ? 0 : 2;
|
|
14605
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
14606
|
+
var _bbox = this.cache.layoutData.bbox;
|
|
14607
|
+
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14608
|
+
}
|
|
14609
|
+
var textMeasure = application.graphicUtil.textMeasure,
|
|
14610
|
+
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
14611
|
+
fontSize: fontSize,
|
|
14612
|
+
fontWeight: fontWeight,
|
|
14613
|
+
fontFamily: fontFamily
|
|
14614
|
+
}, textMeasure),
|
|
14615
|
+
lines = isArray$1(text) ? text.map(function (l) {
|
|
14616
|
+
return l.toString();
|
|
14617
|
+
}) : [text.toString()],
|
|
14618
|
+
linesLayout = [],
|
|
14619
|
+
bboxWH = [0, 0];
|
|
14620
|
+
var lineCountLimit = 1 / 0;
|
|
14621
|
+
if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
|
|
14622
|
+
if (maxLineWidth > 0) for (var i = 0; i < lines.length; i++) {
|
|
14623
|
+
var str = lines[i];
|
|
14624
|
+
var needCut = !0;
|
|
14625
|
+
if (i === lineCountLimit - 1) {
|
|
14626
|
+
var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
14627
|
+
linesLayout.push({
|
|
14628
|
+
str: _clip.str,
|
|
14629
|
+
width: _clip.width
|
|
14630
|
+
});
|
|
14631
|
+
break;
|
|
14632
|
+
}
|
|
14633
|
+
var clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-word" === wordBreak);
|
|
14634
|
+
if ("" !== str && "" === clip.str) {
|
|
14635
|
+
if (ellipsis) {
|
|
14636
|
+
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
14637
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
14638
|
+
} else clip.str = "", clip.width = 0;
|
|
14639
|
+
needCut = !1;
|
|
14640
|
+
}
|
|
14641
|
+
if (linesLayout.push({
|
|
14642
|
+
str: clip.str,
|
|
14643
|
+
width: clip.width
|
|
14644
|
+
}), clip.str.length === str.length) ;else if (needCut) {
|
|
14645
|
+
var newStr = str.substring(clip.str.length);
|
|
14646
|
+
lines.splice(i + 1, 0, newStr);
|
|
14647
|
+
}
|
|
14648
|
+
}
|
|
14649
|
+
var maxWidth = 0;
|
|
14650
|
+
linesLayout.forEach(function (layout) {
|
|
14651
|
+
maxWidth = Math.max(maxWidth, layout.width);
|
|
14652
|
+
}), bboxWH[0] = maxWidth;
|
|
14653
|
+
} else {
|
|
14654
|
+
var width,
|
|
14655
|
+
_text,
|
|
14656
|
+
_lineWidth = 0;
|
|
14657
|
+
for (var _i = 0, len = lines.length; _i < len; _i++) {
|
|
14658
|
+
if (_i === lineCountLimit - 1) {
|
|
14659
|
+
var _clip2 = layoutObj.textMeasure.clipTextWithSuffix(lines[_i], layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
14660
|
+
linesLayout.push({
|
|
14661
|
+
str: _clip2.str,
|
|
14662
|
+
width: _clip2.width
|
|
14663
|
+
}), _lineWidth = Math.max(_lineWidth, _clip2.width);
|
|
14664
|
+
break;
|
|
14665
|
+
}
|
|
14666
|
+
_text = lines[_i], width = layoutObj.textMeasure.measureTextWidth(_text, layoutObj.textOptions, "break-word" === wordBreak), _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
|
|
14667
|
+
str: _text,
|
|
14668
|
+
width: width
|
|
14669
|
+
});
|
|
14670
|
+
}
|
|
14671
|
+
bboxWH[0] = _lineWidth;
|
|
14672
|
+
}
|
|
14673
|
+
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
14674
|
+
var bbox = {
|
|
14675
|
+
xOffset: 0,
|
|
14676
|
+
yOffset: 0,
|
|
14677
|
+
width: bboxWH[0],
|
|
14678
|
+
height: bboxWH[1]
|
|
14679
|
+
};
|
|
14680
|
+
layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
|
|
14681
|
+
var layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
14682
|
+
return this.cache.layoutData = layoutData, this.clearUpdateShapeTag(), this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14683
|
+
}
|
|
14557
14684
|
}, {
|
|
14558
14685
|
key: "updateSingallineAABBBounds",
|
|
14559
14686
|
value: function updateSingallineAABBBounds(text) {
|
|
@@ -14600,9 +14727,12 @@
|
|
|
14600
14727
|
_attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
|
|
14601
14728
|
var _attribute$ignoreBuf = attribute.ignoreBuf,
|
|
14602
14729
|
ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
|
|
14603
|
-
|
|
14604
|
-
_attribute$
|
|
14605
|
-
|
|
14730
|
+
_attribute$whiteSpace = attribute.whiteSpace,
|
|
14731
|
+
whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
|
|
14732
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
14733
|
+
var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
14734
|
+
textFontSize = attribute.fontSize || textTheme.fontSize,
|
|
14735
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) && void 0 !== _a ? _a : textFontSize + buf;
|
|
14606
14736
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
14607
14737
|
width = null !== (_b = this.cache.clipedWidth) && void 0 !== _b ? _b : 0;
|
|
14608
14738
|
var _dx = textDrawOffsetX(textAlign, width),
|
|
@@ -14672,12 +14802,11 @@
|
|
|
14672
14802
|
fontFamily = _attribute$fontFamily2 === void 0 ? textTheme.fontFamily : _attribute$fontFamily2,
|
|
14673
14803
|
_attribute$stroke2 = attribute.stroke,
|
|
14674
14804
|
stroke = _attribute$stroke2 === void 0 ? textTheme.stroke : _attribute$stroke2,
|
|
14675
|
-
_attribute$lineHeight2 = attribute.lineHeight,
|
|
14676
|
-
lineHeight = _attribute$lineHeight2 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight2,
|
|
14677
14805
|
_attribute$lineWidth2 = attribute.lineWidth,
|
|
14678
14806
|
lineWidth = _attribute$lineWidth2 === void 0 ? textTheme.lineWidth : _attribute$lineWidth2,
|
|
14679
14807
|
_attribute$verticalMo = attribute.verticalMode,
|
|
14680
|
-
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo
|
|
14808
|
+
verticalMode = _attribute$verticalMo === void 0 ? textTheme.verticalMode : _attribute$verticalMo,
|
|
14809
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
14681
14810
|
var _attribute$textAlign2 = attribute.textAlign,
|
|
14682
14811
|
textAlign = _attribute$textAlign2 === void 0 ? textTheme.textAlign : _attribute$textAlign2,
|
|
14683
14812
|
_attribute$textBaseli2 = attribute.textBaseline,
|
|
@@ -14727,7 +14856,7 @@
|
|
|
14727
14856
|
}, {
|
|
14728
14857
|
key: "updateHorizontalMultilineAABBBounds",
|
|
14729
14858
|
value: function updateHorizontalMultilineAABBBounds(text) {
|
|
14730
|
-
var _a;
|
|
14859
|
+
var _a, _b;
|
|
14731
14860
|
var textTheme = getTheme(this).text,
|
|
14732
14861
|
attribute = this.attribute,
|
|
14733
14862
|
_attribute$fontFamily3 = attribute.fontFamily,
|
|
@@ -14740,8 +14869,6 @@
|
|
|
14740
14869
|
fontSize = _attribute$fontSize3 === void 0 ? textTheme.fontSize : _attribute$fontSize3,
|
|
14741
14870
|
_attribute$fontWeight3 = attribute.fontWeight,
|
|
14742
14871
|
fontWeight = _attribute$fontWeight3 === void 0 ? textTheme.fontWeight : _attribute$fontWeight3,
|
|
14743
|
-
_attribute$lineHeight3 = attribute.lineHeight,
|
|
14744
|
-
lineHeight = _attribute$lineHeight3 === void 0 ? attribute.lineHeight || attribute.fontSize || textTheme.fontSize : _attribute$lineHeight3,
|
|
14745
14872
|
_attribute$ellipsis3 = attribute.ellipsis,
|
|
14746
14873
|
ellipsis = _attribute$ellipsis3 === void 0 ? textTheme.ellipsis : _attribute$ellipsis3,
|
|
14747
14874
|
maxLineWidth = attribute.maxLineWidth,
|
|
@@ -14749,11 +14876,13 @@
|
|
|
14749
14876
|
stroke = _attribute$stroke3 === void 0 ? textTheme.stroke : _attribute$stroke3,
|
|
14750
14877
|
_attribute$lineWidth3 = attribute.lineWidth,
|
|
14751
14878
|
lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
|
|
14752
|
-
_attribute$
|
|
14753
|
-
_attribute$
|
|
14754
|
-
|
|
14755
|
-
|
|
14756
|
-
|
|
14879
|
+
_attribute$whiteSpace2 = attribute.whiteSpace,
|
|
14880
|
+
whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2,
|
|
14881
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : attribute.fontSize || textTheme.fontSize;
|
|
14882
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
14883
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
14884
|
+
var _bbox2 = this.cache.layoutData.bbox;
|
|
14885
|
+
return this._AABBBounds.set(_bbox2.xOffset, _bbox2.yOffset, _bbox2.xOffset + _bbox2.width, _bbox2.yOffset + _bbox2.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14757
14886
|
}
|
|
14758
14887
|
var textMeasure = application.graphicUtil.textMeasure,
|
|
14759
14888
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
@@ -14787,12 +14916,11 @@
|
|
|
14787
14916
|
fontWeight = _attribute$fontWeight4 === void 0 ? textTheme.fontWeight : _attribute$fontWeight4,
|
|
14788
14917
|
_attribute$stroke4 = attribute.stroke,
|
|
14789
14918
|
stroke = _attribute$stroke4 === void 0 ? textTheme.stroke : _attribute$stroke4,
|
|
14790
|
-
_attribute$lineHeight4 = attribute.lineHeight,
|
|
14791
|
-
lineHeight = _attribute$lineHeight4 === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight4,
|
|
14792
14919
|
_attribute$lineWidth4 = attribute.lineWidth,
|
|
14793
14920
|
lineWidth = _attribute$lineWidth4 === void 0 ? textTheme.lineWidth : _attribute$lineWidth4,
|
|
14794
14921
|
_attribute$verticalMo2 = attribute.verticalMode,
|
|
14795
|
-
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2
|
|
14922
|
+
verticalMode = _attribute$verticalMo2 === void 0 ? textTheme.verticalMode : _attribute$verticalMo2,
|
|
14923
|
+
lineHeight = null !== (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
|
|
14796
14924
|
var _attribute$textAlign4 = attribute.textAlign,
|
|
14797
14925
|
textAlign = _attribute$textAlign4 === void 0 ? textTheme.textAlign : _attribute$textAlign4,
|
|
14798
14926
|
_attribute$textBaseli4 = attribute.textBaseline,
|
|
@@ -14925,7 +15053,7 @@
|
|
|
14925
15053
|
}, {
|
|
14926
15054
|
key: "updateMultilineAABBBounds",
|
|
14927
15055
|
value: function updateMultilineAABBBounds(text) {
|
|
14928
|
-
var _a, _b, _c;
|
|
15056
|
+
var _a, _b, _c, _d;
|
|
14929
15057
|
var textTheme = getTheme(this).text,
|
|
14930
15058
|
_this$attribute = this.attribute,
|
|
14931
15059
|
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
@@ -14936,8 +15064,6 @@
|
|
|
14936
15064
|
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
14937
15065
|
_this$attribute$fontS = _this$attribute.fontSize,
|
|
14938
15066
|
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
14939
|
-
_this$attribute$lineH = _this$attribute.lineHeight,
|
|
14940
|
-
lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
|
|
14941
15067
|
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
14942
15068
|
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
14943
15069
|
maxLineWidth = _this$attribute.maxLineWidth,
|
|
@@ -14954,8 +15080,9 @@
|
|
|
14954
15080
|
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
14955
15081
|
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
14956
15082
|
lineClamp = _this$attribute.lineClamp,
|
|
15083
|
+
lineHeight = null !== (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) && void 0 !== _a ? _a : this.attribute.fontSize || textTheme.fontSize,
|
|
14957
15084
|
buf = ignoreBuf ? 0 : 2;
|
|
14958
|
-
if (!this.shouldUpdateShape() && (null === (
|
|
15085
|
+
if (!this.shouldUpdateShape() && (null === (_b = this.cache) || void 0 === _b ? void 0 : _b.layoutData)) {
|
|
14959
15086
|
var _bbox = this.cache.layoutData.bbox;
|
|
14960
15087
|
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14961
15088
|
}
|
|
@@ -14987,7 +15114,7 @@
|
|
|
14987
15114
|
if ("" !== str && "" === clip.str) {
|
|
14988
15115
|
if (ellipsis) {
|
|
14989
15116
|
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
14990
|
-
clip.str = null !== (
|
|
15117
|
+
clip.str = null !== (_c = clipEllipsis.str) && void 0 !== _c ? _c : "", clip.width = null !== (_d = clipEllipsis.width) && void 0 !== _d ? _d : 0;
|
|
14991
15118
|
} else clip.str = "", clip.width = 0;
|
|
14992
15119
|
needCut = !1;
|
|
14993
15120
|
}
|
|
@@ -15803,6 +15930,13 @@
|
|
|
15803
15930
|
builtinSymbols.forEach(function (symbol) {
|
|
15804
15931
|
builtinSymbolsMap[symbol.type] = symbol;
|
|
15805
15932
|
});
|
|
15933
|
+
var builtInSymbolStrMap = {
|
|
15934
|
+
arrowLeft: "M 0.25 -0.5 L -0.25 0 l 0.5 0.5",
|
|
15935
|
+
arrowRight: "M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5",
|
|
15936
|
+
rect: "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z",
|
|
15937
|
+
rectRound: "M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z",
|
|
15938
|
+
roundLine: "M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z"
|
|
15939
|
+
};
|
|
15806
15940
|
|
|
15807
15941
|
var SYMBOL_UPDATE_TAG_KEY = ["symbolType", "size"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
15808
15942
|
var _Symbol = /*#__PURE__*/function (_Graphic) {
|
|
@@ -15836,12 +15970,13 @@
|
|
|
15836
15970
|
}, {
|
|
15837
15971
|
key: "doUpdateParsedPath",
|
|
15838
15972
|
value: function doUpdateParsedPath() {
|
|
15839
|
-
var symbolTheme = getTheme(this).symbol
|
|
15840
|
-
|
|
15841
|
-
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo
|
|
15842
|
-
|
|
15973
|
+
var symbolTheme = getTheme(this).symbol;
|
|
15974
|
+
var _this$attribute$symbo = this.attribute.symbolType,
|
|
15975
|
+
symbolType = _this$attribute$symbo === void 0 ? symbolTheme.symbolType : _this$attribute$symbo,
|
|
15976
|
+
path = builtinSymbolsMap[symbolType];
|
|
15843
15977
|
if (path) return this._parsedPath = path, path;
|
|
15844
15978
|
if (path = _Symbol.userSymbolMap[symbolType], path) return this._parsedPath = path, path;
|
|
15979
|
+
symbolType = builtInSymbolStrMap[symbolType] || symbolType;
|
|
15845
15980
|
if (!0 === isSvg(symbolType)) {
|
|
15846
15981
|
var parser = new XMLParser(),
|
|
15847
15982
|
_parser$parse = parser.parse(symbolType),
|
|
@@ -16500,7 +16635,9 @@
|
|
|
16500
16635
|
var Paragraph = /*#__PURE__*/function () {
|
|
16501
16636
|
function Paragraph(text, newLine, character) {
|
|
16502
16637
|
_classCallCheck(this, Paragraph);
|
|
16503
|
-
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic"
|
|
16638
|
+
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic";
|
|
16639
|
+
var lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
16640
|
+
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
16504
16641
|
var _measureTextCanvas = measureTextCanvas(text, character),
|
|
16505
16642
|
ascent = _measureTextCanvas.ascent,
|
|
16506
16643
|
height = _measureTextCanvas.height,
|
|
@@ -20229,7 +20366,7 @@
|
|
|
20229
20366
|
var t = textAlign;
|
|
20230
20367
|
textAlign = null !== (_a = text.getBaselineMapAlign()[textBaseline]) && void 0 !== _a ? _a : "left", textBaseline = null !== (_b = text.getAlignMapBaseline()[t]) && void 0 !== _b ? _b : "top";
|
|
20231
20368
|
}
|
|
20232
|
-
var lineHeight = null !== (_c = text.attribute.lineHeight) && void 0 !== _c ? _c : fontSize,
|
|
20369
|
+
var lineHeight = null !== (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) && void 0 !== _c ? _c : fontSize,
|
|
20233
20370
|
data = this.valid(text, textAttribute, fillCb, strokeCb);
|
|
20234
20371
|
if (!data) return;
|
|
20235
20372
|
var fVisible = data.fVisible,
|
|
@@ -24840,6 +24977,11 @@
|
|
|
24840
24977
|
get: function get() {
|
|
24841
24978
|
return this.at(0);
|
|
24842
24979
|
}
|
|
24980
|
+
}, {
|
|
24981
|
+
key: "preventRender",
|
|
24982
|
+
value: function preventRender(prevent) {
|
|
24983
|
+
prevent ? this._skipRender = -1 / 0 : this.params && this.params.optimize && !1 !== this.params.optimize.skipRenderWithOutRange ? this._skipRender = this.window.isVisible() ? 0 : 1 : this._skipRender = 0;
|
|
24984
|
+
}
|
|
24843
24985
|
}, {
|
|
24844
24986
|
key: "optmize",
|
|
24845
24987
|
value: function optmize(params) {
|
|
@@ -24850,8 +24992,8 @@
|
|
|
24850
24992
|
value: function optmizeRender() {
|
|
24851
24993
|
var _this2 = this;
|
|
24852
24994
|
var skipRenderWithOutRange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
24853
|
-
skipRenderWithOutRange && (this._skipRender = this.window.isVisible() ? 0 : 1, this.window.onVisibleChange(function (visible) {
|
|
24854
|
-
visible ? (_this2.dirtyBounds && _this2.dirtyBounds.setValue(0, 0, _this2._viewBox.width(), _this2._viewBox.height()), _this2._skipRender > 1 && _this2.renderNextFrame(), _this2._skipRender = 0) : _this2._skipRender = 1;
|
|
24995
|
+
skipRenderWithOutRange && (this._skipRender = this._skipRender < 0 ? this._skipRender : this.window.isVisible() ? 0 : 1, this.window.onVisibleChange(function (visible) {
|
|
24996
|
+
_this2._skipRender < 0 || (visible ? (_this2.dirtyBounds && _this2.dirtyBounds.setValue(0, 0, _this2._viewBox.width(), _this2._viewBox.height()), _this2._skipRender > 1 && _this2.renderNextFrame(), _this2._skipRender = 0) : _this2._skipRender = 1);
|
|
24855
24997
|
}));
|
|
24856
24998
|
}
|
|
24857
24999
|
}, {
|
|
@@ -29330,7 +29472,7 @@
|
|
|
29330
29472
|
var scaleX, scaleY;
|
|
29331
29473
|
return nativeCanvas && (scaleX = rect.width / nativeCanvas.offsetWidth, scaleY = rect.height / nativeCanvas.offsetHeight), {
|
|
29332
29474
|
x: (x - rect.left) / (isValidNumber$1(scaleX) ? scaleX : 1),
|
|
29333
|
-
y: (y - rect.top) / (isValidNumber$1(scaleY) ?
|
|
29475
|
+
y: (y - rect.top) / (isValidNumber$1(scaleY) ? scaleY : 1)
|
|
29334
29476
|
};
|
|
29335
29477
|
}
|
|
29336
29478
|
return {
|
|
@@ -32270,7 +32412,7 @@
|
|
|
32270
32412
|
width = data.width, height = data.height;
|
|
32271
32413
|
}
|
|
32272
32414
|
var dpr = params.dpr;
|
|
32273
|
-
if (
|
|
32415
|
+
if (null == dpr) {
|
|
32274
32416
|
dpr = null !== (_a = canvas.getContext("2d").pixelRatio) && void 0 !== _a ? _a : canvas.width / width;
|
|
32275
32417
|
}
|
|
32276
32418
|
this.canvas = new BrowserCanvas({
|
|
@@ -33327,6 +33469,13 @@
|
|
|
33327
33469
|
_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;
|
|
33328
33470
|
}
|
|
33329
33471
|
}
|
|
33472
|
+
}, {
|
|
33473
|
+
key: "measureText",
|
|
33474
|
+
value: function measureText(text) {
|
|
33475
|
+
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : application.global.measureTextMethod;
|
|
33476
|
+
this.setTransform(1, 0, 0, 1, 0, 0, !0, application.global.devicePixelRatio);
|
|
33477
|
+
return _get(_getPrototypeOf(LynxContext2d.prototype), "measureText", this).call(this, text, method);
|
|
33478
|
+
}
|
|
33330
33479
|
}, {
|
|
33331
33480
|
key: "createPattern",
|
|
33332
33481
|
value: function createPattern(image, repetition) {
|
|
@@ -34493,7 +34642,7 @@
|
|
|
34493
34642
|
|
|
34494
34643
|
var roughModule = _roughModule;
|
|
34495
34644
|
|
|
34496
|
-
const version = "0.16.14
|
|
34645
|
+
const version = "0.16.14";
|
|
34497
34646
|
loadAllModule(container);
|
|
34498
34647
|
|
|
34499
34648
|
exports.ACustomAnimate = ACustomAnimate;
|
|
@@ -34723,9 +34872,11 @@
|
|
|
34723
34872
|
exports.bindContributionProvider = bindContributionProvider;
|
|
34724
34873
|
exports.bindContributionProviderNoSingletonScope = bindContributionProviderNoSingletonScope;
|
|
34725
34874
|
exports.boundStroke = boundStroke;
|
|
34875
|
+
exports.builtInSymbolStrMap = builtInSymbolStrMap;
|
|
34726
34876
|
exports.builtinSymbols = builtinSymbols;
|
|
34727
34877
|
exports.builtinSymbolsMap = builtinSymbolsMap;
|
|
34728
34878
|
exports.calcLineCache = calcLineCache$1;
|
|
34879
|
+
exports.calculateLineHeight = calculateLineHeight;
|
|
34729
34880
|
exports.centroidOfSubpath = centroidOfSubpath;
|
|
34730
34881
|
exports.circleBounds = circleBounds;
|
|
34731
34882
|
exports.clock = clock;
|