@visactor/vrender 0.16.14-alpha.2 → 0.16.14-alpha.4
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 +12 -145
- 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-alpha.
|
|
24
|
+
exports.version = "0.16.14-alpha.4", (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,iBAAiB,CAAC;AAEzC,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-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,yDAAuD;AAG1C,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,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-alpha.4\";\n\nloadAllModule(container);\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
|
package/dist/index.js
CHANGED
|
@@ -6285,10 +6285,7 @@
|
|
|
6285
6285
|
direction: "horizontal",
|
|
6286
6286
|
wordBreak: "break-all",
|
|
6287
6287
|
ignoreBuf: !1,
|
|
6288
|
-
verticalMode: 0
|
|
6289
|
-
whiteSpace: "no-wrap",
|
|
6290
|
-
heightLimit: 1 / 0,
|
|
6291
|
-
lineClamp: 1 / 0
|
|
6288
|
+
verticalMode: 0
|
|
6292
6289
|
};
|
|
6293
6290
|
var DefaultStyle = Object.assign(Object.assign(Object.assign({
|
|
6294
6291
|
opacity: 1,
|
|
@@ -8389,13 +8386,12 @@
|
|
|
8389
8386
|
}, {
|
|
8390
8387
|
key: "mapEvent",
|
|
8391
8388
|
value: function mapEvent(e) {
|
|
8392
|
-
var _this$_prePointTarget;
|
|
8393
8389
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
8394
8390
|
if (!this.rootTarget) return;
|
|
8395
8391
|
var mappers = this.mappingTable[e.type];
|
|
8396
8392
|
var target;
|
|
8397
8393
|
var cacheKey = "".concat(e.canvasX, "-").concat(e.canvasY);
|
|
8398
|
-
if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY, e), e.pickParams || (this._prePointTargetCache = (
|
|
8394
|
+
if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.canvasX, e.canvasY, e), e.pickParams || (this._prePointTargetCache = _defineProperty(_defineProperty({}, cacheKey, target), "stageRenderCount", null !== (_g = null == target ? void 0 : target.stage.renderCount) && void 0 !== _g ? _g : -1))), mappers) for (var i = 0, j = mappers.length; i < j; i++) mappers[i].fn(e, target);else console.warn("[EventManager]: Event mapping not defined for ".concat(e.type));
|
|
8399
8395
|
}
|
|
8400
8396
|
}, {
|
|
8401
8397
|
key: "propagate",
|
|
@@ -12863,8 +12859,7 @@
|
|
|
12863
12859
|
}, {
|
|
12864
12860
|
key: "addChild",
|
|
12865
12861
|
value: function addChild(node) {
|
|
12866
|
-
|
|
12867
|
-
"__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push((_this$child$push2 = {}, _defineProperty(_this$child$push2, node.tagname, node.child), _defineProperty(_this$child$push2, ":@", node[":@"]), _this$child$push2)) : this.child.push(_defineProperty({}, node.tagname, node.child));
|
|
12862
|
+
"__proto__" === node.tagname && (node.tagname = "#__proto__"), node[":@"] && Object.keys(node[":@"]).length > 0 ? this.child.push(_defineProperty(_defineProperty({}, node.tagname, node.child), ":@", node[":@"])) : this.child.push(_defineProperty({}, node.tagname, node.child));
|
|
12868
12863
|
}
|
|
12869
12864
|
}]);
|
|
12870
12865
|
return XmlNode;
|
|
@@ -14485,7 +14480,7 @@
|
|
|
14485
14480
|
return CanvasTextLayout;
|
|
14486
14481
|
}();
|
|
14487
14482
|
|
|
14488
|
-
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "
|
|
14483
|
+
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
14489
14484
|
var Text = /*#__PURE__*/function (_Graphic) {
|
|
14490
14485
|
_inherits(Text, _Graphic);
|
|
14491
14486
|
var _super = _createSuper(Text);
|
|
@@ -14559,118 +14554,6 @@
|
|
|
14559
14554
|
paddingArray = parsePadding(boundsPadding);
|
|
14560
14555
|
return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(), bounds;
|
|
14561
14556
|
}
|
|
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
|
-
}
|
|
14674
14557
|
}, {
|
|
14675
14558
|
key: "updateSingallineAABBBounds",
|
|
14676
14559
|
value: function updateSingallineAABBBounds(text) {
|
|
@@ -14717,10 +14600,7 @@
|
|
|
14717
14600
|
_attribute$wordBreak === void 0 ? textTheme.wordBreak : _attribute$wordBreak;
|
|
14718
14601
|
var _attribute$ignoreBuf = attribute.ignoreBuf,
|
|
14719
14602
|
ignoreBuf = _attribute$ignoreBuf === void 0 ? textTheme.ignoreBuf : _attribute$ignoreBuf,
|
|
14720
|
-
|
|
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),
|
|
14603
|
+
buf = ignoreBuf ? 0 : Math.max(2, .075 * fontSize),
|
|
14724
14604
|
_attribute$lineHeight = attribute.lineHeight,
|
|
14725
14605
|
lineHeight = _attribute$lineHeight === void 0 ? null !== (_a = attribute.lineHeight) && void 0 !== _a ? _a : (attribute.fontSize || textTheme.fontSize) + buf : _attribute$lineHeight;
|
|
14726
14606
|
if (!this.shouldUpdateShape() && this.cache) {
|
|
@@ -14869,12 +14749,11 @@
|
|
|
14869
14749
|
stroke = _attribute$stroke3 === void 0 ? textTheme.stroke : _attribute$stroke3,
|
|
14870
14750
|
_attribute$lineWidth3 = attribute.lineWidth,
|
|
14871
14751
|
lineWidth = _attribute$lineWidth3 === void 0 ? textTheme.lineWidth : _attribute$lineWidth3,
|
|
14872
|
-
_attribute$
|
|
14873
|
-
|
|
14874
|
-
if ("normal" === whiteSpace) return this.updateWrapAABBBounds(text);
|
|
14752
|
+
_attribute$wordBreak2 = attribute.wordBreak;
|
|
14753
|
+
_attribute$wordBreak2 === void 0 ? textTheme.wordBreak : _attribute$wordBreak2;
|
|
14875
14754
|
if (!this.shouldUpdateShape() && (null === (_a = this.cache) || void 0 === _a ? void 0 : _a.layoutData)) {
|
|
14876
|
-
var
|
|
14877
|
-
return this._AABBBounds.set(
|
|
14755
|
+
var _bbox = this.cache.layoutData.bbox;
|
|
14756
|
+
return this._AABBBounds.set(_bbox.xOffset, _bbox.yOffset, _bbox.xOffset + _bbox.width, _bbox.yOffset + _bbox.height), stroke && this._AABBBounds.expand(lineWidth / 2), this._AABBBounds;
|
|
14878
14757
|
}
|
|
14879
14758
|
var textMeasure = application.graphicUtil.textMeasure,
|
|
14880
14759
|
layoutData = new CanvasTextLayout(fontFamily, {
|
|
@@ -24961,11 +24840,6 @@
|
|
|
24961
24840
|
get: function get() {
|
|
24962
24841
|
return this.at(0);
|
|
24963
24842
|
}
|
|
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
|
-
}
|
|
24969
24843
|
}, {
|
|
24970
24844
|
key: "optmize",
|
|
24971
24845
|
value: function optmize(params) {
|
|
@@ -24976,8 +24850,8 @@
|
|
|
24976
24850
|
value: function optmizeRender() {
|
|
24977
24851
|
var _this2 = this;
|
|
24978
24852
|
var skipRenderWithOutRange = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
24979
|
-
skipRenderWithOutRange && (this._skipRender = this.
|
|
24980
|
-
|
|
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;
|
|
24981
24855
|
}));
|
|
24982
24856
|
}
|
|
24983
24857
|
}, {
|
|
@@ -33453,13 +33327,6 @@
|
|
|
33453
33327
|
_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;
|
|
33454
33328
|
}
|
|
33455
33329
|
}
|
|
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
|
-
}
|
|
33463
33330
|
}, {
|
|
33464
33331
|
key: "createPattern",
|
|
33465
33332
|
value: function createPattern(image, repetition) {
|
|
@@ -34626,7 +34493,7 @@
|
|
|
34626
34493
|
|
|
34627
34494
|
var roughModule = _roughModule;
|
|
34628
34495
|
|
|
34629
|
-
const version = "0.16.14-alpha.
|
|
34496
|
+
const version = "0.16.14-alpha.4";
|
|
34630
34497
|
loadAllModule(container);
|
|
34631
34498
|
|
|
34632
34499
|
exports.ACustomAnimate = ACustomAnimate;
|