@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.js
CHANGED
|
@@ -504,6 +504,10 @@ function DCHECK_NE(a, b) {
|
|
|
504
504
|
function isFunction(func) {
|
|
505
505
|
return typeof func === 'function';
|
|
506
506
|
}
|
|
507
|
+
function isSymbol(value) {
|
|
508
|
+
// @see https://github.com/lodash/lodash/blob/master/isSymbol.js
|
|
509
|
+
return typeof value === 'symbol';
|
|
510
|
+
}
|
|
507
511
|
var definedProps = function definedProps(obj) {
|
|
508
512
|
return Object.fromEntries(Object.entries(obj).filter(function (_ref) {
|
|
509
513
|
var v = _ref[1];
|
|
@@ -6401,6 +6405,10 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
6401
6405
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute
|
|
6402
6406
|
*/;
|
|
6403
6407
|
_proto.getAttribute = function getAttribute(name) {
|
|
6408
|
+
// @see https://github.com/antvis/G/issues/1267
|
|
6409
|
+
if (isSymbol(name)) {
|
|
6410
|
+
return null;
|
|
6411
|
+
}
|
|
6404
6412
|
var value = this.attributes[name];
|
|
6405
6413
|
if (value === undefined) {
|
|
6406
6414
|
var attributeName = formatAttributeName(name);
|
|
@@ -12733,15 +12741,9 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12733
12741
|
while (1) {
|
|
12734
12742
|
switch (_context.prev = _context.next) {
|
|
12735
12743
|
case 0:
|
|
12736
|
-
|
|
12737
|
-
_context.next = 2;
|
|
12738
|
-
break;
|
|
12739
|
-
}
|
|
12740
|
-
return _context.abrupt("return");
|
|
12741
|
-
case 2:
|
|
12742
|
-
_context.next = 4;
|
|
12744
|
+
_context.next = 2;
|
|
12743
12745
|
return _this.createPointerEvent(from);
|
|
12744
|
-
case
|
|
12746
|
+
case 2:
|
|
12745
12747
|
e = _context.sent;
|
|
12746
12748
|
_this.dispatchEvent(e, 'pointerdown');
|
|
12747
12749
|
if (e.pointerType === 'touch') {
|
|
@@ -12753,7 +12755,7 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12753
12755
|
trackingData = _this.trackingData(from.pointerId);
|
|
12754
12756
|
trackingData.pressTargetsByButton[from.button] = e.composedPath();
|
|
12755
12757
|
_this.freeEvent(e);
|
|
12756
|
-
case
|
|
12758
|
+
case 8:
|
|
12757
12759
|
case "end":
|
|
12758
12760
|
return _context.stop();
|
|
12759
12761
|
}
|
|
@@ -12771,16 +12773,13 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12771
12773
|
while (1) {
|
|
12772
12774
|
switch (_context2.prev = _context2.next) {
|
|
12773
12775
|
case 0:
|
|
12774
|
-
if (from instanceof FederatedPointerEvent) {
|
|
12775
|
-
|
|
12776
|
-
|
|
12777
|
-
}
|
|
12778
|
-
return _context2.abrupt("return");
|
|
12779
|
-
case 2:
|
|
12776
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12777
|
+
// return;
|
|
12778
|
+
// }
|
|
12780
12779
|
now = performance.now();
|
|
12781
|
-
_context2.next =
|
|
12780
|
+
_context2.next = 3;
|
|
12782
12781
|
return _this.createPointerEvent(from);
|
|
12783
|
-
case
|
|
12782
|
+
case 3:
|
|
12784
12783
|
e = _context2.sent;
|
|
12785
12784
|
_this.dispatchEvent(e, 'pointerup');
|
|
12786
12785
|
if (e.pointerType === 'touch') {
|
|
@@ -12843,7 +12842,7 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12843
12842
|
_this.freeEvent(clickEvent);
|
|
12844
12843
|
}
|
|
12845
12844
|
_this.freeEvent(e);
|
|
12846
|
-
case
|
|
12845
|
+
case 12:
|
|
12847
12846
|
case "end":
|
|
12848
12847
|
return _context2.stop();
|
|
12849
12848
|
}
|
|
@@ -12861,40 +12860,34 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12861
12860
|
while (1) {
|
|
12862
12861
|
switch (_context3.prev = _context3.next) {
|
|
12863
12862
|
case 0:
|
|
12864
|
-
|
|
12865
|
-
_context3.next = 2;
|
|
12866
|
-
break;
|
|
12867
|
-
}
|
|
12868
|
-
return _context3.abrupt("return");
|
|
12869
|
-
case 2:
|
|
12870
|
-
_context3.next = 4;
|
|
12863
|
+
_context3.next = 2;
|
|
12871
12864
|
return _this.createPointerEvent(from);
|
|
12872
|
-
case
|
|
12865
|
+
case 2:
|
|
12873
12866
|
e = _context3.sent;
|
|
12874
12867
|
isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
12875
12868
|
trackingData = _this.trackingData(from.pointerId);
|
|
12876
12869
|
outTarget = _this.findMountedTarget(trackingData.overTargets); // First pointerout/pointerleave
|
|
12877
12870
|
if (!(trackingData.overTargets && outTarget !== e.target)) {
|
|
12878
|
-
_context3.next =
|
|
12871
|
+
_context3.next = 21;
|
|
12879
12872
|
break;
|
|
12880
12873
|
}
|
|
12881
12874
|
// pointerout always occurs on the overTarget when the pointer hovers over another element.
|
|
12882
12875
|
outType = from.type === 'mousemove' ? 'mouseout' : 'pointerout';
|
|
12883
|
-
_context3.next =
|
|
12876
|
+
_context3.next = 10;
|
|
12884
12877
|
return _this.createPointerEvent(from, outType, outTarget || undefined);
|
|
12885
|
-
case
|
|
12878
|
+
case 10:
|
|
12886
12879
|
outEvent = _context3.sent;
|
|
12887
12880
|
_this.dispatchEvent(outEvent, 'pointerout');
|
|
12888
12881
|
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
12889
12882
|
// If the pointer exits overTarget and its descendants, then a pointerleave event is also fired. This event
|
|
12890
12883
|
// is dispatched to all ancestors that no longer capture the pointer.
|
|
12891
12884
|
if (e.composedPath().includes(outTarget)) {
|
|
12892
|
-
_context3.next =
|
|
12885
|
+
_context3.next = 20;
|
|
12893
12886
|
break;
|
|
12894
12887
|
}
|
|
12895
|
-
_context3.next =
|
|
12888
|
+
_context3.next = 16;
|
|
12896
12889
|
return _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
12897
|
-
case
|
|
12890
|
+
case 16:
|
|
12898
12891
|
leaveEvent = _context3.sent;
|
|
12899
12892
|
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
12900
12893
|
while (leaveEvent.target && !e.composedPath().includes(leaveEvent.target)) {
|
|
@@ -12908,11 +12901,11 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12908
12901
|
}
|
|
12909
12902
|
}
|
|
12910
12903
|
_this.freeEvent(leaveEvent);
|
|
12911
|
-
case
|
|
12904
|
+
case 20:
|
|
12912
12905
|
_this.freeEvent(outEvent);
|
|
12913
|
-
case
|
|
12906
|
+
case 21:
|
|
12914
12907
|
if (!(outTarget !== e.target)) {
|
|
12915
|
-
_context3.next =
|
|
12908
|
+
_context3.next = 36;
|
|
12916
12909
|
break;
|
|
12917
12910
|
}
|
|
12918
12911
|
// pointerover always occurs on the new overTarget
|
|
@@ -12922,21 +12915,21 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12922
12915
|
if (isMouse) _this.dispatchEvent(overEvent, 'mouseover');
|
|
12923
12916
|
// Probe whether the newly hovered Node is an ancestor of the original overTarget.
|
|
12924
12917
|
overTargetAncestor = outTarget && Node.isNode(outTarget) && outTarget.parentNode;
|
|
12925
|
-
case
|
|
12918
|
+
case 27:
|
|
12926
12919
|
if (!(overTargetAncestor && overTargetAncestor !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode))) {
|
|
12927
|
-
_context3.next =
|
|
12920
|
+
_context3.next = 33;
|
|
12928
12921
|
break;
|
|
12929
12922
|
}
|
|
12930
12923
|
if (!(overTargetAncestor === e.target)) {
|
|
12931
|
-
_context3.next =
|
|
12924
|
+
_context3.next = 30;
|
|
12932
12925
|
break;
|
|
12933
12926
|
}
|
|
12934
|
-
return _context3.abrupt("break",
|
|
12935
|
-
case
|
|
12927
|
+
return _context3.abrupt("break", 33);
|
|
12928
|
+
case 30:
|
|
12936
12929
|
overTargetAncestor = overTargetAncestor.parentNode;
|
|
12937
|
-
_context3.next =
|
|
12930
|
+
_context3.next = 27;
|
|
12938
12931
|
break;
|
|
12939
|
-
case
|
|
12932
|
+
case 33:
|
|
12940
12933
|
// The pointer has entered a non-ancestor of the original overTarget. This means we need a pointerentered
|
|
12941
12934
|
// event.
|
|
12942
12935
|
didPointerEnter = !overTargetAncestor || overTargetAncestor === (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode);
|
|
@@ -12954,7 +12947,7 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12954
12947
|
_this.freeEvent(enterEvent);
|
|
12955
12948
|
}
|
|
12956
12949
|
_this.freeEvent(overEvent);
|
|
12957
|
-
case
|
|
12950
|
+
case 36:
|
|
12958
12951
|
// Then pointermove
|
|
12959
12952
|
_this.dispatchEvent(e, 'pointermove');
|
|
12960
12953
|
if (e.pointerType === 'touch') _this.dispatchEvent(e, 'touchmove');
|
|
@@ -12964,7 +12957,7 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12964
12957
|
}
|
|
12965
12958
|
trackingData.overTargets = e.composedPath();
|
|
12966
12959
|
_this.freeEvent(e);
|
|
12967
|
-
case
|
|
12960
|
+
case 41:
|
|
12968
12961
|
case "end":
|
|
12969
12962
|
return _context3.stop();
|
|
12970
12963
|
}
|
|
@@ -12982,30 +12975,27 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12982
12975
|
while (1) {
|
|
12983
12976
|
switch (_context4.prev = _context4.next) {
|
|
12984
12977
|
case 0:
|
|
12985
|
-
if (from instanceof FederatedPointerEvent) {
|
|
12986
|
-
|
|
12987
|
-
|
|
12988
|
-
}
|
|
12989
|
-
return _context4.abrupt("return");
|
|
12990
|
-
case 2:
|
|
12978
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12979
|
+
// return;
|
|
12980
|
+
// }
|
|
12991
12981
|
trackingData = _this.trackingData(from.pointerId);
|
|
12992
12982
|
if (!trackingData.overTargets) {
|
|
12993
|
-
_context4.next =
|
|
12983
|
+
_context4.next = 17;
|
|
12994
12984
|
break;
|
|
12995
12985
|
}
|
|
12996
12986
|
isMouse = from.pointerType === 'mouse' || from.pointerType === 'pen';
|
|
12997
12987
|
outTarget = _this.findMountedTarget(trackingData.overTargets); // pointerout first
|
|
12998
|
-
_context4.next =
|
|
12988
|
+
_context4.next = 6;
|
|
12999
12989
|
return _this.createPointerEvent(from, 'pointerout', outTarget || undefined);
|
|
13000
|
-
case
|
|
12990
|
+
case 6:
|
|
13001
12991
|
outEvent = _context4.sent;
|
|
13002
12992
|
_this.dispatchEvent(outEvent);
|
|
13003
12993
|
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
13004
12994
|
// pointerleave(s) are also dispatched b/c the pointer must've left rootTarget and its descendants to
|
|
13005
12995
|
// get an upstream pointerout event (upstream events do not know rootTarget has descendants).
|
|
13006
|
-
_context4.next =
|
|
12996
|
+
_context4.next = 11;
|
|
13007
12997
|
return _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
13008
|
-
case
|
|
12998
|
+
case 11:
|
|
13009
12999
|
leaveEvent = _context4.sent;
|
|
13010
13000
|
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
13011
13001
|
while (leaveEvent.target && leaveEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
@@ -13021,9 +13011,9 @@ var EventService = /*#__PURE__*/function () {
|
|
|
13021
13011
|
trackingData.overTargets = null;
|
|
13022
13012
|
_this.freeEvent(outEvent);
|
|
13023
13013
|
_this.freeEvent(leaveEvent);
|
|
13024
|
-
case
|
|
13014
|
+
case 17:
|
|
13025
13015
|
_this.cursor = null;
|
|
13026
|
-
case
|
|
13016
|
+
case 18:
|
|
13027
13017
|
case "end":
|
|
13028
13018
|
return _context4.stop();
|
|
13029
13019
|
}
|
|
@@ -13041,16 +13031,13 @@ var EventService = /*#__PURE__*/function () {
|
|
|
13041
13031
|
while (1) {
|
|
13042
13032
|
switch (_context5.prev = _context5.next) {
|
|
13043
13033
|
case 0:
|
|
13044
|
-
if (from instanceof FederatedPointerEvent) {
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
}
|
|
13048
|
-
return _context5.abrupt("return");
|
|
13049
|
-
case 2:
|
|
13034
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
13035
|
+
// return;
|
|
13036
|
+
// }
|
|
13050
13037
|
trackingData = _this.trackingData(from.pointerId);
|
|
13051
|
-
_context5.next =
|
|
13038
|
+
_context5.next = 3;
|
|
13052
13039
|
return _this.createPointerEvent(from);
|
|
13053
|
-
case
|
|
13040
|
+
case 3:
|
|
13054
13041
|
e = _context5.sent;
|
|
13055
13042
|
isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
13056
13043
|
_this.dispatchEvent(e, 'pointerover');
|
|
@@ -13074,7 +13061,7 @@ var EventService = /*#__PURE__*/function () {
|
|
|
13074
13061
|
trackingData.overTargets = e.composedPath();
|
|
13075
13062
|
_this.freeEvent(e);
|
|
13076
13063
|
_this.freeEvent(enterEvent);
|
|
13077
|
-
case
|
|
13064
|
+
case 14:
|
|
13078
13065
|
case "end":
|
|
13079
13066
|
return _context5.stop();
|
|
13080
13067
|
}
|
|
@@ -13092,17 +13079,14 @@ var EventService = /*#__PURE__*/function () {
|
|
|
13092
13079
|
while (1) {
|
|
13093
13080
|
switch (_context6.prev = _context6.next) {
|
|
13094
13081
|
case 0:
|
|
13095
|
-
if (from instanceof FederatedPointerEvent) {
|
|
13096
|
-
|
|
13097
|
-
|
|
13098
|
-
}
|
|
13099
|
-
return _context6.abrupt("return");
|
|
13100
|
-
case 2:
|
|
13082
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
13083
|
+
// return;
|
|
13084
|
+
// }
|
|
13101
13085
|
trackingData = _this.trackingData(from.pointerId);
|
|
13102
13086
|
pressTarget = _this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);
|
|
13103
|
-
_context6.next =
|
|
13087
|
+
_context6.next = 4;
|
|
13104
13088
|
return _this.createPointerEvent(from);
|
|
13105
|
-
case
|
|
13089
|
+
case 4:
|
|
13106
13090
|
e = _context6.sent;
|
|
13107
13091
|
if (pressTarget) {
|
|
13108
13092
|
currentTarget = pressTarget;
|
|
@@ -13119,7 +13103,7 @@ var EventService = /*#__PURE__*/function () {
|
|
|
13119
13103
|
delete trackingData.pressTargetsByButton[from.button];
|
|
13120
13104
|
}
|
|
13121
13105
|
_this.freeEvent(e);
|
|
13122
|
-
case
|
|
13106
|
+
case 7:
|
|
13123
13107
|
case "end":
|
|
13124
13108
|
return _context6.stop();
|
|
13125
13109
|
}
|
|
@@ -13137,19 +13121,13 @@ var EventService = /*#__PURE__*/function () {
|
|
|
13137
13121
|
while (1) {
|
|
13138
13122
|
switch (_context7.prev = _context7.next) {
|
|
13139
13123
|
case 0:
|
|
13140
|
-
|
|
13141
|
-
_context7.next = 2;
|
|
13142
|
-
break;
|
|
13143
|
-
}
|
|
13144
|
-
return _context7.abrupt("return");
|
|
13145
|
-
case 2:
|
|
13146
|
-
_context7.next = 4;
|
|
13124
|
+
_context7.next = 2;
|
|
13147
13125
|
return _this.createWheelEvent(from);
|
|
13148
|
-
case
|
|
13126
|
+
case 2:
|
|
13149
13127
|
wheelEvent = _context7.sent;
|
|
13150
13128
|
_this.dispatchEvent(wheelEvent);
|
|
13151
13129
|
_this.freeEvent(wheelEvent);
|
|
13152
|
-
case
|
|
13130
|
+
case 5:
|
|
13153
13131
|
case "end":
|
|
13154
13132
|
return _context7.stop();
|
|
13155
13133
|
}
|
|
@@ -13562,7 +13540,13 @@ var EventService = /*#__PURE__*/function () {
|
|
|
13562
13540
|
return event;
|
|
13563
13541
|
};
|
|
13564
13542
|
_proto.copyPointerData = function copyPointerData(from, to) {
|
|
13565
|
-
if (
|
|
13543
|
+
// if (
|
|
13544
|
+
// !(
|
|
13545
|
+
// from instanceof FederatedPointerEvent &&
|
|
13546
|
+
// to instanceof FederatedPointerEvent
|
|
13547
|
+
// )
|
|
13548
|
+
// )
|
|
13549
|
+
// return;
|
|
13566
13550
|
to.pointerId = from.pointerId;
|
|
13567
13551
|
to.width = from.width;
|
|
13568
13552
|
to.height = from.height;
|
|
@@ -13575,7 +13559,12 @@ var EventService = /*#__PURE__*/function () {
|
|
|
13575
13559
|
to.twist = from.twist;
|
|
13576
13560
|
};
|
|
13577
13561
|
_proto.copyMouseData = function copyMouseData(from, to) {
|
|
13578
|
-
if (
|
|
13562
|
+
// if (
|
|
13563
|
+
// !(
|
|
13564
|
+
// from instanceof FederatedMouseEvent && to instanceof FederatedMouseEvent
|
|
13565
|
+
// )
|
|
13566
|
+
// )
|
|
13567
|
+
// return;
|
|
13579
13568
|
to.altKey = from.altKey;
|
|
13580
13569
|
to.button = from.button;
|
|
13581
13570
|
to.buttons = from.buttons;
|
|
@@ -13836,7 +13825,7 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
13836
13825
|
case 0:
|
|
13837
13826
|
context = _extends({}, this.globalRuntime, this.context); // register rendering plugins
|
|
13838
13827
|
this.context.renderingPlugins.forEach(function (plugin) {
|
|
13839
|
-
plugin.apply(context);
|
|
13828
|
+
plugin.apply(context, runtime);
|
|
13840
13829
|
});
|
|
13841
13830
|
// await this.hooks.init.callPromise();
|
|
13842
13831
|
_context.next = 4;
|
|
@@ -13869,7 +13858,7 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
13869
13858
|
enableDirtyRectangleRendering = _renderer$getConfig.enableDirtyRectangleRendering;
|
|
13870
13859
|
return !enableDirtyRectangleRendering || this.context.renderingContext.renderReasons.has(exports.RenderReason.CAMERA_CHANGED);
|
|
13871
13860
|
};
|
|
13872
|
-
_proto.render = function render(canvasConfig) {
|
|
13861
|
+
_proto.render = function render(canvasConfig, rerenderCallback) {
|
|
13873
13862
|
var _this = this;
|
|
13874
13863
|
this.stats.total = 0;
|
|
13875
13864
|
this.stats.rendered = 0;
|
|
@@ -13888,6 +13877,7 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
13888
13877
|
this.hooks.endFrame.call();
|
|
13889
13878
|
renderingContext.renderListCurrentFrame = [];
|
|
13890
13879
|
renderingContext.renderReasons.clear();
|
|
13880
|
+
rerenderCallback();
|
|
13891
13881
|
}
|
|
13892
13882
|
// console.log('stats', this.stats);
|
|
13893
13883
|
};
|
|
@@ -13936,6 +13926,7 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
13936
13926
|
_proto.destroy = function destroy() {
|
|
13937
13927
|
this.inited = false;
|
|
13938
13928
|
this.hooks.destroy.call();
|
|
13929
|
+
this.globalRuntime.sceneGraphService.clearPendingEvents();
|
|
13939
13930
|
};
|
|
13940
13931
|
_proto.dirtify = function dirtify() {
|
|
13941
13932
|
// need re-render
|
|
@@ -14487,9 +14478,12 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14487
14478
|
trigger(element, detail);
|
|
14488
14479
|
}
|
|
14489
14480
|
});
|
|
14490
|
-
this.
|
|
14481
|
+
this.clearPendingEvents();
|
|
14491
14482
|
set.clear();
|
|
14492
14483
|
};
|
|
14484
|
+
_proto.clearPendingEvents = function clearPendingEvents() {
|
|
14485
|
+
this.pendingEvents = [];
|
|
14486
|
+
};
|
|
14493
14487
|
_proto.dirtifyToRoot = function dirtifyToRoot(element, affectChildren) {
|
|
14494
14488
|
if (affectChildren === void 0) {
|
|
14495
14489
|
affectChildren = false;
|
|
@@ -15870,6 +15864,7 @@ function isCanvas(value) {
|
|
|
15870
15864
|
(function (CanvasEvent) {
|
|
15871
15865
|
CanvasEvent["READY"] = "ready";
|
|
15872
15866
|
CanvasEvent["BEFORE_RENDER"] = "beforerender";
|
|
15867
|
+
CanvasEvent["RERENDER"] = "rerender";
|
|
15873
15868
|
CanvasEvent["AFTER_RENDER"] = "afterrender";
|
|
15874
15869
|
CanvasEvent["BEFORE_DESTROY"] = "beforedestroy";
|
|
15875
15870
|
CanvasEvent["AFTER_DESTROY"] = "afterdestroy";
|
|
@@ -15885,6 +15880,7 @@ var DEFAULT_CAMERA_FAR = 1000;
|
|
|
15885
15880
|
var mountedEvent = new CustomEvent(exports.ElementEvent.MOUNTED);
|
|
15886
15881
|
var unmountedEvent = new CustomEvent(exports.ElementEvent.UNMOUNTED);
|
|
15887
15882
|
var beforeRenderEvent = new CustomEvent(exports.CanvasEvent.BEFORE_RENDER);
|
|
15883
|
+
var rerenderEvent = new CustomEvent(exports.CanvasEvent.RERENDER);
|
|
15888
15884
|
var afterRenderEvent = new CustomEvent(exports.CanvasEvent.AFTER_RENDER);
|
|
15889
15885
|
/**
|
|
15890
15886
|
* can be treated like Window in DOM
|
|
@@ -16210,16 +16206,21 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
16210
16206
|
this.document.documentElement.destroyChildren();
|
|
16211
16207
|
};
|
|
16212
16208
|
_proto.render = function render() {
|
|
16209
|
+
var _this3 = this;
|
|
16213
16210
|
this.dispatchEvent(beforeRenderEvent);
|
|
16214
16211
|
var renderingService = this.getRenderingService();
|
|
16215
|
-
renderingService.render(this.getConfig())
|
|
16212
|
+
renderingService.render(this.getConfig(), function () {
|
|
16213
|
+
// trigger actual rerender event
|
|
16214
|
+
// @see https://github.com/antvis/G/issues/1268
|
|
16215
|
+
_this3.dispatchEvent(rerenderEvent);
|
|
16216
|
+
});
|
|
16216
16217
|
this.dispatchEvent(afterRenderEvent);
|
|
16217
16218
|
};
|
|
16218
16219
|
_proto.run = function run() {
|
|
16219
|
-
var
|
|
16220
|
+
var _this4 = this;
|
|
16220
16221
|
var tick = function tick() {
|
|
16221
|
-
|
|
16222
|
-
|
|
16222
|
+
_this4.render();
|
|
16223
|
+
_this4.frameId = requestAnimationFrame(tick);
|
|
16223
16224
|
};
|
|
16224
16225
|
tick();
|
|
16225
16226
|
};
|
|
@@ -16285,12 +16286,12 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
16285
16286
|
return initRenderer;
|
|
16286
16287
|
}();
|
|
16287
16288
|
_proto.loadRendererContainerModule = function loadRendererContainerModule(renderer) {
|
|
16288
|
-
var
|
|
16289
|
+
var _this5 = this;
|
|
16289
16290
|
// load other container modules provided by g-canvas/g-svg/g-webgl
|
|
16290
16291
|
var plugins = renderer.getPlugins();
|
|
16291
16292
|
plugins.forEach(function (plugin) {
|
|
16292
|
-
plugin.context =
|
|
16293
|
-
plugin.init();
|
|
16293
|
+
plugin.context = _this5.context;
|
|
16294
|
+
plugin.init(runtime);
|
|
16294
16295
|
});
|
|
16295
16296
|
};
|
|
16296
16297
|
_proto.setRenderer = /*#__PURE__*/function () {
|
|
@@ -16314,7 +16315,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
16314
16315
|
this.destroy(false, true);
|
|
16315
16316
|
// destroy all plugins, reverse will mutate origin array
|
|
16316
16317
|
[].concat(oldRenderer === null || oldRenderer === void 0 ? void 0 : oldRenderer.getPlugins()).reverse().forEach(function (plugin) {
|
|
16317
|
-
plugin.destroy();
|
|
16318
|
+
plugin.destroy(runtime);
|
|
16318
16319
|
});
|
|
16319
16320
|
_context3.next = 9;
|
|
16320
16321
|
return this.initRenderer(renderer);
|
|
@@ -16336,10 +16337,10 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
16336
16337
|
this.getContextService().applyCursorStyle(cursor);
|
|
16337
16338
|
};
|
|
16338
16339
|
_proto.unmountChildren = function unmountChildren(parent) {
|
|
16339
|
-
var
|
|
16340
|
+
var _this6 = this;
|
|
16340
16341
|
// unmountChildren recursively
|
|
16341
16342
|
parent.childNodes.forEach(function (child) {
|
|
16342
|
-
|
|
16343
|
+
_this6.unmountChildren(child);
|
|
16343
16344
|
});
|
|
16344
16345
|
if (this.inited) {
|
|
16345
16346
|
if (parent.isMutationObserved) {
|
|
@@ -16362,7 +16363,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
16362
16363
|
}
|
|
16363
16364
|
};
|
|
16364
16365
|
_proto.mountChildren = function mountChildren(parent) {
|
|
16365
|
-
var
|
|
16366
|
+
var _this7 = this;
|
|
16366
16367
|
if (this.inited) {
|
|
16367
16368
|
if (!parent.isConnected) {
|
|
16368
16369
|
parent.ownerDocument = this.document;
|
|
@@ -16379,7 +16380,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
16379
16380
|
}
|
|
16380
16381
|
// recursively mount children
|
|
16381
16382
|
parent.childNodes.forEach(function (child) {
|
|
16382
|
-
|
|
16383
|
+
_this7.mountChildren(child);
|
|
16383
16384
|
});
|
|
16384
16385
|
// trigger after mounted
|
|
16385
16386
|
if (parent.isCustomElement) {
|
|
@@ -16423,11 +16424,11 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
16423
16424
|
_createClass(Canvas, [{
|
|
16424
16425
|
key: "ready",
|
|
16425
16426
|
get: function get() {
|
|
16426
|
-
var
|
|
16427
|
+
var _this8 = this;
|
|
16427
16428
|
if (!this.readyPromise) {
|
|
16428
16429
|
this.readyPromise = new Promise(function (resolve) {
|
|
16429
|
-
|
|
16430
|
-
resolve(
|
|
16430
|
+
_this8.resolveReadyPromise = function () {
|
|
16431
|
+
resolve(_this8);
|
|
16431
16432
|
};
|
|
16432
16433
|
});
|
|
16433
16434
|
if (this.inited) {
|