@visactor/vrender 0.18.7-alpha.1 → 0.18.8
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 +10 -11
- package/cjs/index.js.map +1 -1
- package/dist/index.js +49 -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 +3 -3
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -21,14 +21,13 @@ 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.
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
(0, vrender_kits_2.
|
|
28
|
-
(0, vrender_kits_2.
|
|
29
|
-
(0, vrender_kits_2.
|
|
30
|
-
(0, vrender_kits_2.
|
|
31
|
-
|
|
32
|
-
(0, vrender_kits_2.
|
|
33
|
-
(
|
|
34
|
-
__exportStar(require("@visactor/vrender-kits"), exports);
|
|
24
|
+
exports.version = "0.18.8", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
|
|
25
|
+
vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0, vrender_core_1.isNodeEnv)() && (0,
|
|
26
|
+
vrender_kits_1.loadNodeEnv)(vrender_core_1.container), (0, vrender_kits_2.registerArc)(),
|
|
27
|
+
(0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(), (0, vrender_kits_2.registerCircle)(),
|
|
28
|
+
(0, vrender_kits_2.registerGlyph)(), (0, vrender_kits_2.registerGroup)(), (0, vrender_kits_2.registerImage)(),
|
|
29
|
+
(0, vrender_kits_2.registerLine)(), (0, vrender_kits_2.registerPath)(), (0, vrender_kits_2.registerPolygon)(),
|
|
30
|
+
(0, vrender_kits_2.registerPyramid3d)(), (0, vrender_kits_2.registerRect)(), (0,
|
|
31
|
+
vrender_kits_2.registerRect3d)(), (0, vrender_kits_2.registerRichtext)(), (0, vrender_kits_2.registerShadowRoot)(),
|
|
32
|
+
(0, vrender_kits_2.registerSymbol)(), (0, vrender_kits_2.registerText)(), (0, vrender_kits_2.registerWrapText)(),
|
|
33
|
+
__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,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,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.8\";\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
|
@@ -7989,12 +7989,16 @@
|
|
|
7989
7989
|
}, {
|
|
7990
7990
|
key: "mapToCanvasPoint",
|
|
7991
7991
|
value: function mapToCanvasPoint(nativeEvent) {
|
|
7992
|
-
var _a;
|
|
7992
|
+
var _a, _b;
|
|
7993
7993
|
var point = null === (_a = this.globalObj) || void 0 === _a ? void 0 : _a.mapToCanvasPoint(nativeEvent, this.domElement);
|
|
7994
7994
|
if (point) return point;
|
|
7995
|
-
var x =
|
|
7996
|
-
y =
|
|
7997
|
-
|
|
7995
|
+
var x = 0,
|
|
7996
|
+
y = 0;
|
|
7997
|
+
if (nativeEvent.changedTouches) {
|
|
7998
|
+
var data = null !== (_b = nativeEvent.changedTouches[0]) && void 0 !== _b ? _b : {};
|
|
7999
|
+
x = data.clientX || 0, y = data.clientY || 0;
|
|
8000
|
+
} else x = nativeEvent.clientX || 0, y = nativeEvent.clientY || 0;
|
|
8001
|
+
var rect = this.domElement.getBoundingClientRect();
|
|
7998
8002
|
return {
|
|
7999
8003
|
x: x - rect.left,
|
|
8000
8004
|
y: y - rect.top
|
|
@@ -11472,6 +11476,7 @@
|
|
|
11472
11476
|
}, {
|
|
11473
11477
|
key: "loading",
|
|
11474
11478
|
value: function loading() {
|
|
11479
|
+
var _this = this;
|
|
11475
11480
|
setTimeout(function () {
|
|
11476
11481
|
if (!ResourceLoader.isLoading && ResourceLoader.toLoadAueue.length) {
|
|
11477
11482
|
ResourceLoader.isLoading = !0;
|
|
@@ -11497,9 +11502,13 @@
|
|
|
11497
11502
|
return mark.imageLoadFail(url);
|
|
11498
11503
|
});
|
|
11499
11504
|
}), Promise.all(promises).then(function () {
|
|
11500
|
-
ResourceLoader.isLoading = !1,
|
|
11505
|
+
ResourceLoader.isLoading = !1, _this.onLoadSuccessCb.forEach(function (cb) {
|
|
11506
|
+
return cb();
|
|
11507
|
+
}), ResourceLoader.loading();
|
|
11501
11508
|
})["catch"](function (error) {
|
|
11502
|
-
console.error(error), ResourceLoader.isLoading = !1,
|
|
11509
|
+
console.error(error), ResourceLoader.isLoading = !1, _this.onLoadSuccessCb.forEach(function (cb) {
|
|
11510
|
+
return cb();
|
|
11511
|
+
}), ResourceLoader.loading();
|
|
11503
11512
|
});
|
|
11504
11513
|
}
|
|
11505
11514
|
}, 0);
|
|
@@ -11523,6 +11532,11 @@
|
|
|
11523
11532
|
ResourceLoader.toLoadAueue.unshift(elememt[0]);
|
|
11524
11533
|
}
|
|
11525
11534
|
}
|
|
11535
|
+
}, {
|
|
11536
|
+
key: "onLoadSuccess",
|
|
11537
|
+
value: function onLoadSuccess(cb) {
|
|
11538
|
+
this.onLoadSuccessCb.push(cb);
|
|
11539
|
+
}
|
|
11526
11540
|
}]);
|
|
11527
11541
|
return ResourceLoader;
|
|
11528
11542
|
}();
|
|
@@ -11530,7 +11544,7 @@
|
|
|
11530
11544
|
for (var i = 0; i < arr.length; i++) if (arr[i].url === url) return i;
|
|
11531
11545
|
return -1;
|
|
11532
11546
|
}
|
|
11533
|
-
ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [];
|
|
11547
|
+
ResourceLoader.cache = new Map(), ResourceLoader.isLoading = !1, ResourceLoader.toLoadAueue = [], ResourceLoader.onLoadSuccessCb = [];
|
|
11534
11548
|
|
|
11535
11549
|
var tempMatrix = new Matrix(),
|
|
11536
11550
|
tempBounds$1 = new AABBBounds();
|
|
@@ -13371,6 +13385,10 @@
|
|
|
13371
13385
|
strokeOpacity = _graphic$attribute$st2 === void 0 ? themeAttributes.strokeOpacity : _graphic$attribute$st2,
|
|
13372
13386
|
_graphic$attribute$vi = _graphic$attribute.visible,
|
|
13373
13387
|
visible = _graphic$attribute$vi === void 0 ? themeAttributes.visible : _graphic$attribute$vi,
|
|
13388
|
+
_graphic$attribute$x = _graphic$attribute.x,
|
|
13389
|
+
originX = _graphic$attribute$x === void 0 ? themeAttributes.x : _graphic$attribute$x,
|
|
13390
|
+
_graphic$attribute$y = _graphic$attribute.y,
|
|
13391
|
+
originY = _graphic$attribute$y === void 0 ? themeAttributes.y : _graphic$attribute$y,
|
|
13374
13392
|
fVisible = fillVisible(opacity, fillOpacity, fill),
|
|
13375
13393
|
sVisible = strokeVisible(opacity, strokeOpacity),
|
|
13376
13394
|
doFill = runFill(fill),
|
|
@@ -13380,7 +13398,7 @@
|
|
|
13380
13398
|
if (!(fVisible || sVisible || fillCb || strokeCb)) return !0;
|
|
13381
13399
|
context.beginPath();
|
|
13382
13400
|
var path = "function" == typeof graphic.pathProxy ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
|
|
13383
|
-
return renderCommandList(path.commandList, context, x, y), context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes), doStroke && (strokeCb ? strokeCb(context, graphic.attribute, themeAttributes) : sVisible && (context.setStrokeStyle(graphic, graphic.attribute, x, y, themeAttributes), context.stroke())), doFill && (fillCb ? fillCb(context, graphic.attribute, themeAttributes) : fVisible && (context.setCommonStyle(graphic, graphic.attribute, x, y, themeAttributes), context.fill())), !0;
|
|
13401
|
+
return renderCommandList(path.commandList, context, x, y), context.setShadowBlendStyle && context.setShadowBlendStyle(graphic, graphic.attribute, themeAttributes), doStroke && (strokeCb ? strokeCb(context, graphic.attribute, themeAttributes) : sVisible && (context.setStrokeStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes), context.stroke())), doFill && (fillCb ? fillCb(context, graphic.attribute, themeAttributes) : fVisible && (context.setCommonStyle(graphic, graphic.attribute, x - originX, y - originY, themeAttributes), context.fill())), !0;
|
|
13384
13402
|
}
|
|
13385
13403
|
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
13386
13404
|
var x10 = x1 - x0,
|
|
@@ -20573,7 +20591,9 @@
|
|
|
20573
20591
|
var endSeg = segments[segments.length - 1];
|
|
20574
20592
|
startP = segments[0].points[0], endP = endSeg.points[endSeg.points.length - 1];
|
|
20575
20593
|
} else startP = points[0], endP = points[points.length - 1];
|
|
20576
|
-
|
|
20594
|
+
var xTotalLength = abs(endP.x - startP.x),
|
|
20595
|
+
yTotalLength = abs(endP.y - startP.y);
|
|
20596
|
+
direction = Number.isFinite(xTotalLength + yTotalLength) ? xTotalLength > yTotalLength ? exports.Direction.ROW : exports.Direction.COLUMN : exports.Direction.ROW, drawAreaSegments(context.camera ? context : context.nativeContext, cache, clipRange, {
|
|
20577
20597
|
offsetX: offsetX,
|
|
20578
20598
|
offsetY: offsetY,
|
|
20579
20599
|
offsetZ: offsetZ,
|
|
@@ -21026,7 +21046,7 @@
|
|
|
21026
21046
|
doStroke && (strokeCb ? strokeCb(context, text.attribute, textAttribute) : sVisible && (context.setStrokeStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(function (line) {
|
|
21027
21047
|
context.strokeText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z);
|
|
21028
21048
|
}))), doFill && (fillCb ? fillCb(context, text.attribute, textAttribute) : fVisible && (context.setCommonStyle(text, text.attribute, originX - x, originY - y, textAttribute), multilineLayout.lines.forEach(function (line) {
|
|
21029
|
-
context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), _this2.drawMultiUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY("bottom", fontSize) - .05 * fontSize, z, line.width, textAttribute, context);
|
|
21049
|
+
context.fillText(line.str, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y, z), _this2.drawMultiUnderLine(underline, lineThrough, text, (line.leftOffset || 0) + xOffset + x, (line.topOffset || 0) + yOffset + y - textDrawOffsetY("bottom", fontSize) - .05 * fontSize, z, line.width, textAttribute, context);
|
|
21030
21050
|
})));
|
|
21031
21051
|
} else {
|
|
21032
21052
|
text.tryUpdateAABBBounds();
|
|
@@ -21138,8 +21158,6 @@
|
|
|
21138
21158
|
value: function drawMultiUnderLine(underline, lineThrough, text, x, y, z, w, textAttribute, context) {
|
|
21139
21159
|
if (lineThrough + underline <= 0) return;
|
|
21140
21160
|
var _text$attribute4 = text.attribute,
|
|
21141
|
-
_text$attribute4$text = _text$attribute4.textAlign,
|
|
21142
|
-
textAlign = _text$attribute4$text === void 0 ? textAttribute.textAlign : _text$attribute4$text,
|
|
21143
21161
|
_text$attribute4$font = _text$attribute4.fontSize,
|
|
21144
21162
|
fontSize = _text$attribute4$font === void 0 ? textAttribute.fontSize : _text$attribute4$font,
|
|
21145
21163
|
_text$attribute4$fill = _text$attribute4.fill,
|
|
@@ -21152,7 +21170,6 @@
|
|
|
21152
21170
|
underlineDash = _text$attribute4$unde2 === void 0 ? textAttribute.underlineDash : _text$attribute4$unde2,
|
|
21153
21171
|
_text$attribute4$fill2 = _text$attribute4.fillOpacity,
|
|
21154
21172
|
fillOpacity = _text$attribute4$fill2 === void 0 ? textAttribute.fillOpacity : _text$attribute4$fill2,
|
|
21155
|
-
offsetX = textDrawOffsetX(textAlign, w),
|
|
21156
21173
|
offsetY = textLayoutOffsetY("alphabetic", fontSize, fontSize),
|
|
21157
21174
|
attribute = {
|
|
21158
21175
|
lineWidth: 0,
|
|
@@ -21164,12 +21181,12 @@
|
|
|
21164
21181
|
if (underline) {
|
|
21165
21182
|
attribute.lineWidth = underline, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.setLineDash(underlineDash), context.beginPath();
|
|
21166
21183
|
var dy = y + offsetY + fontSize + deltaY + underlineOffset;
|
|
21167
|
-
context.moveTo(x +
|
|
21184
|
+
context.moveTo(x + 0, dy, z), context.lineTo(x + 0 + w, dy, z), context.stroke();
|
|
21168
21185
|
}
|
|
21169
21186
|
if (deltaY = -1, lineThrough) {
|
|
21170
21187
|
attribute.lineWidth = lineThrough, context.setStrokeStyle(text, attribute, x, y, textAttribute), context.beginPath();
|
|
21171
21188
|
var _dy2 = y + offsetY + fontSize / 2 + deltaY;
|
|
21172
|
-
context.moveTo(x +
|
|
21189
|
+
context.moveTo(x + 0, _dy2, z), context.lineTo(x + 0 + w, _dy2, z), context.stroke();
|
|
21173
21190
|
}
|
|
21174
21191
|
}
|
|
21175
21192
|
}]);
|
|
@@ -30848,7 +30865,8 @@
|
|
|
30848
30865
|
}, {
|
|
30849
30866
|
key: "getStyle",
|
|
30850
30867
|
value: function getStyle() {
|
|
30851
|
-
|
|
30868
|
+
var _a;
|
|
30869
|
+
return null !== (_a = this.canvas.nativeCanvas.style) && void 0 !== _a ? _a : {};
|
|
30852
30870
|
}
|
|
30853
30871
|
}, {
|
|
30854
30872
|
key: "setStyle",
|
|
@@ -30993,12 +31011,20 @@
|
|
|
30993
31011
|
_createClass(BrowserEnvContribution, [{
|
|
30994
31012
|
key: "mapToCanvasPoint",
|
|
30995
31013
|
value: function mapToCanvasPoint(nativeEvent, domElement) {
|
|
30996
|
-
var _a;
|
|
31014
|
+
var _a, _b;
|
|
31015
|
+
var clientX = 0,
|
|
31016
|
+
clientY = 0,
|
|
31017
|
+
offsetX = 0,
|
|
31018
|
+
offsetY = 0;
|
|
31019
|
+
if (nativeEvent.changedTouches) {
|
|
31020
|
+
var data = null !== (_a = nativeEvent.changedTouches[0]) && void 0 !== _a ? _a : {};
|
|
31021
|
+
clientX = data.clientX || 0, clientY = data.clientY || 0, offsetX = clientX, offsetY = clientY;
|
|
31022
|
+
} else clientX = nativeEvent.clientX || 0, clientY = nativeEvent.clientY || 0, offsetX = nativeEvent.offsetX || 0, offsetY = nativeEvent.offsetY || 0;
|
|
30997
31023
|
if (domElement) {
|
|
30998
|
-
var x =
|
|
30999
|
-
y =
|
|
31024
|
+
var x = clientX,
|
|
31025
|
+
y = clientY,
|
|
31000
31026
|
rect = domElement.getBoundingClientRect(),
|
|
31001
|
-
nativeCanvas = null === (
|
|
31027
|
+
nativeCanvas = null === (_b = domElement.getNativeHandler) || void 0 === _b ? void 0 : _b.call(domElement).nativeCanvas;
|
|
31002
31028
|
var scaleX, scaleY;
|
|
31003
31029
|
return nativeCanvas && (scaleX = rect.width / nativeCanvas.offsetWidth, scaleY = rect.height / nativeCanvas.offsetHeight), {
|
|
31004
31030
|
x: (x - rect.left) / (isValidNumber$1(scaleX) ? scaleX : 1),
|
|
@@ -31006,8 +31032,8 @@
|
|
|
31006
31032
|
};
|
|
31007
31033
|
}
|
|
31008
31034
|
return {
|
|
31009
|
-
x:
|
|
31010
|
-
y:
|
|
31035
|
+
x: offsetX,
|
|
31036
|
+
y: offsetY
|
|
31011
31037
|
};
|
|
31012
31038
|
}
|
|
31013
31039
|
}, {
|
|
@@ -35336,7 +35362,7 @@
|
|
|
35336
35362
|
|
|
35337
35363
|
var roughModule = _roughModule;
|
|
35338
35364
|
|
|
35339
|
-
const version = "0.18.
|
|
35365
|
+
const version = "0.18.8";
|
|
35340
35366
|
preLoadAllModule();
|
|
35341
35367
|
if (isBrowserEnv()) {
|
|
35342
35368
|
loadBrowserEnv(container);
|