@visactor/vrender 0.17.4 → 0.17.5-alpha.1
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 +42 -23
- 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 +5 -5
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
21
21
|
|
|
22
22
|
const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits"), vrender_kits_2 = require("@visactor/vrender-kits");
|
|
23
23
|
|
|
24
|
-
exports.version = "0.17.
|
|
24
|
+
exports.version = "0.17.5-alpha.1", (0, vrender_core_1.isBrowserEnv)() ? (0, vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0,
|
|
25
25
|
vrender_core_1.isNodeEnv)() && (0, vrender_kits_1.loadNodeEnv)(vrender_core_1.container),
|
|
26
26
|
(0, vrender_kits_2.registerArc)(), (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(),
|
|
27
27
|
(0, vrender_kits_2.registerCircle)(), (0, vrender_kits_2.registerGlyph)(), (0, vrender_kits_2.registerGroup)(),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAA4E;AAC5E,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAA4E;AAC5E,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AACnB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import { container, isBrowserEnv, isNodeEnv } from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\nexport const version = \"0.17.5-alpha.1\";\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
|
package/dist/index.js
CHANGED
|
@@ -5125,6 +5125,7 @@
|
|
|
5125
5125
|
wordBreak: "break-all",
|
|
5126
5126
|
ignoreBuf: !1,
|
|
5127
5127
|
verticalMode: 0,
|
|
5128
|
+
wrap: !1,
|
|
5128
5129
|
whiteSpace: "no-wrap",
|
|
5129
5130
|
heightLimit: 1 / 0,
|
|
5130
5131
|
lineClamp: 1 / 0,
|
|
@@ -9765,6 +9766,7 @@
|
|
|
9765
9766
|
var _ref3 = "function" == typeof this.params ? this.params() : this.params,
|
|
9766
9767
|
center = _ref3.center,
|
|
9767
9768
|
r = _ref3.r,
|
|
9769
|
+
cb = _ref3.cb,
|
|
9768
9770
|
deltaAngle = 2 * Math.PI * ratio,
|
|
9769
9771
|
theta = this.theta + deltaAngle,
|
|
9770
9772
|
phi = this.phi,
|
|
@@ -9772,7 +9774,7 @@
|
|
|
9772
9774
|
y = r * Math.cos(phi) + center.y,
|
|
9773
9775
|
z = r * Math.sin(phi) * Math.sin(theta) + center.z;
|
|
9774
9776
|
for (out.x = x, out.y = y, out.z = z, out.alpha = theta + pi / 2; out.alpha > pi2;) out.alpha -= pi2;
|
|
9775
|
-
out.alpha = pi2 - out.alpha, out.zIndex = -1e4 * out.z;
|
|
9777
|
+
out.alpha = pi2 - out.alpha, out.zIndex = -1e4 * out.z, cb && cb(out);
|
|
9776
9778
|
}
|
|
9777
9779
|
}]);
|
|
9778
9780
|
return RotateBySphereAnimate;
|
|
@@ -13679,7 +13681,7 @@
|
|
|
13679
13681
|
return CanvasTextLayout;
|
|
13680
13682
|
}();
|
|
13681
13683
|
|
|
13682
|
-
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
13684
|
+
var TEXT_UPDATE_TAG_KEY = ["text", "maxLineWidth", "heightLimit", "lineClamp", "fontSize", "fontFamily", "fontWeight", "ellipsis", "lineHeight", "direction", "wordBreak", "heightLimit", "lineClamp"].concat(_toConsumableArray(GRAPHIC_UPDATE_TAG_KEY));
|
|
13683
13685
|
var Text = /*#__PURE__*/function (_Graphic) {
|
|
13684
13686
|
_inherits(Text, _Graphic);
|
|
13685
13687
|
var _super = _createSuper(Text);
|
|
@@ -13739,7 +13741,9 @@
|
|
|
13739
13741
|
key: "_isValid",
|
|
13740
13742
|
value: function _isValid() {
|
|
13741
13743
|
var text = this.attribute.text;
|
|
13742
|
-
return
|
|
13744
|
+
return isArray$1(text) ? !text.every(function (t) {
|
|
13745
|
+
return null == t || "" === t;
|
|
13746
|
+
}) : null != text && "" !== text;
|
|
13743
13747
|
}
|
|
13744
13748
|
}, {
|
|
13745
13749
|
key: "doUpdateAABBBounds",
|
|
@@ -13887,7 +13891,10 @@
|
|
|
13887
13891
|
value: function updateHorizontalSinglelineAABBBounds(text) {
|
|
13888
13892
|
var _a, _b;
|
|
13889
13893
|
var textTheme = getTheme(this).text,
|
|
13890
|
-
|
|
13894
|
+
_this$attribute$wrap = this.attribute.wrap,
|
|
13895
|
+
wrap = _this$attribute$wrap === void 0 ? textTheme.wrap : _this$attribute$wrap;
|
|
13896
|
+
if (wrap) return this.updateWrapAABBBounds([text]);
|
|
13897
|
+
var textMeasure = application.graphicUtil.textMeasure;
|
|
13891
13898
|
var width, str;
|
|
13892
13899
|
var attribute = this.attribute,
|
|
13893
13900
|
_attribute$maxLineWid3 = attribute.maxLineWidth,
|
|
@@ -14045,7 +14052,10 @@
|
|
|
14045
14052
|
value: function updateHorizontalMultilineAABBBounds(text) {
|
|
14046
14053
|
var _a, _b;
|
|
14047
14054
|
var textTheme = getTheme(this).text,
|
|
14048
|
-
attribute = this.attribute,
|
|
14055
|
+
_this$attribute$wrap2 = this.attribute.wrap,
|
|
14056
|
+
wrap = _this$attribute$wrap2 === void 0 ? textTheme.wrap : _this$attribute$wrap2;
|
|
14057
|
+
if (wrap) return this.updateWrapAABBBounds(text);
|
|
14058
|
+
var attribute = this.attribute,
|
|
14049
14059
|
_attribute$fontFamily3 = attribute.fontFamily,
|
|
14050
14060
|
fontFamily = _attribute$fontFamily3 === void 0 ? textTheme.fontFamily : _attribute$fontFamily3,
|
|
14051
14061
|
_attribute$textAlign3 = attribute.textAlign,
|
|
@@ -14232,9 +14242,11 @@
|
|
|
14232
14242
|
var WrapText = /*#__PURE__*/function (_Text) {
|
|
14233
14243
|
_inherits(WrapText, _Text);
|
|
14234
14244
|
var _super = _createSuper(WrapText);
|
|
14235
|
-
function WrapText() {
|
|
14245
|
+
function WrapText(params) {
|
|
14236
14246
|
_classCallCheck(this, WrapText);
|
|
14237
|
-
return _super.
|
|
14247
|
+
return _super.call(this, Object.assign(Object.assign({}, params), {
|
|
14248
|
+
wrap: !0
|
|
14249
|
+
}));
|
|
14238
14250
|
}
|
|
14239
14251
|
_createClass(WrapText, [{
|
|
14240
14252
|
key: "_isValid",
|
|
@@ -20266,7 +20278,7 @@
|
|
|
20266
20278
|
if (context.beginPath(), keepDirIn3d && context.camera && context.project) {
|
|
20267
20279
|
var p = context.project(x, y, z),
|
|
20268
20280
|
camera = context.camera;
|
|
20269
|
-
context.camera = null, !1 === parsedPath.draw(context, size, p.x, p.y, void 0, function (p, a) {
|
|
20281
|
+
context.camera = null, !1 === parsedPath.draw(context, isArray$1(size) ? [size[0] * scaleX, size[1] * scaleY] : size * scaleX, p.x, p.y, void 0, function (p, a) {
|
|
20270
20282
|
var _a, _b, _c;
|
|
20271
20283
|
if (symbol._parsedPath.svgCache) {
|
|
20272
20284
|
var obj = Object.assign({}, a);
|
|
@@ -22891,6 +22903,8 @@
|
|
|
22891
22903
|
key: "tryLayout",
|
|
22892
22904
|
value: function tryLayout(graphic) {
|
|
22893
22905
|
var _this = this;
|
|
22906
|
+
if (this.layouting) return;
|
|
22907
|
+
this.layouting = !0;
|
|
22894
22908
|
var p = graphic.parent;
|
|
22895
22909
|
if (!p || !graphic.needUpdateLayout()) return;
|
|
22896
22910
|
var theme = getTheme(p).group,
|
|
@@ -23017,7 +23031,7 @@
|
|
|
23017
23031
|
}
|
|
23018
23032
|
children.forEach(function (child, idx) {
|
|
23019
23033
|
child.addUpdateBoundTag(), child.addUpdatePositionTag(), child.clearUpdateLayoutTag();
|
|
23020
|
-
}), p.addUpdateLayoutTag(), clip || this.tempBounds.equals(p.AABBBounds) || this.tryLayout(p);
|
|
23034
|
+
}), p.addUpdateLayoutTag(), clip || this.tempBounds.equals(p.AABBBounds) || (this.tryLayout(p), this.layouting = !1);
|
|
23021
23035
|
}
|
|
23022
23036
|
}, {
|
|
23023
23037
|
key: "layoutMain",
|
|
@@ -23038,33 +23052,38 @@
|
|
|
23038
23052
|
var _pos3 = padding;
|
|
23039
23053
|
for (var _i3 = lastIdx; _i3 <= currSeg.idx; _i3++) children[_i3].attribute[main.field] = _pos3 + getPadding(children[_i3], main.field), _pos3 += mianLenArray[_i3].mainLen + 2 * padding;
|
|
23040
23054
|
}
|
|
23041
|
-
} else if ("space-between" === justifyContent)
|
|
23042
|
-
|
|
23043
|
-
|
|
23044
|
-
|
|
23045
|
-
|
|
23046
|
-
|
|
23047
|
-
|
|
23048
|
-
|
|
23055
|
+
} else if ("space-between" === justifyContent) {
|
|
23056
|
+
if (currSeg.mainLen >= main.len) {
|
|
23057
|
+
var _pos4 = 0;
|
|
23058
|
+
for (var _i4 = lastIdx; _i4 <= currSeg.idx; _i4++) children[_i4].attribute[main.field] = _pos4 + getPadding(children[_i4], main.field), _pos4 += mianLenArray[_i4].mainLen;
|
|
23059
|
+
} else {
|
|
23060
|
+
var _size = currSeg.idx - lastIdx + 1,
|
|
23061
|
+
_padding2 = (main.len - currSeg.mainLen) / (2 * _size - 2);
|
|
23062
|
+
var _pos5 = 0;
|
|
23063
|
+
for (var _i5 = lastIdx; _i5 <= currSeg.idx; _i5++) children[_i5].attribute[main.field] = _pos5 + getPadding(children[_i5], main.field), _pos5 += mianLenArray[_i5].mainLen + 2 * _padding2;
|
|
23064
|
+
}
|
|
23065
|
+
} else if ("center" === justifyContent) {
|
|
23066
|
+
var _pos6 = (main.len - currSeg.mainLen) / 2;
|
|
23067
|
+
for (var _i6 = lastIdx; _i6 <= currSeg.idx; _i6++) children[_i6].attribute[main.field] = _pos6 + getPadding(children[_i6], main.field), _pos6 += mianLenArray[_i6].mainLen;
|
|
23049
23068
|
}
|
|
23050
23069
|
}
|
|
23051
23070
|
}, {
|
|
23052
23071
|
key: "layoutCross",
|
|
23053
23072
|
value: function layoutCross(children, alignItem, cross, anchorPos, lenArray, currSeg, lastIdx) {
|
|
23054
|
-
if ("flex-end" === alignItem) for (var i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos - lenArray[i].crossLen + getPadding(children[i], cross.field);else if ("center" === alignItem) for (var
|
|
23073
|
+
if ("flex-end" === alignItem) for (var i = lastIdx; i <= currSeg.idx; i++) children[i].attribute[cross.field] = anchorPos - lenArray[i].crossLen + getPadding(children[i], cross.field);else if ("center" === alignItem) for (var _i7 = lastIdx; _i7 <= currSeg.idx; _i7++) children[_i7].attribute[cross.field] = anchorPos - lenArray[_i7].crossLen / 2 + getPadding(children[_i7], cross.field);else for (var _i8 = lastIdx; _i8 <= currSeg.idx; _i8++) children[_i8].attribute[cross.field] = anchorPos + getPadding(children[_i8], cross.field);
|
|
23055
23074
|
}
|
|
23056
23075
|
}, {
|
|
23057
23076
|
key: "activate",
|
|
23058
23077
|
value: function activate(context) {
|
|
23059
23078
|
var _this2 = this;
|
|
23060
23079
|
this.pluginService = context, application.graphicService.hooks.onAttributeUpdate.tap(this.key, function (graphic) {
|
|
23061
|
-
graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic);
|
|
23080
|
+
graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic), _this2.layouting = !1;
|
|
23062
23081
|
}), application.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key, function (graphic, stage, willUpdate, bounds) {
|
|
23063
|
-
graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === _this2.pluginService.stage &&
|
|
23082
|
+
graphic.glyphHost && (graphic = graphic.glyphHost), stage && stage === _this2.pluginService.stage && graphic.isContainer && _tempBounds.copy(bounds);
|
|
23064
23083
|
}), application.graphicService.hooks.afterUpdateAABBBounds.tap(this.key, function (graphic, stage, bounds, params, selfChange) {
|
|
23065
|
-
stage && stage === _this2.pluginService.stage &&
|
|
23084
|
+
stage && stage === _this2.pluginService.stage && graphic.isContainer && (_tempBounds.equals(bounds) || (_this2.tryLayout(graphic), _this2.layouting = !1));
|
|
23066
23085
|
}), application.graphicService.hooks.onSetStage.tap(this.key, function (graphic) {
|
|
23067
|
-
graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic);
|
|
23086
|
+
graphic.glyphHost && (graphic = graphic.glyphHost), _this2.tryLayout(graphic), _this2.layouting = !1;
|
|
23068
23087
|
});
|
|
23069
23088
|
}
|
|
23070
23089
|
}, {
|
|
@@ -34327,7 +34346,7 @@
|
|
|
34327
34346
|
|
|
34328
34347
|
var roughModule = _roughModule;
|
|
34329
34348
|
|
|
34330
|
-
const version = "0.17.
|
|
34349
|
+
const version = "0.17.5-alpha.1";
|
|
34331
34350
|
if (isBrowserEnv()) {
|
|
34332
34351
|
loadBrowserEnv(container);
|
|
34333
34352
|
}
|