@visactor/vrender 0.18.5 → 0.18.6
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 +161 -46
- 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.18.
|
|
24
|
+
exports.version = "0.18.6", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
|
|
25
25
|
vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0, vrender_core_1.isNodeEnv)() && (0,
|
|
26
26
|
vrender_kits_1.loadNodeEnv)(vrender_core_1.container), (0, vrender_kits_2.registerArc)(),
|
|
27
27
|
(0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(), (0, vrender_kits_2.registerCircle)(),
|
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,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.
|
|
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.6\";\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
|
@@ -5176,7 +5176,8 @@
|
|
|
5176
5176
|
backgroundFit: !0,
|
|
5177
5177
|
blur: 0,
|
|
5178
5178
|
cursor: null,
|
|
5179
|
-
html: null
|
|
5179
|
+
html: null,
|
|
5180
|
+
react: null
|
|
5180
5181
|
}, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle);
|
|
5181
5182
|
var DefaultConnectAttribute = {
|
|
5182
5183
|
connectedType: "none",
|
|
@@ -5410,7 +5411,7 @@
|
|
|
5410
5411
|
function applyStrokeStyle(ctx, character) {
|
|
5411
5412
|
var strokeStyle = character && character.stroke || defaultFormatting.stroke;
|
|
5412
5413
|
if (!strokeStyle) return void (ctx.globalAlpha = 0);
|
|
5413
|
-
ctx.globalAlpha = 1, ctx.lineWidth = character && "number" == typeof character.
|
|
5414
|
+
ctx.globalAlpha = 1, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle;
|
|
5414
5415
|
var fontSize = character.fontSize || 16;
|
|
5415
5416
|
switch (character.script) {
|
|
5416
5417
|
case "super":
|
|
@@ -6241,9 +6242,14 @@
|
|
|
6241
6242
|
var WindowHandlerContribution = Symbol["for"]("WindowHandlerContribution");
|
|
6242
6243
|
exports.DefaultWindow = /*#__PURE__*/function () {
|
|
6243
6244
|
function DefaultWindow() {
|
|
6245
|
+
var _this = this;
|
|
6244
6246
|
_classCallCheck(this, DefaultWindow);
|
|
6245
6247
|
this.hooks = {
|
|
6246
6248
|
onChange: new SyncHook(["x", "y", "width", "height"])
|
|
6249
|
+
}, this.active = function () {
|
|
6250
|
+
var global = _this.global;
|
|
6251
|
+
if (!global.env || _this.actived) return;
|
|
6252
|
+
container.getNamed(WindowHandlerContribution, global.env).configure(_this, global), _this.actived = !0;
|
|
6247
6253
|
}, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
|
|
6248
6254
|
}
|
|
6249
6255
|
_createClass(DefaultWindow, [{
|
|
@@ -6272,17 +6278,7 @@
|
|
|
6272
6278
|
}, {
|
|
6273
6279
|
key: "postInit",
|
|
6274
6280
|
value: function postInit() {
|
|
6275
|
-
|
|
6276
|
-
this.global.hooks.onSetEnv.tap("window", function () {
|
|
6277
|
-
_this.active();
|
|
6278
|
-
}), this.active();
|
|
6279
|
-
}
|
|
6280
|
-
}, {
|
|
6281
|
-
key: "active",
|
|
6282
|
-
value: function active() {
|
|
6283
|
-
var global = this.global;
|
|
6284
|
-
if (!global.env || this.actived) return;
|
|
6285
|
-
container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
|
|
6281
|
+
this.global.hooks.onSetEnv.tap("window", this.active), this.active();
|
|
6286
6282
|
}
|
|
6287
6283
|
}, {
|
|
6288
6284
|
key: "style",
|
|
@@ -6334,7 +6330,7 @@
|
|
|
6334
6330
|
}, {
|
|
6335
6331
|
key: "release",
|
|
6336
6332
|
value: function release() {
|
|
6337
|
-
return this._handler.releaseWindow();
|
|
6333
|
+
return this.global.hooks.onSetEnv.unTap("window", this.active), this._handler.releaseWindow();
|
|
6338
6334
|
}
|
|
6339
6335
|
}, {
|
|
6340
6336
|
key: "getContext",
|
|
@@ -7852,6 +7848,11 @@
|
|
|
7852
7848
|
var pickResult = this.rootTarget.pick(x, y);
|
|
7853
7849
|
return target = pickResult && pickResult.graphic ? pickResult.graphic : pickResult && pickResult.group ? pickResult.group : this.rootTarget.AABBBounds.contains(x, y) ? this.rootTarget : null, e && (e.pickParams = pickResult.params), target;
|
|
7854
7850
|
}
|
|
7851
|
+
}, {
|
|
7852
|
+
key: "release",
|
|
7853
|
+
value: function release() {
|
|
7854
|
+
this.dispatch.removeAllListeners(), this.eventPool.clear(), this.rootTarget = null, this.mappingTable = null, this.mappingState = null, this.cursorTarget = null;
|
|
7855
|
+
}
|
|
7855
7856
|
}]);
|
|
7856
7857
|
return EventManager;
|
|
7857
7858
|
}();
|
|
@@ -7943,7 +7944,7 @@
|
|
|
7943
7944
|
_createClass(EventSystem, [{
|
|
7944
7945
|
key: "release",
|
|
7945
7946
|
value: function release() {
|
|
7946
|
-
this.
|
|
7947
|
+
this.removeEvents(), this.manager && this.manager.release(), this.domElement = null, this.manager = null, this.globalObj = null;
|
|
7947
7948
|
}
|
|
7948
7949
|
}, {
|
|
7949
7950
|
key: "setCursor",
|
|
@@ -13312,6 +13313,11 @@
|
|
|
13312
13313
|
value: function restLayerCount(stage) {
|
|
13313
13314
|
return "browser" === this.global.env ? 10 : 0;
|
|
13314
13315
|
}
|
|
13316
|
+
}, {
|
|
13317
|
+
key: "releaseStage",
|
|
13318
|
+
value: function releaseStage(stage) {
|
|
13319
|
+
this.layerMap["delete"](stage);
|
|
13320
|
+
}
|
|
13315
13321
|
}], [{
|
|
13316
13322
|
key: "GenerateLayerId",
|
|
13317
13323
|
value: function GenerateLayerId() {
|
|
@@ -16623,14 +16629,16 @@
|
|
|
16623
16629
|
fontSize = _this$attribute.fontSize,
|
|
16624
16630
|
fontFamily = _this$attribute.fontFamily,
|
|
16625
16631
|
fontStyle = _this$attribute.fontStyle,
|
|
16626
|
-
fontWeight = _this$attribute.fontWeight
|
|
16632
|
+
fontWeight = _this$attribute.fontWeight,
|
|
16633
|
+
lineWidth = _this$attribute.lineWidth;
|
|
16627
16634
|
return Object.assign({
|
|
16628
16635
|
fill: fill,
|
|
16629
16636
|
stroke: stroke,
|
|
16630
16637
|
fontSize: fontSize,
|
|
16631
16638
|
fontFamily: fontFamily,
|
|
16632
16639
|
fontStyle: fontStyle,
|
|
16633
|
-
fontWeight: fontWeight
|
|
16640
|
+
fontWeight: fontWeight,
|
|
16641
|
+
lineWidth: lineWidth
|
|
16634
16642
|
}, config);
|
|
16635
16643
|
}
|
|
16636
16644
|
}, {
|
|
@@ -23309,7 +23317,7 @@
|
|
|
23309
23317
|
var HtmlAttributePlugin = /*#__PURE__*/function () {
|
|
23310
23318
|
function HtmlAttributePlugin() {
|
|
23311
23319
|
_classCallCheck(this, HtmlAttributePlugin);
|
|
23312
|
-
this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid;
|
|
23320
|
+
this.name = "HtmlAttributePlugin", this.activeEvent = "onRegister", this._uid = Generator.GenAutoIncrementId(), this.key = this.name + this._uid, this.lastDomContainerSet = new Set(), this.currentDomContainerSet = new Set();
|
|
23313
23321
|
}
|
|
23314
23322
|
_createClass(HtmlAttributePlugin, [{
|
|
23315
23323
|
key: "activate",
|
|
@@ -23329,18 +23337,20 @@
|
|
|
23329
23337
|
var _this2 = this;
|
|
23330
23338
|
context.stage.hooks.afterRender.taps = context.stage.hooks.afterRender.taps.filter(function (item) {
|
|
23331
23339
|
return item.name !== _this2.key;
|
|
23332
|
-
});
|
|
23340
|
+
}), application.graphicService.hooks.onRemove.unTap(this.key), application.graphicService.hooks.onRelease.unTap(this.key), this.release();
|
|
23333
23341
|
}
|
|
23334
23342
|
}, {
|
|
23335
23343
|
key: "drawHTML",
|
|
23336
23344
|
value: function drawHTML(renderService) {
|
|
23337
23345
|
var _this3 = this;
|
|
23338
|
-
"browser" === application.global.env && renderService.renderTreeRoots.sort(function (a, b) {
|
|
23346
|
+
"browser" === application.global.env && (renderService.renderTreeRoots.sort(function (a, b) {
|
|
23339
23347
|
var _a, _b;
|
|
23340
23348
|
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
23341
23349
|
}).forEach(function (group) {
|
|
23342
23350
|
_this3.renderGroupHTML(group);
|
|
23343
|
-
})
|
|
23351
|
+
}), this.lastDomContainerSet.forEach(function (item) {
|
|
23352
|
+
_this3.currentDomContainerSet.has(item) || item.parentElement && item.parentElement.removeChild(item);
|
|
23353
|
+
}), this.lastDomContainerSet = new Set(this.currentDomContainerSet), this.currentDomContainerSet.clear());
|
|
23344
23354
|
}
|
|
23345
23355
|
}, {
|
|
23346
23356
|
key: "renderGroupHTML",
|
|
@@ -23372,7 +23382,8 @@
|
|
|
23372
23382
|
height = html.height,
|
|
23373
23383
|
style = html.style,
|
|
23374
23384
|
_html$anchorType = html.anchorType,
|
|
23375
|
-
anchorType = _html$anchorType === void 0 ? "boundsLeftTop" : _html$anchorType
|
|
23385
|
+
anchorType = _html$anchorType === void 0 ? "boundsLeftTop" : _html$anchorType,
|
|
23386
|
+
pointerEvents = html.pointerEvents;
|
|
23376
23387
|
graphic.bindDom || (graphic.bindDom = new Map());
|
|
23377
23388
|
var lastDom = graphic.bindDom.get(dom);
|
|
23378
23389
|
var wrapGroup, nativeContainer;
|
|
@@ -23395,7 +23406,7 @@
|
|
|
23395
23406
|
wrapGroup: wrapGroup
|
|
23396
23407
|
}));
|
|
23397
23408
|
} else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
|
|
23398
|
-
wrapGroup.style.pointerEvents = "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
|
|
23409
|
+
wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
|
|
23399
23410
|
var left = 0,
|
|
23400
23411
|
top = 0;
|
|
23401
23412
|
var b = graphic.globalAABBBounds;
|
|
@@ -23407,7 +23418,20 @@
|
|
|
23407
23418
|
windowTL = stage.window.getTopLeft(!1),
|
|
23408
23419
|
offsetX = left + windowTL.left - containerTL.left,
|
|
23409
23420
|
offsetTop = top + windowTL.top - containerTL.top;
|
|
23410
|
-
wrapGroup.style.left = "".concat(offsetX, "px"), wrapGroup.style.top = "".concat(offsetTop, "px");
|
|
23421
|
+
wrapGroup.style.left = "".concat(offsetX, "px"), wrapGroup.style.top = "".concat(offsetTop, "px"), this.currentDomContainerSet.add(wrapGroup);
|
|
23422
|
+
}
|
|
23423
|
+
}, {
|
|
23424
|
+
key: "release",
|
|
23425
|
+
value: function release() {
|
|
23426
|
+
"browser" === application.global.env && (this.removeAllDom(this.pluginService.stage.defaultLayer), this.lastDomContainerSet.clear(), this.currentDomContainerSet.clear());
|
|
23427
|
+
}
|
|
23428
|
+
}, {
|
|
23429
|
+
key: "removeAllDom",
|
|
23430
|
+
value: function removeAllDom(g) {
|
|
23431
|
+
var _this5 = this;
|
|
23432
|
+
this.removeDom(g), g.forEachChildren(function (item) {
|
|
23433
|
+
item.isContainer && _this5.removeAllDom(g);
|
|
23434
|
+
});
|
|
23411
23435
|
}
|
|
23412
23436
|
}]);
|
|
23413
23437
|
return HtmlAttributePlugin;
|
|
@@ -23929,6 +23953,84 @@
|
|
|
23929
23953
|
return isBrowserEnv() ? "browser" : "node";
|
|
23930
23954
|
}
|
|
23931
23955
|
|
|
23956
|
+
var ReactAttributePlugin = /*#__PURE__*/function (_HtmlAttributePlugin) {
|
|
23957
|
+
_inherits(ReactAttributePlugin, _HtmlAttributePlugin);
|
|
23958
|
+
var _super = _createSuper(ReactAttributePlugin);
|
|
23959
|
+
function ReactAttributePlugin() {
|
|
23960
|
+
var _this;
|
|
23961
|
+
_classCallCheck(this, ReactAttributePlugin);
|
|
23962
|
+
_this = _super.apply(this, arguments), _this.name = "ReactAttributePlugin", _this.activeEvent = "onRegister", _this._uid = Generator.GenAutoIncrementId(), _this.key = _this.name + _this._uid;
|
|
23963
|
+
return _this;
|
|
23964
|
+
}
|
|
23965
|
+
_createClass(ReactAttributePlugin, [{
|
|
23966
|
+
key: "removeDom",
|
|
23967
|
+
value: function removeDom(graphic) {
|
|
23968
|
+
graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(function (item) {
|
|
23969
|
+
item.root && item.root.unmount();
|
|
23970
|
+
}), graphic.bindDom.clear());
|
|
23971
|
+
}
|
|
23972
|
+
}, {
|
|
23973
|
+
key: "renderGraphicHTML",
|
|
23974
|
+
value: function renderGraphicHTML(graphic) {
|
|
23975
|
+
var react = graphic.attribute.react;
|
|
23976
|
+
if (!react) return void (graphic.bindDom && graphic.bindDom.size && (graphic.bindDom.forEach(function (item) {
|
|
23977
|
+
item.root && item.root.unmount();
|
|
23978
|
+
}), graphic.bindDom.clear()));
|
|
23979
|
+
var stage = graphic.stage;
|
|
23980
|
+
if (!stage) return;
|
|
23981
|
+
var ReactDOM = stage.params.ReactDOM,
|
|
23982
|
+
element = react.element,
|
|
23983
|
+
container = react.container,
|
|
23984
|
+
width = react.width,
|
|
23985
|
+
height = react.height,
|
|
23986
|
+
style = react.style,
|
|
23987
|
+
_react$anchorType = react.anchorType,
|
|
23988
|
+
anchorType = _react$anchorType === void 0 ? "boundsLeftTop" : _react$anchorType,
|
|
23989
|
+
pointerEvents = react.pointerEvents;
|
|
23990
|
+
if (!(element && ReactDOM && ReactDOM.createRoot)) return;
|
|
23991
|
+
graphic.bindDom || (graphic.bindDom = new Map());
|
|
23992
|
+
var lastDom = graphic.bindDom.get(element);
|
|
23993
|
+
var wrapGroup, nativeContainer;
|
|
23994
|
+
if (!lastDom || container && container !== lastDom.container) {
|
|
23995
|
+
graphic.bindDom.forEach(function (_ref) {
|
|
23996
|
+
var wrapGroup = _ref.wrapGroup;
|
|
23997
|
+
application.global.removeDom(wrapGroup);
|
|
23998
|
+
});
|
|
23999
|
+
var _container = container;
|
|
24000
|
+
if (nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
|
|
24001
|
+
tagName: "div",
|
|
24002
|
+
width: width,
|
|
24003
|
+
height: height,
|
|
24004
|
+
style: style,
|
|
24005
|
+
parent: nativeContainer
|
|
24006
|
+
}), wrapGroup) {
|
|
24007
|
+
var root = ReactDOM.createRoot(wrapGroup);
|
|
24008
|
+
root.render(element), graphic.bindDom.set(element, {
|
|
24009
|
+
dom: element,
|
|
24010
|
+
container: container,
|
|
24011
|
+
wrapGroup: wrapGroup,
|
|
24012
|
+
root: root
|
|
24013
|
+
});
|
|
24014
|
+
}
|
|
24015
|
+
} else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
|
|
24016
|
+
wrapGroup.style.pointerEvents = pointerEvents || "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
|
|
24017
|
+
var left = 0,
|
|
24018
|
+
top = 0;
|
|
24019
|
+
var b = graphic.globalAABBBounds;
|
|
24020
|
+
if ("position" === anchorType || b.empty()) {
|
|
24021
|
+
var matrix = graphic.globalTransMatrix;
|
|
24022
|
+
left = matrix.e, top = matrix.f;
|
|
24023
|
+
} else left = b.x1, top = b.y1;
|
|
24024
|
+
var containerTL = application.global.getElementTopLeft(nativeContainer, !1),
|
|
24025
|
+
windowTL = stage.window.getTopLeft(!1),
|
|
24026
|
+
offsetX = left + windowTL.left - containerTL.left,
|
|
24027
|
+
offsetTop = top + windowTL.top - containerTL.top;
|
|
24028
|
+
wrapGroup.style.left = "".concat(offsetX, "px"), wrapGroup.style.top = "".concat(offsetTop, "px");
|
|
24029
|
+
}
|
|
24030
|
+
}]);
|
|
24031
|
+
return ReactAttributePlugin;
|
|
24032
|
+
}(HtmlAttributePlugin);
|
|
24033
|
+
|
|
23932
24034
|
var DefaultConfig$1 = {
|
|
23933
24035
|
WIDTH: 500,
|
|
23934
24036
|
HEIGHT: 500,
|
|
@@ -23972,7 +24074,7 @@
|
|
|
23972
24074
|
canvas: params.canvas
|
|
23973
24075
|
}), _this.state = "normal", _this.renderCount = 0, _this.tryInitEventSystem(), _this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig$1.BACKGROUND, _this.appendChild(_this.layerService.createLayer(_assertThisInitialized(_this), {
|
|
23974
24076
|
main: !0
|
|
23975
|
-
})), _this.nextFrameRenderLayerSet = new Set(), _this.willNextFrameRender = !1, _this.stage = _assertThisInitialized(_this), _this.renderStyle = params.renderStyle, params.autoRender && _this.enableAutoRender(), !1 === params.disableDirtyBounds && _this.enableDirtyBounds(), params.enableHtmlAttribute && _this.enableHtmlAttribute(params.enableHtmlAttribute), params.enableLayout && _this.enableLayout(), _this.hooks.beforeRender.tap("constructor", _this.beforeRender), _this.hooks.afterRender.tap("constructor", _this.afterRender), _this._beforeRender = params.beforeRender, _this._afterRender = params.afterRender, _this.ticker = params.ticker || defaultTicker, _this.supportInteractiveLayer = !1 !== params.interactiveLayer, _this.timeline = new DefaultTimeline(), _this.ticker.addTimeline(_this.timeline), _this.timeline.pause(), params.optimize || (params.optimize = {}), _this.optmize(params.optimize), params.background && isString$1(_this._background) && _this._background.includes("/") && _this.setAttributes({
|
|
24077
|
+
})), _this.nextFrameRenderLayerSet = new Set(), _this.willNextFrameRender = !1, _this.stage = _assertThisInitialized(_this), _this.renderStyle = params.renderStyle, params.autoRender && _this.enableAutoRender(), !1 === params.disableDirtyBounds && _this.enableDirtyBounds(), params.enableHtmlAttribute && _this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && _this.enableReactAttribute(params.ReactDOM), params.enableLayout && _this.enableLayout(), _this.hooks.beforeRender.tap("constructor", _this.beforeRender), _this.hooks.afterRender.tap("constructor", _this.afterRender), _this._beforeRender = params.beforeRender, _this._afterRender = params.afterRender, _this.ticker = params.ticker || defaultTicker, _this.supportInteractiveLayer = !1 !== params.interactiveLayer, _this.timeline = new DefaultTimeline(), _this.ticker.addTimeline(_this.timeline), _this.timeline.pause(), params.optimize || (params.optimize = {}), _this.optmize(params.optimize), params.background && isString$1(_this._background) && _this._background.includes("/") && _this.setAttributes({
|
|
23976
24078
|
background: _this._background
|
|
23977
24079
|
});
|
|
23978
24080
|
return _this;
|
|
@@ -24273,6 +24375,19 @@
|
|
|
24273
24375
|
_this7.pluginService.unRegister(plugin);
|
|
24274
24376
|
}));
|
|
24275
24377
|
}
|
|
24378
|
+
}, {
|
|
24379
|
+
key: "enableReactAttribute",
|
|
24380
|
+
value: function enableReactAttribute(container) {
|
|
24381
|
+
this.reactAttribute || (this.reactAttribute = container, this.pluginService.register(new ReactAttributePlugin()));
|
|
24382
|
+
}
|
|
24383
|
+
}, {
|
|
24384
|
+
key: "disableReactAttribute",
|
|
24385
|
+
value: function disableReactAttribute() {
|
|
24386
|
+
var _this8 = this;
|
|
24387
|
+
this.reactAttribute && (this.reactAttribute = !1, this.pluginService.findPluginsByName("ReactAttributePlugin").forEach(function (plugin) {
|
|
24388
|
+
_this8.pluginService.unRegister(plugin);
|
|
24389
|
+
}));
|
|
24390
|
+
}
|
|
24276
24391
|
}, {
|
|
24277
24392
|
key: "getPluginsByName",
|
|
24278
24393
|
value: function getPluginsByName(name) {
|
|
@@ -24302,10 +24417,10 @@
|
|
|
24302
24417
|
}, {
|
|
24303
24418
|
key: "sortLayer",
|
|
24304
24419
|
value: function sortLayer(cb) {
|
|
24305
|
-
var
|
|
24420
|
+
var _this9 = this;
|
|
24306
24421
|
var children = this.children;
|
|
24307
24422
|
children.sort(cb), this.removeAllChild(), children.forEach(function (c) {
|
|
24308
|
-
|
|
24423
|
+
_this9.appendChild(c);
|
|
24309
24424
|
});
|
|
24310
24425
|
}
|
|
24311
24426
|
}, {
|
|
@@ -24336,11 +24451,11 @@
|
|
|
24336
24451
|
}, {
|
|
24337
24452
|
key: "renderNextFrame",
|
|
24338
24453
|
value: function renderNextFrame(layers, force) {
|
|
24339
|
-
var
|
|
24454
|
+
var _this10 = this;
|
|
24340
24455
|
this.nextFrameRenderLayerSet.size !== this.childrenCount && (layers || this).forEach(function (layer) {
|
|
24341
|
-
|
|
24456
|
+
_this10.nextFrameRenderLayerSet.add(layer);
|
|
24342
24457
|
}), this.willNextFrameRender || (this.willNextFrameRender = !0, this.global.getRequestAnimationFrame()(function () {
|
|
24343
|
-
|
|
24458
|
+
_this10._doRenderInThisFrame(), _this10.willNextFrameRender = !1;
|
|
24344
24459
|
}));
|
|
24345
24460
|
}
|
|
24346
24461
|
}, {
|
|
@@ -24353,21 +24468,21 @@
|
|
|
24353
24468
|
}, {
|
|
24354
24469
|
key: "renderLayerList",
|
|
24355
24470
|
value: function renderLayerList(layerList, params) {
|
|
24356
|
-
var
|
|
24471
|
+
var _this11 = this;
|
|
24357
24472
|
var list = [];
|
|
24358
24473
|
for (var i = 0; i < layerList.length; i++) {
|
|
24359
24474
|
var l = layerList[i];
|
|
24360
24475
|
"virtual" === l.layerMode && (l = l.getNativeHandler().mainHandler.layer), list.includes(l) || list.push(l);
|
|
24361
24476
|
}
|
|
24362
24477
|
list.forEach(function (layer) {
|
|
24363
|
-
layer.renderCount >
|
|
24364
|
-
renderService:
|
|
24365
|
-
background: layer ===
|
|
24366
|
-
updateBounds: !(!
|
|
24367
|
-
viewBox:
|
|
24368
|
-
transMatrix:
|
|
24478
|
+
layer.renderCount > _this11.renderCount || (layer.renderCount = _this11.renderCount + 1, layer.render({
|
|
24479
|
+
renderService: _this11.renderService,
|
|
24480
|
+
background: layer === _this11.defaultLayer ? _this11.background : void 0,
|
|
24481
|
+
updateBounds: !(!_this11.dirtyBounds || _this11.dirtyBounds.empty()),
|
|
24482
|
+
viewBox: _this11.window.getViewBox(),
|
|
24483
|
+
transMatrix: _this11.window.getViewBoxTransform()
|
|
24369
24484
|
}, Object.assign({
|
|
24370
|
-
renderStyle:
|
|
24485
|
+
renderStyle: _this11.renderStyle
|
|
24371
24486
|
}, params)));
|
|
24372
24487
|
}), this.interactiveLayer && !layerList.includes(this.interactiveLayer) && this.interactiveLayer.render({
|
|
24373
24488
|
renderService: this.renderService,
|
|
@@ -24406,10 +24521,10 @@
|
|
|
24406
24521
|
}, {
|
|
24407
24522
|
key: "setViewBox",
|
|
24408
24523
|
value: function setViewBox(x, y, w, h, rerender) {
|
|
24409
|
-
var
|
|
24524
|
+
var _this12 = this;
|
|
24410
24525
|
var isRerender = !0;
|
|
24411
24526
|
"object" == _typeof(x) ? (this.viewBox.setValue(x.x1, x.y1, x.x2, x.y2), !1 === y && (isRerender = !1)) : (this.viewBox.setValue(x, y, x + w, y + h), !1 === rerender && (isRerender = !1)), this.forEachChildren(function (c) {
|
|
24412
|
-
c.resizeView(
|
|
24527
|
+
c.resizeView(_this12.viewBox.width(), _this12.viewBox.height());
|
|
24413
24528
|
}), isRerender && this.render();
|
|
24414
24529
|
}
|
|
24415
24530
|
}, {
|
|
@@ -24452,7 +24567,7 @@
|
|
|
24452
24567
|
}, {
|
|
24453
24568
|
key: "release",
|
|
24454
24569
|
value: function release() {
|
|
24455
|
-
_get(_getPrototypeOf(Stage.prototype), "release", this).call(this), this.eventSystem && this.eventSystem.release(), this.pluginService.release(), this.forEach(function (layer) {
|
|
24570
|
+
_get(_getPrototypeOf(Stage.prototype), "release", this).call(this), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(function (layer) {
|
|
24456
24571
|
layer.release();
|
|
24457
24572
|
}), this.interactiveLayer && this.interactiveLayer.release(), this.window.release();
|
|
24458
24573
|
}
|
|
@@ -24474,15 +24589,15 @@
|
|
|
24474
24589
|
}, {
|
|
24475
24590
|
key: "renderTo",
|
|
24476
24591
|
value: function renderTo(window) {
|
|
24477
|
-
var
|
|
24592
|
+
var _this13 = this;
|
|
24478
24593
|
this.forEachChildren(function (layer, i) {
|
|
24479
24594
|
layer.drawTo(window, {
|
|
24480
|
-
renderService:
|
|
24595
|
+
renderService: _this13.renderService,
|
|
24481
24596
|
viewBox: window.getViewBox(),
|
|
24482
24597
|
transMatrix: window.getViewBoxTransform(),
|
|
24483
|
-
background: layer ===
|
|
24598
|
+
background: layer === _this13.defaultLayer ? _this13.background : void 0,
|
|
24484
24599
|
clear: 0 === i,
|
|
24485
|
-
updateBounds: !(!
|
|
24600
|
+
updateBounds: !(!_this13.dirtyBounds || _this13.dirtyBounds.empty())
|
|
24486
24601
|
});
|
|
24487
24602
|
});
|
|
24488
24603
|
}
|
|
@@ -35221,7 +35336,7 @@
|
|
|
35221
35336
|
|
|
35222
35337
|
var roughModule = _roughModule;
|
|
35223
35338
|
|
|
35224
|
-
const version = "0.18.
|
|
35339
|
+
const version = "0.18.6";
|
|
35225
35340
|
preLoadAllModule();
|
|
35226
35341
|
if (isBrowserEnv()) {
|
|
35227
35342
|
loadBrowserEnv(container);
|