@visactor/vrender 0.16.12 → 0.16.13
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 +141 -10
- 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.
|
|
24
|
+
exports.version = "0.16.13", (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,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.
|
|
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.13\";\n\nloadAllModule(container);\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
|
package/dist/index.js
CHANGED
|
@@ -6285,7 +6285,10 @@
|
|
|
6285
6285
|
direction: "horizontal",
|
|
6286
6286
|
wordBreak: "break-all",
|
|
6287
6287
|
ignoreBuf: !1,
|
|
6288
|
-
verticalMode: 0
|
|
6288
|
+
verticalMode: 0,
|
|
6289
|
+
whiteSpace: "no-wrap",
|
|
6290
|
+
heightLimit: 1 / 0,
|
|
6291
|
+
lineClamp: 1 / 0
|
|
6289
6292
|
};
|
|
6290
6293
|
var DefaultStyle = Object.assign(Object.assign(Object.assign({
|
|
6291
6294
|
opacity: 1,
|
|
@@ -14482,7 +14485,7 @@
|
|
|
14482
14485
|
return CanvasTextLayout;
|
|
14483
14486
|
}();
|
|
14484
14487
|
|
|
14485
|
-
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
14488
|
+
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
14486
14489
|
var Text = /*#__PURE__*/function (_Graphic) {
|
|
14487
14490
|
_inherits(Text, _Graphic);
|
|
14488
14491
|
var _super = _createSuper(Text);
|
|
@@ -14556,6 +14559,118 @@
|
|
|
14556
14559
|
paddingArray = parsePadding(boundsPadding);
|
|
14557
14560
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
14558
14561
|
}
|
|
14562
|
+
}, {
|
|
14563
|
+
key: "updateWrapAABBBounds",
|
|
14564
|
+
value: function updateWrapAABBBounds(text) {
|
|
14565
|
+
var _a, _b, _c;
|
|
14566
|
+
var textTheme = getTheme(this).text,
|
|
14567
|
+
_this$attribute = this.attribute,
|
|
14568
|
+
_this$attribute$fontF = _this$attribute.fontFamily,
|
|
14569
|
+
fontFamily = _this$attribute$fontF === void 0 ? textTheme.fontFamily : _this$attribute$fontF,
|
|
14570
|
+
_this$attribute$textA = _this$attribute.textAlign,
|
|
14571
|
+
textAlign = _this$attribute$textA === void 0 ? textTheme.textAlign : _this$attribute$textA,
|
|
14572
|
+
_this$attribute$textB = _this$attribute.textBaseline,
|
|
14573
|
+
textBaseline = _this$attribute$textB === void 0 ? textTheme.textBaseline : _this$attribute$textB,
|
|
14574
|
+
_this$attribute$fontS = _this$attribute.fontSize,
|
|
14575
|
+
fontSize = _this$attribute$fontS === void 0 ? textTheme.fontSize : _this$attribute$fontS,
|
|
14576
|
+
_this$attribute$lineH = _this$attribute.lineHeight,
|
|
14577
|
+
lineHeight = _this$attribute$lineH === void 0 ? this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize : _this$attribute$lineH,
|
|
14578
|
+
_this$attribute$ellip = _this$attribute.ellipsis,
|
|
14579
|
+
ellipsis = _this$attribute$ellip === void 0 ? textTheme.ellipsis : _this$attribute$ellip,
|
|
14580
|
+
maxLineWidth = _this$attribute.maxLineWidth,
|
|
14581
|
+
_this$attribute$strok = _this$attribute.stroke,
|
|
14582
|
+
stroke = _this$attribute$strok === void 0 ? textTheme.stroke : _this$attribute$strok,
|
|
14583
|
+
_this$attribute$lineW = _this$attribute.lineWidth,
|
|
14584
|
+
lineWidth = _this$attribute$lineW === void 0 ? textTheme.lineWidth : _this$attribute$lineW,
|
|
14585
|
+
_this$attribute$wordB = _this$attribute.wordBreak,
|
|
14586
|
+
wordBreak = _this$attribute$wordB === void 0 ? textTheme.wordBreak : _this$attribute$wordB,
|
|
14587
|
+
_this$attribute$fontW = _this$attribute.fontWeight,
|
|
14588
|
+
fontWeight = _this$attribute$fontW === void 0 ? textTheme.fontWeight : _this$attribute$fontW,
|
|
14589
|
+
_this$attribute$ignor = _this$attribute.ignoreBuf,
|
|
14590
|
+
ignoreBuf = _this$attribute$ignor === void 0 ? textTheme.ignoreBuf : _this$attribute$ignor,
|
|
14591
|
+
_this$attribute$heigh = _this$attribute.heightLimit,
|
|
14592
|
+
heightLimit = _this$attribute$heigh === void 0 ? 0 : _this$attribute$heigh,
|
|
14593
|
+
lineClamp = _this$attribute.lineClamp,
|
|
14594
|
+
buf = ignoreBuf ? 0 : 2;
|
|
14595
|
+
if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
|
|
14596
|
+
var _bbox = this.cache.layoutData.bbox;
|
|
14597
|
+
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14598
|
+
}
|
|
14599
|
+
var textMeasure = application.graphicUtil.textMeasure,
|
|
14600
|
+
layoutObj = new CanvasTextLayout(fontFamily, {
|
|
14601
|
+
fontSize: fontSize,
|
|
14602
|
+
fontWeight: fontWeight,
|
|
14603
|
+
fontFamily: fontFamily
|
|
14604
|
+
}, textMeasure),
|
|
14605
|
+
lines = isArray$1(text) ? text.map(function (l) {
|
|
14606
|
+
return l.toString();
|
|
14607
|
+
}) : [text.toString()],
|
|
14608
|
+
linesLayout = [],
|
|
14609
|
+
bboxWH = [0, 0];
|
|
14610
|
+
var lineCountLimit = 1 / 0;
|
|
14611
|
+
if (heightLimit > 0 && (lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1)), lineClamp && (lineCountLimit = Math.min(lineCountLimit, lineClamp)), "number" == typeof maxLineWidth && maxLineWidth !== 1 / 0) {
|
|
14612
|
+
if (maxLineWidth > 0) for (var i = 0; i < lines.length; i++) {
|
|
14613
|
+
var str = lines[i];
|
|
14614
|
+
var needCut = !0;
|
|
14615
|
+
if (i === lineCountLimit - 1) {
|
|
14616
|
+
var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
14617
|
+
linesLayout.push({
|
|
14618
|
+
str: _clip.str,
|
|
14619
|
+
width: _clip.width
|
|
14620
|
+
});
|
|
14621
|
+
break;
|
|
14622
|
+
}
|
|
14623
|
+
var clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, "break-word" === wordBreak);
|
|
14624
|
+
if ("" !== str && "" === clip.str) {
|
|
14625
|
+
if (ellipsis) {
|
|
14626
|
+
var clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
14627
|
+
clip.str = null !== (_b = clipEllipsis.str) && void 0 !== _b ? _b : "", clip.width = null !== (_c = clipEllipsis.width) && void 0 !== _c ? _c : 0;
|
|
14628
|
+
} else clip.str = "", clip.width = 0;
|
|
14629
|
+
needCut = !1;
|
|
14630
|
+
}
|
|
14631
|
+
if (linesLayout.push({
|
|
14632
|
+
str: clip.str,
|
|
14633
|
+
width: clip.width
|
|
14634
|
+
}), clip.str.length === str.length) ;else if (needCut) {
|
|
14635
|
+
var newStr = str.substring(clip.str.length);
|
|
14636
|
+
lines.splice(i + 1, 0, newStr);
|
|
14637
|
+
}
|
|
14638
|
+
}
|
|
14639
|
+
var maxWidth = 0;
|
|
14640
|
+
linesLayout.forEach(function (layout) {
|
|
14641
|
+
maxWidth = Math.max(maxWidth, layout.width);
|
|
14642
|
+
}), bboxWH[0] = maxWidth;
|
|
14643
|
+
} else {
|
|
14644
|
+
var width,
|
|
14645
|
+
_text,
|
|
14646
|
+
_lineWidth = 0;
|
|
14647
|
+
for (var _i = 0, len = lines.length; _i < len; _i++) {
|
|
14648
|
+
if (_i === lineCountLimit - 1) {
|
|
14649
|
+
var _clip2 = layoutObj.textMeasure.clipTextWithSuffix(lines[_i], layoutObj.textOptions, maxLineWidth, ellipsis, !1);
|
|
14650
|
+
linesLayout.push({
|
|
14651
|
+
str: _clip2.str,
|
|
14652
|
+
width: _clip2.width
|
|
14653
|
+
}), _lineWidth = Math.max(_lineWidth, _clip2.width);
|
|
14654
|
+
break;
|
|
14655
|
+
}
|
|
14656
|
+
_text = lines[_i], width = layoutObj.textMeasure.measureTextWidth(_text, layoutObj.textOptions, "break-word" === wordBreak), _lineWidth = Math.max(_lineWidth, width), linesLayout.push({
|
|
14657
|
+
str: _text,
|
|
14658
|
+
width: width
|
|
14659
|
+
});
|
|
14660
|
+
}
|
|
14661
|
+
bboxWH[0] = _lineWidth;
|
|
14662
|
+
}
|
|
14663
|
+
bboxWH[1] = linesLayout.length * (lineHeight + buf);
|
|
14664
|
+
var bbox = {
|
|
14665
|
+
xOffset: 0,
|
|
14666
|
+
yOffset: 0,
|
|
14667
|
+
width: bboxWH[0],
|
|
14668
|
+
height: bboxWH[1]
|
|
14669
|
+
};
|
|
14670
|
+
layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
|
|
14671
|
+
var layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
|
|
14672
|
+
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;
|
|
14673
|
+
}
|
|
14559
14674
|
}, {
|
|
14560
14675
|
key: "updateSingallineAABBBounds",
|
|
14561
14676
|
value: function updateSingallineAABBBounds(text) {
|
|
@@ -14602,7 +14717,10 @@
|
|
|
14602
14717
|
_attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
|
|
14603
14718
|
var _attribute$ignoreBuf = attribute.ignoreBuf,
|
|
14604
14719
|
ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
|
|
14605
|
-
|
|
14720
|
+
_attribute$whiteSpace = attribute.whiteSpace,
|
|
14721
|
+
whiteSpace = _attribute$whiteSpace === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace;
|
|
14722
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
14723
|
+
var buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
14606
14724
|
_attribute$lineHeight = attribute.lineHeight,
|
|
14607
14725
|
lineHeight = _attribute$lineHeight === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight;
|
|
14608
14726
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
@@ -14751,11 +14869,12 @@
|
|
|
14751
14869
|
stroke = _attribute$stroke3 === void 0 ? textTheme.stroke : _attribute$stroke3,
|
|
14752
14870
|
_attribute$lineWidth3 = attribute.lineWidth,
|
|
14753
14871
|
lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
|
|
14754
|
-
_attribute$
|
|
14755
|
-
_attribute$
|
|
14872
|
+
_attribute$whiteSpace2 = attribute.whiteSpace,
|
|
14873
|
+
whiteSpace = _attribute$whiteSpace2 === void 0 ? textTheme.whiteSpace : _attribute$whiteSpace2;
|
|
14874
|
+
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
14756
14875
|
if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
|
|
14757
|
-
var
|
|
14758
|
-
return this._AABBBounds.set(
|
|
14876
|
+
var _bbox2 = this.cache.layoutData.bbox;
|
|
14877
|
+
return this._AABBBounds.set(_bbox2.xOffset, _bbox2.yOffset, _bbox2.xOffset + _bbox2.width, _bbox2.yOffset + _bbox2.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14759
14878
|
}
|
|
14760
14879
|
var textMeasure = application.graphicUtil.textMeasure,
|
|
14761
14880
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
@@ -24842,6 +24961,11 @@
|
|
|
24842
24961
|
get: function get() {
|
|
24843
24962
|
return this.at(0);
|
|
24844
24963
|
}
|
|
24964
|
+
}, {
|
|
24965
|
+
key: "preventRender",
|
|
24966
|
+
value: function preventRender(prevent) {
|
|
24967
|
+
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;
|
|
24968
|
+
}
|
|
24845
24969
|
}, {
|
|
24846
24970
|
key: "optmize",
|
|
24847
24971
|
value: function optmize(params) {
|
|
@@ -24852,8 +24976,8 @@
|
|
|
24852
24976
|
value: function optmizeRender() {
|
|
24853
24977
|
var _this2 = this;
|
|
24854
24978
|
var skipRenderWithOutRange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
24855
|
-
skipRenderWithOutRange && (this._skipRender = this.window.isVisible() ? 0 : 1, this.window.onVisibleChange(function (visible) {
|
|
24856
|
-
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;
|
|
24979
|
+
skipRenderWithOutRange && (this._skipRender = this._skipRender < 0 ? this._skipRender : this.window.isVisible() ? 0 : 1, this.window.onVisibleChange(function (visible) {
|
|
24980
|
+
_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);
|
|
24857
24981
|
}));
|
|
24858
24982
|
}
|
|
24859
24983
|
}, {
|
|
@@ -33329,6 +33453,13 @@
|
|
|
33329
33453
|
_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;
|
|
33330
33454
|
}
|
|
33331
33455
|
}
|
|
33456
|
+
}, {
|
|
33457
|
+
key: "measureText",
|
|
33458
|
+
value: function measureText(text) {
|
|
33459
|
+
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : application.global.measureTextMethod;
|
|
33460
|
+
this.setTransform(1, 0, 0, 1, 0, 0, !0, application.global.devicePixelRatio);
|
|
33461
|
+
return _get(_getPrototypeOf(LynxContext2d.prototype), "measureText", this).call(this, text, method);
|
|
33462
|
+
}
|
|
33332
33463
|
}, {
|
|
33333
33464
|
key: "createPattern",
|
|
33334
33465
|
value: function createPattern(image, repetition) {
|
|
@@ -34495,7 +34626,7 @@
|
|
|
34495
34626
|
|
|
34496
34627
|
var roughModule = _roughModule;
|
|
34497
34628
|
|
|
34498
|
-
const version = "0.16.
|
|
34629
|
+
const version = "0.16.13";
|
|
34499
34630
|
loadAllModule(container);
|
|
34500
34631
|
|
|
34501
34632
|
exports.ACustomAnimate = ACustomAnimate;
|