@antv/g-lite 1.0.29-alpha.0 → 1.0.30
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/dist/AbstractRenderer.d.ts +5 -4
- package/dist/AbstractRenderer.d.ts.map +1 -1
- package/dist/Canvas.d.ts +1 -0
- package/dist/Canvas.d.ts.map +1 -1
- package/dist/dom/Element.d.ts.map +1 -1
- package/dist/index.esm.js +105 -104
- package/dist/index.js +105 -104
- package/dist/index.umd.js +105 -104
- package/dist/index.umd.min.js +1 -1
- package/dist/services/EventService.d.ts +7 -7
- package/dist/services/EventService.d.ts.map +1 -1
- package/dist/services/RenderingService.d.ts +2 -2
- package/dist/services/RenderingService.d.ts.map +1 -1
- package/dist/services/SceneGraphService.d.ts +1 -0
- package/dist/services/SceneGraphService.d.ts.map +1 -1
- package/dist/services/interfaces.d.ts +1 -0
- package/dist/services/interfaces.d.ts.map +1 -1
- package/dist/utils/assert.d.ts +1 -0
- package/dist/utils/assert.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -5904,6 +5904,10 @@
|
|
|
5904
5904
|
function isFunction(func) {
|
|
5905
5905
|
return typeof func === 'function';
|
|
5906
5906
|
}
|
|
5907
|
+
function isSymbol(value) {
|
|
5908
|
+
// @see https://github.com/lodash/lodash/blob/master/isSymbol.js
|
|
5909
|
+
return typeof value === 'symbol';
|
|
5910
|
+
}
|
|
5907
5911
|
var definedProps = function definedProps(obj) {
|
|
5908
5912
|
return Object.fromEntries(Object.entries(obj).filter(function (_ref) {
|
|
5909
5913
|
var v = _ref[1];
|
|
@@ -13411,6 +13415,10 @@
|
|
|
13411
13415
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
13412
13416
|
*/;
|
|
13413
13417
|
_proto.getAttribute = function getAttribute(name) {
|
|
13418
|
+
// @see https://github.com/antvis/G/issues/1267
|
|
13419
|
+
if (isSymbol(name)) {
|
|
13420
|
+
return null;
|
|
13421
|
+
}
|
|
13414
13422
|
var value = this.attributes[name];
|
|
13415
13423
|
if (value === undefined) {
|
|
13416
13424
|
var attributeName = formatAttributeName(name);
|
|
@@ -19743,15 +19751,9 @@
|
|
|
19743
19751
|
while (1) {
|
|
19744
19752
|
switch (_context.prev = _context.next) {
|
|
19745
19753
|
case 0:
|
|
19746
|
-
|
|
19747
|
-
_context.next = 2;
|
|
19748
|
-
break;
|
|
19749
|
-
}
|
|
19750
|
-
return _context.abrupt("return");
|
|
19751
|
-
case 2:
|
|
19752
|
-
_context.next = 4;
|
|
19754
|
+
_context.next = 2;
|
|
19753
19755
|
return _this.createPointerEvent(from);
|
|
19754
|
-
case
|
|
19756
|
+
case 2:
|
|
19755
19757
|
e = _context.sent;
|
|
19756
19758
|
_this.dispatchEvent(e, 'pointerdown');
|
|
19757
19759
|
if (e.pointerType === 'touch') {
|
|
@@ -19763,7 +19765,7 @@
|
|
|
19763
19765
|
trackingData = _this.trackingData(from.pointerId);
|
|
19764
19766
|
trackingData.pressTargetsByButton[from.button] = e.composedPath();
|
|
19765
19767
|
_this.freeEvent(e);
|
|
19766
|
-
case
|
|
19768
|
+
case 8:
|
|
19767
19769
|
case "end":
|
|
19768
19770
|
return _context.stop();
|
|
19769
19771
|
}
|
|
@@ -19781,16 +19783,13 @@
|
|
|
19781
19783
|
while (1) {
|
|
19782
19784
|
switch (_context2.prev = _context2.next) {
|
|
19783
19785
|
case 0:
|
|
19784
|
-
if (from instanceof FederatedPointerEvent) {
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
}
|
|
19788
|
-
return _context2.abrupt("return");
|
|
19789
|
-
case 2:
|
|
19786
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19787
|
+
// return;
|
|
19788
|
+
// }
|
|
19790
19789
|
now = performance.now();
|
|
19791
|
-
_context2.next =
|
|
19790
|
+
_context2.next = 3;
|
|
19792
19791
|
return _this.createPointerEvent(from);
|
|
19793
|
-
case
|
|
19792
|
+
case 3:
|
|
19794
19793
|
e = _context2.sent;
|
|
19795
19794
|
_this.dispatchEvent(e, 'pointerup');
|
|
19796
19795
|
if (e.pointerType === 'touch') {
|
|
@@ -19853,7 +19852,7 @@
|
|
|
19853
19852
|
_this.freeEvent(clickEvent);
|
|
19854
19853
|
}
|
|
19855
19854
|
_this.freeEvent(e);
|
|
19856
|
-
case
|
|
19855
|
+
case 12:
|
|
19857
19856
|
case "end":
|
|
19858
19857
|
return _context2.stop();
|
|
19859
19858
|
}
|
|
@@ -19871,40 +19870,34 @@
|
|
|
19871
19870
|
while (1) {
|
|
19872
19871
|
switch (_context3.prev = _context3.next) {
|
|
19873
19872
|
case 0:
|
|
19874
|
-
|
|
19875
|
-
_context3.next = 2;
|
|
19876
|
-
break;
|
|
19877
|
-
}
|
|
19878
|
-
return _context3.abrupt("return");
|
|
19879
|
-
case 2:
|
|
19880
|
-
_context3.next = 4;
|
|
19873
|
+
_context3.next = 2;
|
|
19881
19874
|
return _this.createPointerEvent(from);
|
|
19882
|
-
case
|
|
19875
|
+
case 2:
|
|
19883
19876
|
e = _context3.sent;
|
|
19884
19877
|
isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
19885
19878
|
trackingData = _this.trackingData(from.pointerId);
|
|
19886
19879
|
outTarget = _this.findMountedTarget(trackingData.overTargets); // First pointerout/pointerleave
|
|
19887
19880
|
if (!(trackingData.overTargets && outTarget !== e.target)) {
|
|
19888
|
-
_context3.next =
|
|
19881
|
+
_context3.next = 21;
|
|
19889
19882
|
break;
|
|
19890
19883
|
}
|
|
19891
19884
|
// pointerout always occurs on the overTarget when the pointer hovers over another element.
|
|
19892
19885
|
outType = from.type === 'mousemove' ? 'mouseout' : 'pointerout';
|
|
19893
|
-
_context3.next =
|
|
19886
|
+
_context3.next = 10;
|
|
19894
19887
|
return _this.createPointerEvent(from, outType, outTarget || undefined);
|
|
19895
|
-
case
|
|
19888
|
+
case 10:
|
|
19896
19889
|
outEvent = _context3.sent;
|
|
19897
19890
|
_this.dispatchEvent(outEvent, 'pointerout');
|
|
19898
19891
|
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
19899
19892
|
// If the pointer exits overTarget and its descendants, then a pointerleave event is also fired. This event
|
|
19900
19893
|
// is dispatched to all ancestors that no longer capture the pointer.
|
|
19901
19894
|
if (e.composedPath().includes(outTarget)) {
|
|
19902
|
-
_context3.next =
|
|
19895
|
+
_context3.next = 20;
|
|
19903
19896
|
break;
|
|
19904
19897
|
}
|
|
19905
|
-
_context3.next =
|
|
19898
|
+
_context3.next = 16;
|
|
19906
19899
|
return _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
19907
|
-
case
|
|
19900
|
+
case 16:
|
|
19908
19901
|
leaveEvent = _context3.sent;
|
|
19909
19902
|
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
19910
19903
|
while (leaveEvent.target && !e.composedPath().includes(leaveEvent.target)) {
|
|
@@ -19918,11 +19911,11 @@
|
|
|
19918
19911
|
}
|
|
19919
19912
|
}
|
|
19920
19913
|
_this.freeEvent(leaveEvent);
|
|
19921
|
-
case
|
|
19914
|
+
case 20:
|
|
19922
19915
|
_this.freeEvent(outEvent);
|
|
19923
|
-
case
|
|
19916
|
+
case 21:
|
|
19924
19917
|
if (!(outTarget !== e.target)) {
|
|
19925
|
-
_context3.next =
|
|
19918
|
+
_context3.next = 36;
|
|
19926
19919
|
break;
|
|
19927
19920
|
}
|
|
19928
19921
|
// pointerover always occurs on the new overTarget
|
|
@@ -19932,21 +19925,21 @@
|
|
|
19932
19925
|
if (isMouse) _this.dispatchEvent(overEvent, 'mouseover');
|
|
19933
19926
|
// Probe whether the newly hovered Node is an ancestor of the original overTarget.
|
|
19934
19927
|
overTargetAncestor = outTarget && Node.isNode(outTarget) && outTarget.parentNode;
|
|
19935
|
-
case
|
|
19928
|
+
case 27:
|
|
19936
19929
|
if (!(overTargetAncestor && overTargetAncestor !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode))) {
|
|
19937
|
-
_context3.next =
|
|
19930
|
+
_context3.next = 33;
|
|
19938
19931
|
break;
|
|
19939
19932
|
}
|
|
19940
19933
|
if (!(overTargetAncestor === e.target)) {
|
|
19941
|
-
_context3.next =
|
|
19934
|
+
_context3.next = 30;
|
|
19942
19935
|
break;
|
|
19943
19936
|
}
|
|
19944
|
-
return _context3.abrupt("break",
|
|
19945
|
-
case
|
|
19937
|
+
return _context3.abrupt("break", 33);
|
|
19938
|
+
case 30:
|
|
19946
19939
|
overTargetAncestor = overTargetAncestor.parentNode;
|
|
19947
|
-
_context3.next =
|
|
19940
|
+
_context3.next = 27;
|
|
19948
19941
|
break;
|
|
19949
|
-
case
|
|
19942
|
+
case 33:
|
|
19950
19943
|
// The pointer has entered a non-ancestor of the original overTarget. This means we need a pointerentered
|
|
19951
19944
|
// event.
|
|
19952
19945
|
didPointerEnter = !overTargetAncestor || overTargetAncestor === (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode);
|
|
@@ -19964,7 +19957,7 @@
|
|
|
19964
19957
|
_this.freeEvent(enterEvent);
|
|
19965
19958
|
}
|
|
19966
19959
|
_this.freeEvent(overEvent);
|
|
19967
|
-
case
|
|
19960
|
+
case 36:
|
|
19968
19961
|
// Then pointermove
|
|
19969
19962
|
_this.dispatchEvent(e, 'pointermove');
|
|
19970
19963
|
if (e.pointerType === 'touch') _this.dispatchEvent(e, 'touchmove');
|
|
@@ -19974,7 +19967,7 @@
|
|
|
19974
19967
|
}
|
|
19975
19968
|
trackingData.overTargets = e.composedPath();
|
|
19976
19969
|
_this.freeEvent(e);
|
|
19977
|
-
case
|
|
19970
|
+
case 41:
|
|
19978
19971
|
case "end":
|
|
19979
19972
|
return _context3.stop();
|
|
19980
19973
|
}
|
|
@@ -19992,30 +19985,27 @@
|
|
|
19992
19985
|
while (1) {
|
|
19993
19986
|
switch (_context4.prev = _context4.next) {
|
|
19994
19987
|
case 0:
|
|
19995
|
-
if (from instanceof FederatedPointerEvent) {
|
|
19996
|
-
|
|
19997
|
-
|
|
19998
|
-
}
|
|
19999
|
-
return _context4.abrupt("return");
|
|
20000
|
-
case 2:
|
|
19988
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19989
|
+
// return;
|
|
19990
|
+
// }
|
|
20001
19991
|
trackingData = _this.trackingData(from.pointerId);
|
|
20002
19992
|
if (!trackingData.overTargets) {
|
|
20003
|
-
_context4.next =
|
|
19993
|
+
_context4.next = 17;
|
|
20004
19994
|
break;
|
|
20005
19995
|
}
|
|
20006
19996
|
isMouse = from.pointerType === 'mouse' || from.pointerType === 'pen';
|
|
20007
19997
|
outTarget = _this.findMountedTarget(trackingData.overTargets); // pointerout first
|
|
20008
|
-
_context4.next =
|
|
19998
|
+
_context4.next = 6;
|
|
20009
19999
|
return _this.createPointerEvent(from, 'pointerout', outTarget || undefined);
|
|
20010
|
-
case
|
|
20000
|
+
case 6:
|
|
20011
20001
|
outEvent = _context4.sent;
|
|
20012
20002
|
_this.dispatchEvent(outEvent);
|
|
20013
20003
|
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
20014
20004
|
// pointerleave(s) are also dispatched b/c the pointer must've left rootTarget and its descendants to
|
|
20015
20005
|
// get an upstream pointerout event (upstream events do not know rootTarget has descendants).
|
|
20016
|
-
_context4.next =
|
|
20006
|
+
_context4.next = 11;
|
|
20017
20007
|
return _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
20018
|
-
case
|
|
20008
|
+
case 11:
|
|
20019
20009
|
leaveEvent = _context4.sent;
|
|
20020
20010
|
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
20021
20011
|
while (leaveEvent.target && leaveEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
@@ -20031,9 +20021,9 @@
|
|
|
20031
20021
|
trackingData.overTargets = null;
|
|
20032
20022
|
_this.freeEvent(outEvent);
|
|
20033
20023
|
_this.freeEvent(leaveEvent);
|
|
20034
|
-
case
|
|
20024
|
+
case 17:
|
|
20035
20025
|
_this.cursor = null;
|
|
20036
|
-
case
|
|
20026
|
+
case 18:
|
|
20037
20027
|
case "end":
|
|
20038
20028
|
return _context4.stop();
|
|
20039
20029
|
}
|
|
@@ -20051,16 +20041,13 @@
|
|
|
20051
20041
|
while (1) {
|
|
20052
20042
|
switch (_context5.prev = _context5.next) {
|
|
20053
20043
|
case 0:
|
|
20054
|
-
if (from instanceof FederatedPointerEvent) {
|
|
20055
|
-
|
|
20056
|
-
|
|
20057
|
-
}
|
|
20058
|
-
return _context5.abrupt("return");
|
|
20059
|
-
case 2:
|
|
20044
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
20045
|
+
// return;
|
|
20046
|
+
// }
|
|
20060
20047
|
trackingData = _this.trackingData(from.pointerId);
|
|
20061
|
-
_context5.next =
|
|
20048
|
+
_context5.next = 3;
|
|
20062
20049
|
return _this.createPointerEvent(from);
|
|
20063
|
-
case
|
|
20050
|
+
case 3:
|
|
20064
20051
|
e = _context5.sent;
|
|
20065
20052
|
isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
20066
20053
|
_this.dispatchEvent(e, 'pointerover');
|
|
@@ -20084,7 +20071,7 @@
|
|
|
20084
20071
|
trackingData.overTargets = e.composedPath();
|
|
20085
20072
|
_this.freeEvent(e);
|
|
20086
20073
|
_this.freeEvent(enterEvent);
|
|
20087
|
-
case
|
|
20074
|
+
case 14:
|
|
20088
20075
|
case "end":
|
|
20089
20076
|
return _context5.stop();
|
|
20090
20077
|
}
|
|
@@ -20102,17 +20089,14 @@
|
|
|
20102
20089
|
while (1) {
|
|
20103
20090
|
switch (_context6.prev = _context6.next) {
|
|
20104
20091
|
case 0:
|
|
20105
|
-
if (from instanceof FederatedPointerEvent) {
|
|
20106
|
-
|
|
20107
|
-
|
|
20108
|
-
}
|
|
20109
|
-
return _context6.abrupt("return");
|
|
20110
|
-
case 2:
|
|
20092
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
20093
|
+
// return;
|
|
20094
|
+
// }
|
|
20111
20095
|
trackingData = _this.trackingData(from.pointerId);
|
|
20112
20096
|
pressTarget = _this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);
|
|
20113
|
-
_context6.next =
|
|
20097
|
+
_context6.next = 4;
|
|
20114
20098
|
return _this.createPointerEvent(from);
|
|
20115
|
-
case
|
|
20099
|
+
case 4:
|
|
20116
20100
|
e = _context6.sent;
|
|
20117
20101
|
if (pressTarget) {
|
|
20118
20102
|
currentTarget = pressTarget;
|
|
@@ -20129,7 +20113,7 @@
|
|
|
20129
20113
|
delete trackingData.pressTargetsByButton[from.button];
|
|
20130
20114
|
}
|
|
20131
20115
|
_this.freeEvent(e);
|
|
20132
|
-
case
|
|
20116
|
+
case 7:
|
|
20133
20117
|
case "end":
|
|
20134
20118
|
return _context6.stop();
|
|
20135
20119
|
}
|
|
@@ -20147,19 +20131,13 @@
|
|
|
20147
20131
|
while (1) {
|
|
20148
20132
|
switch (_context7.prev = _context7.next) {
|
|
20149
20133
|
case 0:
|
|
20150
|
-
|
|
20151
|
-
_context7.next = 2;
|
|
20152
|
-
break;
|
|
20153
|
-
}
|
|
20154
|
-
return _context7.abrupt("return");
|
|
20155
|
-
case 2:
|
|
20156
|
-
_context7.next = 4;
|
|
20134
|
+
_context7.next = 2;
|
|
20157
20135
|
return _this.createWheelEvent(from);
|
|
20158
|
-
case
|
|
20136
|
+
case 2:
|
|
20159
20137
|
wheelEvent = _context7.sent;
|
|
20160
20138
|
_this.dispatchEvent(wheelEvent);
|
|
20161
20139
|
_this.freeEvent(wheelEvent);
|
|
20162
|
-
case
|
|
20140
|
+
case 5:
|
|
20163
20141
|
case "end":
|
|
20164
20142
|
return _context7.stop();
|
|
20165
20143
|
}
|
|
@@ -20572,7 +20550,13 @@
|
|
|
20572
20550
|
return event;
|
|
20573
20551
|
};
|
|
20574
20552
|
_proto.copyPointerData = function copyPointerData(from, to) {
|
|
20575
|
-
if (
|
|
20553
|
+
// if (
|
|
20554
|
+
// !(
|
|
20555
|
+
// from instanceof FederatedPointerEvent &&
|
|
20556
|
+
// to instanceof FederatedPointerEvent
|
|
20557
|
+
// )
|
|
20558
|
+
// )
|
|
20559
|
+
// return;
|
|
20576
20560
|
to.pointerId = from.pointerId;
|
|
20577
20561
|
to.width = from.width;
|
|
20578
20562
|
to.height = from.height;
|
|
@@ -20585,7 +20569,12 @@
|
|
|
20585
20569
|
to.twist = from.twist;
|
|
20586
20570
|
};
|
|
20587
20571
|
_proto.copyMouseData = function copyMouseData(from, to) {
|
|
20588
|
-
if (
|
|
20572
|
+
// if (
|
|
20573
|
+
// !(
|
|
20574
|
+
// from instanceof FederatedMouseEvent && to instanceof FederatedMouseEvent
|
|
20575
|
+
// )
|
|
20576
|
+
// )
|
|
20577
|
+
// return;
|
|
20589
20578
|
to.altKey = from.altKey;
|
|
20590
20579
|
to.button = from.button;
|
|
20591
20580
|
to.buttons = from.buttons;
|
|
@@ -20846,7 +20835,7 @@
|
|
|
20846
20835
|
case 0:
|
|
20847
20836
|
context = _extends({}, this.globalRuntime, this.context); // register rendering plugins
|
|
20848
20837
|
this.context.renderingPlugins.forEach(function (plugin) {
|
|
20849
|
-
plugin.apply(context);
|
|
20838
|
+
plugin.apply(context, runtime);
|
|
20850
20839
|
});
|
|
20851
20840
|
// await this.hooks.init.callPromise();
|
|
20852
20841
|
_context.next = 4;
|
|
@@ -20879,7 +20868,7 @@
|
|
|
20879
20868
|
enableDirtyRectangleRendering = _renderer$getConfig.enableDirtyRectangleRendering;
|
|
20880
20869
|
return !enableDirtyRectangleRendering || this.context.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);
|
|
20881
20870
|
};
|
|
20882
|
-
_proto.render = function render(canvasConfig) {
|
|
20871
|
+
_proto.render = function render(canvasConfig, rerenderCallback) {
|
|
20883
20872
|
var _this = this;
|
|
20884
20873
|
this.stats.total = 0;
|
|
20885
20874
|
this.stats.rendered = 0;
|
|
@@ -20898,6 +20887,7 @@
|
|
|
20898
20887
|
this.hooks.endFrame.call();
|
|
20899
20888
|
renderingContext.renderListCurrentFrame = [];
|
|
20900
20889
|
renderingContext.renderReasons.clear();
|
|
20890
|
+
rerenderCallback();
|
|
20901
20891
|
}
|
|
20902
20892
|
// console.log('stats', this.stats);
|
|
20903
20893
|
};
|
|
@@ -20946,6 +20936,7 @@
|
|
|
20946
20936
|
_proto.destroy = function destroy() {
|
|
20947
20937
|
this.inited = false;
|
|
20948
20938
|
this.hooks.destroy.call();
|
|
20939
|
+
this.globalRuntime.sceneGraphService.clearPendingEvents();
|
|
20949
20940
|
};
|
|
20950
20941
|
_proto.dirtify = function dirtify() {
|
|
20951
20942
|
// need re-render
|
|
@@ -21497,9 +21488,12 @@
|
|
|
21497
21488
|
trigger(element, detail);
|
|
21498
21489
|
}
|
|
21499
21490
|
});
|
|
21500
|
-
this.
|
|
21491
|
+
this.clearPendingEvents();
|
|
21501
21492
|
set.clear();
|
|
21502
21493
|
};
|
|
21494
|
+
_proto.clearPendingEvents = function clearPendingEvents() {
|
|
21495
|
+
this.pendingEvents = [];
|
|
21496
|
+
};
|
|
21503
21497
|
_proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
|
|
21504
21498
|
if (affectChildren === void 0) {
|
|
21505
21499
|
affectChildren = false;
|
|
@@ -22880,6 +22874,7 @@
|
|
|
22880
22874
|
(function (CanvasEvent) {
|
|
22881
22875
|
CanvasEvent["READY"] = "ready";
|
|
22882
22876
|
CanvasEvent["BEFORE_RENDER"] = "beforerender";
|
|
22877
|
+
CanvasEvent["RERENDER"] = "rerender";
|
|
22883
22878
|
CanvasEvent["AFTER_RENDER"] = "afterrender";
|
|
22884
22879
|
CanvasEvent["BEFORE_DESTROY"] = "beforedestroy";
|
|
22885
22880
|
CanvasEvent["AFTER_DESTROY"] = "afterdestroy";
|
|
@@ -22895,6 +22890,7 @@
|
|
|
22895
22890
|
var mountedEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
|
|
22896
22891
|
var unmountedEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
|
|
22897
22892
|
var beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
|
|
22893
|
+
var rerenderEvent = new CustomEvent(exports.CanvasEvent.RERENDER);
|
|
22898
22894
|
var afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
|
|
22899
22895
|
/**
|
|
22900
22896
|
* can be treated like Window in DOM
|
|
@@ -23220,16 +23216,21 @@
|
|
|
23220
23216
|
this.document.documentElement.destroyChildren();
|
|
23221
23217
|
};
|
|
23222
23218
|
_proto.render = function render() {
|
|
23219
|
+
var _this3 = this;
|
|
23223
23220
|
this.dispatchEvent(beforeRenderEvent);
|
|
23224
23221
|
var renderingService = this.getRenderingService();
|
|
23225
|
-
renderingService.render(this.getConfig())
|
|
23222
|
+
renderingService.render(this.getConfig(), function () {
|
|
23223
|
+
// trigger actual rerender event
|
|
23224
|
+
// @see https://github.com/antvis/G/issues/1268
|
|
23225
|
+
_this3.dispatchEvent(rerenderEvent);
|
|
23226
|
+
});
|
|
23226
23227
|
this.dispatchEvent(afterRenderEvent);
|
|
23227
23228
|
};
|
|
23228
23229
|
_proto.run = function run() {
|
|
23229
|
-
var
|
|
23230
|
+
var _this4 = this;
|
|
23230
23231
|
var tick = function tick() {
|
|
23231
|
-
|
|
23232
|
-
|
|
23232
|
+
_this4.render();
|
|
23233
|
+
_this4.frameId = requestAnimationFrame(tick);
|
|
23233
23234
|
};
|
|
23234
23235
|
tick();
|
|
23235
23236
|
};
|
|
@@ -23295,12 +23296,12 @@
|
|
|
23295
23296
|
return initRenderer;
|
|
23296
23297
|
}();
|
|
23297
23298
|
_proto.loadRendererContainerModule = function loadRendererContainerModule(renderer) {
|
|
23298
|
-
var
|
|
23299
|
+
var _this5 = this;
|
|
23299
23300
|
// load other container modules provided by g-canvas/g-svg/g-webgl
|
|
23300
23301
|
var plugins = renderer.getPlugins();
|
|
23301
23302
|
plugins.forEach(function (plugin) {
|
|
23302
|
-
plugin.context =
|
|
23303
|
-
plugin.init();
|
|
23303
|
+
plugin.context = _this5.context;
|
|
23304
|
+
plugin.init(runtime);
|
|
23304
23305
|
});
|
|
23305
23306
|
};
|
|
23306
23307
|
_proto.setRenderer = /*#__PURE__*/function () {
|
|
@@ -23324,7 +23325,7 @@
|
|
|
23324
23325
|
this.destroy(false, true);
|
|
23325
23326
|
// destroy all plugins, reverse will mutate origin array
|
|
23326
23327
|
[].concat(oldRenderer === null || oldRenderer === void 0 ? void 0 : oldRenderer.getPlugins()).reverse().forEach(function (plugin) {
|
|
23327
|
-
plugin.destroy();
|
|
23328
|
+
plugin.destroy(runtime);
|
|
23328
23329
|
});
|
|
23329
23330
|
_context3.next = 9;
|
|
23330
23331
|
return this.initRenderer(renderer);
|
|
@@ -23346,10 +23347,10 @@
|
|
|
23346
23347
|
this.getContextService().applyCursorStyle(cursor);
|
|
23347
23348
|
};
|
|
23348
23349
|
_proto.unmountChildren = function unmountChildren(parent) {
|
|
23349
|
-
var
|
|
23350
|
+
var _this6 = this;
|
|
23350
23351
|
// unmountChildren recursively
|
|
23351
23352
|
parent.childNodes.forEach(function (child) {
|
|
23352
|
-
|
|
23353
|
+
_this6.unmountChildren(child);
|
|
23353
23354
|
});
|
|
23354
23355
|
if (this.inited) {
|
|
23355
23356
|
if (parent.isMutationObserved) {
|
|
@@ -23372,7 +23373,7 @@
|
|
|
23372
23373
|
}
|
|
23373
23374
|
};
|
|
23374
23375
|
_proto.mountChildren = function mountChildren(parent) {
|
|
23375
|
-
var
|
|
23376
|
+
var _this7 = this;
|
|
23376
23377
|
if (this.inited) {
|
|
23377
23378
|
if (!parent.isConnected) {
|
|
23378
23379
|
parent.ownerDocument = this.document;
|
|
@@ -23389,7 +23390,7 @@
|
|
|
23389
23390
|
}
|
|
23390
23391
|
// recursively mount children
|
|
23391
23392
|
parent.childNodes.forEach(function (child) {
|
|
23392
|
-
|
|
23393
|
+
_this7.mountChildren(child);
|
|
23393
23394
|
});
|
|
23394
23395
|
// trigger after mounted
|
|
23395
23396
|
if (parent.isCustomElement) {
|
|
@@ -23433,11 +23434,11 @@
|
|
|
23433
23434
|
_createClass(Canvas, [{
|
|
23434
23435
|
key: "ready",
|
|
23435
23436
|
get: function get() {
|
|
23436
|
-
var
|
|
23437
|
+
var _this8 = this;
|
|
23437
23438
|
if (!this.readyPromise) {
|
|
23438
23439
|
this.readyPromise = new Promise(function (resolve) {
|
|
23439
|
-
|
|
23440
|
-
resolve(
|
|
23440
|
+
_this8.resolveReadyPromise = function () {
|
|
23441
|
+
resolve(_this8);
|
|
23441
23442
|
};
|
|
23442
23443
|
});
|
|
23443
23444
|
if (this.inited) {
|