@visactor/vrender 0.18.0-alpha.1 → 0.18.0-alpha.3
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 +53 -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 +3 -3
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.18.0-alpha.
|
|
24
|
+
exports.version = "0.18.0-alpha.3", (0, vrender_core_1.preLoadAllModule)(), (0,
|
|
25
25
|
vrender_core_1.isBrowserEnv)() ? (0, vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0,
|
|
26
26
|
vrender_core_1.isNodeEnv)() && (0, vrender_kits_1.loadNodeEnv)(vrender_core_1.container),
|
|
27
27
|
(0, vrender_kits_2.registerArc)(), (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,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 '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } 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.18.0-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,gBAAgB,CAAC;AAExC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,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 '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } 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.18.0-alpha.3\";\n\npreLoadAllModule();\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
|
@@ -5293,7 +5293,7 @@
|
|
|
5293
5293
|
strokeBoundsBuffer: 0,
|
|
5294
5294
|
keepDirIn3d: !0
|
|
5295
5295
|
});
|
|
5296
|
-
var DefaultRichTextAttribute = Object.assign(Object.assign(
|
|
5296
|
+
var DefaultRichTextAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
|
|
5297
5297
|
width: 300,
|
|
5298
5298
|
height: 300,
|
|
5299
5299
|
ellipsis: !0,
|
|
@@ -16555,47 +16555,28 @@
|
|
|
16555
16555
|
value: function getFrameCache() {
|
|
16556
16556
|
return this.shouldUpdateShape() && (this.doUpdateFrameCache(), this.clearUpdateShapeTag()), this._frameCache;
|
|
16557
16557
|
}
|
|
16558
|
-
}, {
|
|
16559
|
-
key: "combinedStyleToCharacter",
|
|
16560
|
-
value: function combinedStyleToCharacter(config) {
|
|
16561
|
-
var _this$attribute = this.attribute,
|
|
16562
|
-
fill = _this$attribute.fill,
|
|
16563
|
-
stroke = _this$attribute.stroke,
|
|
16564
|
-
fontSize = _this$attribute.fontSize,
|
|
16565
|
-
fontFamily = _this$attribute.fontFamily,
|
|
16566
|
-
fontStyle = _this$attribute.fontStyle,
|
|
16567
|
-
fontWeight = _this$attribute.fontWeight;
|
|
16568
|
-
return Object.assign({
|
|
16569
|
-
fill: fill,
|
|
16570
|
-
stroke: stroke,
|
|
16571
|
-
fontSize: fontSize,
|
|
16572
|
-
fontFamily: fontFamily,
|
|
16573
|
-
fontStyle: fontStyle,
|
|
16574
|
-
fontWeight: fontWeight
|
|
16575
|
-
}, config);
|
|
16576
|
-
}
|
|
16577
16558
|
}, {
|
|
16578
16559
|
key: "doUpdateFrameCache",
|
|
16579
16560
|
value: function doUpdateFrameCache() {
|
|
16580
16561
|
var _this2 = this;
|
|
16581
16562
|
var _a;
|
|
16582
|
-
var _this$
|
|
16583
|
-
_this$
|
|
16584
|
-
textConfig = _this$
|
|
16585
|
-
maxWidth = _this$
|
|
16586
|
-
maxHeight = _this$
|
|
16587
|
-
width = _this$
|
|
16588
|
-
height = _this$
|
|
16589
|
-
ellipsis = _this$
|
|
16590
|
-
wordBreak = _this$
|
|
16591
|
-
verticalDirection = _this$
|
|
16592
|
-
textAlign = _this$
|
|
16593
|
-
textBaseline = _this$
|
|
16594
|
-
layoutDirection = _this$
|
|
16595
|
-
singleLine = _this$
|
|
16563
|
+
var _this$attribute = this.attribute,
|
|
16564
|
+
_this$attribute$textC = _this$attribute.textConfig,
|
|
16565
|
+
textConfig = _this$attribute$textC === void 0 ? [] : _this$attribute$textC,
|
|
16566
|
+
maxWidth = _this$attribute.maxWidth,
|
|
16567
|
+
maxHeight = _this$attribute.maxHeight,
|
|
16568
|
+
width = _this$attribute.width,
|
|
16569
|
+
height = _this$attribute.height,
|
|
16570
|
+
ellipsis = _this$attribute.ellipsis,
|
|
16571
|
+
wordBreak = _this$attribute.wordBreak,
|
|
16572
|
+
verticalDirection = _this$attribute.verticalDirection,
|
|
16573
|
+
textAlign = _this$attribute.textAlign,
|
|
16574
|
+
textBaseline = _this$attribute.textBaseline,
|
|
16575
|
+
layoutDirection = _this$attribute.layoutDirection,
|
|
16576
|
+
singleLine = _this$attribute.singleLine,
|
|
16596
16577
|
paragraphs = [];
|
|
16597
16578
|
for (var i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
|
|
16598
|
-
var config =
|
|
16579
|
+
var config = textConfig[i],
|
|
16599
16580
|
iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
|
|
16600
16581
|
if (iconCache) paragraphs.push(iconCache);else {
|
|
16601
16582
|
var icon = new RichTextIcon(config);
|
|
@@ -16605,7 +16586,7 @@
|
|
|
16605
16586
|
}, icon.richtextId = config.id, paragraphs.push(icon);
|
|
16606
16587
|
}
|
|
16607
16588
|
} else {
|
|
16608
|
-
var richTextConfig =
|
|
16589
|
+
var richTextConfig = textConfig[i];
|
|
16609
16590
|
if (isNumber$1(richTextConfig.text) && (richTextConfig.text = "".concat(richTextConfig.text)), richTextConfig.text && richTextConfig.text.includes("\n")) {
|
|
16610
16591
|
var textParts = richTextConfig.text.split("\n");
|
|
16611
16592
|
for (var j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig));
|
|
@@ -20269,10 +20250,9 @@
|
|
|
20269
20250
|
key: "drawLinearAreaHighPerformance",
|
|
20270
20251
|
value: function drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
|
|
20271
20252
|
var _a, _b, _c, _d, _e;
|
|
20272
|
-
var points = area.attribute.points;
|
|
20273
|
-
if (points.length < 2) return;
|
|
20274
20253
|
context.beginPath();
|
|
20275
20254
|
var z = null !== (_a = this.z) && void 0 !== _a ? _a : 0,
|
|
20255
|
+
points = area.attribute.points,
|
|
20276
20256
|
startP = points[0];
|
|
20277
20257
|
context.moveTo(startP.x + offsetX, startP.y + offsetY, z);
|
|
20278
20258
|
for (var i = 1; i < points.length; i++) {
|
|
@@ -20449,7 +20429,6 @@
|
|
|
20449
20429
|
key: "_drawSegmentItem",
|
|
20450
20430
|
value: function _drawSegmentItem(context, cache, fill, fillOpacity, stroke, strokeOpacity, attribute, defaultAttribute, clipRange, offsetX, offsetY, offsetZ, area, drawContext, connect, fillCb, strokeCb) {
|
|
20451
20431
|
var _a, _b, _c, _d;
|
|
20452
|
-
if (!(cache && cache.top && cache.bottom && cache.top.curves && cache.top.curves.length && cache.bottom.curves && cache.bottom.curves.length)) return;
|
|
20453
20432
|
var connectedType = attribute.connectedType,
|
|
20454
20433
|
connectedX = attribute.connectedX,
|
|
20455
20434
|
connectedY = attribute.connectedY,
|
|
@@ -20458,6 +20437,7 @@
|
|
|
20458
20437
|
if (connect && (isArray$1(defaultAttribute) ? (connectedType = null !== (_a = null != connectedType ? connectedType : defaultAttribute[0].connectedType) && void 0 !== _a ? _a : defaultAttribute[1].connectedType, connectedX = null !== (_b = null != connectedX ? connectedX : defaultAttribute[0].connectedX) && void 0 !== _b ? _b : defaultAttribute[1].connectedX, connectedY = null !== (_c = null != connectedY ? connectedY : defaultAttribute[0].connectedY) && void 0 !== _c ? _c : defaultAttribute[1].connectedY, connectedStyle = null !== (_d = null != connectedStyle ? connectedStyle : defaultAttribute[0].connectedStyle) && void 0 !== _d ? _d : defaultAttribute[1].connectedStyle) : (connectedType = null != connectedType ? connectedType : defaultAttribute.connectedType, connectedX = null != connectedX ? connectedX : defaultAttribute.connectedX, connectedY = null != connectedY ? connectedY : defaultAttribute.connectedY, connectedStyle = null != connectedStyle ? connectedStyle : defaultAttribute.connectedStyle), "connect" !== connectedType && "zero" !== connectedType && (connectedType = "none"), isArray$1(defaultAttribute) ? defaultAttribute.forEach(function (i) {
|
|
20459
20438
|
return da.push(i);
|
|
20460
20439
|
}) : da.push(defaultAttribute), da.push(attribute)), connect && "none" === connectedType) return !1;
|
|
20440
|
+
if (!cache) return;
|
|
20461
20441
|
context.beginPath();
|
|
20462
20442
|
var _area$attribute4 = area.attribute,
|
|
20463
20443
|
points = _area$attribute4.points,
|
|
@@ -25369,6 +25349,38 @@
|
|
|
25369
25349
|
}();
|
|
25370
25350
|
exports.DefaultGlobalPickerService = __decorate$12([injectable(), __metadata$O("design:paramtypes", [])], exports.DefaultGlobalPickerService);
|
|
25371
25351
|
|
|
25352
|
+
function simplifyRadialDist(points, sqTolerance) {
|
|
25353
|
+
var deltaX,
|
|
25354
|
+
deltaY,
|
|
25355
|
+
lastX = points[0].x,
|
|
25356
|
+
lastY = points[0].y;
|
|
25357
|
+
var newPoints = [points[0]];
|
|
25358
|
+
for (var i = 1, len = points.length; i < len; i++) deltaX = points[i].x - lastX, deltaY = points[i].y - lastY, deltaX * deltaX + deltaY * deltaY > sqTolerance && (lastX = points[i].x, lastY = points[i].y, newPoints.push(points[i]));
|
|
25359
|
+
return points[points.length - 1].x === lastX && points[points.length - 1].y === lastY || newPoints.push(points[points.length - 1]), newPoints;
|
|
25360
|
+
}
|
|
25361
|
+
function simplifyDPStep(points, startIdx, endIdx, sqTolerance, simplified) {
|
|
25362
|
+
var maxSqDist = sqTolerance,
|
|
25363
|
+
nextIdx = startIdx;
|
|
25364
|
+
var startX = points[startIdx].x,
|
|
25365
|
+
startY = points[startIdx].y,
|
|
25366
|
+
vecX2 = points[endIdx].x - startX,
|
|
25367
|
+
vecY2 = points[endIdx].y - startY,
|
|
25368
|
+
sqLength = vecX2 * vecX2 + vecY2 * vecY2;
|
|
25369
|
+
var area, sqArea, sqDistance, vecX1, vecY1;
|
|
25370
|
+
for (var i = startIdx + 1, len = endIdx - 1; i < len; i++) vecX1 = points[i].x - startX, vecY1 = points[i].y - startY, area = vecX1 * vecY2 - vecX2 * vecY1, sqArea = area * area, sqDistance = sqArea / sqLength, sqDistance > maxSqDist && (maxSqDist = sqDistance, nextIdx = i);
|
|
25371
|
+
maxSqDist > sqTolerance && (nextIdx - startIdx > 2 && simplifyDPStep(points, startIdx, nextIdx, sqTolerance, simplified), simplified.push(points[nextIdx], points[nextIdx + 1]), endIdx - nextIdx > 2 && simplifyDPStep(points, nextIdx, endIdx, sqTolerance, simplified));
|
|
25372
|
+
}
|
|
25373
|
+
function simplifyDouglasPeucker(points, sqTolerance) {
|
|
25374
|
+
var lastIdx = points.length - 1,
|
|
25375
|
+
simplified = [points[0]];
|
|
25376
|
+
return simplifyDPStep(points, 0, lastIdx, sqTolerance, simplified), simplified.push(points[lastIdx]), simplified;
|
|
25377
|
+
}
|
|
25378
|
+
function flatten_simplify(points, tolerance, highestQuality) {
|
|
25379
|
+
if (points.length <= 10) return points;
|
|
25380
|
+
var sqTolerance = void 0 !== tolerance ? tolerance * tolerance : 1;
|
|
25381
|
+
return points = simplifyDouglasPeucker(points = highestQuality ? points : simplifyRadialDist(points, sqTolerance), sqTolerance);
|
|
25382
|
+
}
|
|
25383
|
+
|
|
25372
25384
|
var DefaultGraphicAllocate = /*#__PURE__*/function () {
|
|
25373
25385
|
function DefaultGraphicAllocate() {
|
|
25374
25386
|
_classCallCheck(this, DefaultGraphicAllocate);
|
|
@@ -35060,7 +35072,7 @@
|
|
|
35060
35072
|
|
|
35061
35073
|
var roughModule = _roughModule;
|
|
35062
35074
|
|
|
35063
|
-
const version = "0.18.0-alpha.
|
|
35075
|
+
const version = "0.18.0-alpha.3";
|
|
35064
35076
|
preLoadAllModule();
|
|
35065
35077
|
if (isBrowserEnv()) {
|
|
35066
35078
|
loadBrowserEnv(container);
|
|
@@ -35435,6 +35447,7 @@
|
|
|
35435
35447
|
exports.fillVisible = fillVisible;
|
|
35436
35448
|
exports.findBestMorphingRotation = findBestMorphingRotation;
|
|
35437
35449
|
exports.findNextGraphic = findNextGraphic;
|
|
35450
|
+
exports.flatten_simplify = flatten_simplify;
|
|
35438
35451
|
exports.foreach = foreach;
|
|
35439
35452
|
exports.foreachAsync = foreachAsync;
|
|
35440
35453
|
exports.genBasisSegments = genBasisSegments;
|