@antv/g-lite 1.2.23 → 1.2.24
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/index.esm.js +17 -23
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +17 -23
- package/dist/index.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/services/EventService.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -9777,10 +9777,13 @@ var EventService = /** @class */ (function () {
|
|
|
9777
9777
|
* whether the native event trigger came from Canvas,
|
|
9778
9778
|
* should account for HTML shape
|
|
9779
9779
|
*/
|
|
9780
|
-
EventService.prototype.isNativeEventFromCanvas = function (
|
|
9781
|
-
var
|
|
9782
|
-
|
|
9783
|
-
|
|
9780
|
+
EventService.prototype.isNativeEventFromCanvas = function ($el, nativeEvent) {
|
|
9781
|
+
var target = nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.target;
|
|
9782
|
+
// Get event target inside a web component.
|
|
9783
|
+
// @see https://stackoverflow.com/questions/57963312/get-event-target-inside-a-web-component
|
|
9784
|
+
if (target === null || target === void 0 ? void 0 : target.shadowRoot) {
|
|
9785
|
+
target = nativeEvent.composedPath()[0];
|
|
9786
|
+
}
|
|
9784
9787
|
if (target) {
|
|
9785
9788
|
// from <canvas>
|
|
9786
9789
|
if (target === $el) {
|
|
@@ -9791,8 +9794,8 @@ var EventService = /** @class */ (function () {
|
|
|
9791
9794
|
return $el.contains(target);
|
|
9792
9795
|
}
|
|
9793
9796
|
}
|
|
9794
|
-
if (
|
|
9795
|
-
return
|
|
9797
|
+
if (nativeEvent === null || nativeEvent === void 0 ? void 0 : nativeEvent.composedPath) {
|
|
9798
|
+
return nativeEvent.composedPath().indexOf($el) > -1;
|
|
9796
9799
|
}
|
|
9797
9800
|
// account for Touch
|
|
9798
9801
|
return false;
|
|
@@ -9840,9 +9843,11 @@ var EventService = /** @class */ (function () {
|
|
|
9840
9843
|
event.nativeEvent = from.nativeEvent;
|
|
9841
9844
|
event.originalEvent = from;
|
|
9842
9845
|
var existedHTML = this.getExistedHTML(event);
|
|
9846
|
+
var $el = this.context.contextService.getDomElement();
|
|
9843
9847
|
event.target =
|
|
9844
9848
|
target !== null && target !== void 0 ? target : (existedHTML ||
|
|
9845
|
-
(this.isNativeEventFromCanvas(event) &&
|
|
9849
|
+
(this.isNativeEventFromCanvas($el, event.nativeEvent) &&
|
|
9850
|
+
this.pickTarget(event)) ||
|
|
9846
9851
|
fallbackTarget);
|
|
9847
9852
|
if (typeof type === 'string') {
|
|
9848
9853
|
event.type = type;
|
|
@@ -9857,9 +9862,11 @@ var EventService = /** @class */ (function () {
|
|
|
9857
9862
|
event.nativeEvent = from.nativeEvent;
|
|
9858
9863
|
event.originalEvent = from;
|
|
9859
9864
|
var existedHTML = this.getExistedHTML(event);
|
|
9865
|
+
var $el = this.context.contextService.getDomElement();
|
|
9860
9866
|
event.target =
|
|
9861
9867
|
existedHTML ||
|
|
9862
|
-
(this.isNativeEventFromCanvas(event) &&
|
|
9868
|
+
(this.isNativeEventFromCanvas($el, event.nativeEvent) &&
|
|
9869
|
+
this.pickTarget(event));
|
|
9863
9870
|
return event;
|
|
9864
9871
|
};
|
|
9865
9872
|
EventService.prototype.trackingData = function (id) {
|
|
@@ -14534,21 +14541,8 @@ var EventPlugin = /** @class */ (function () {
|
|
|
14534
14541
|
return;
|
|
14535
14542
|
// account for element in SVG
|
|
14536
14543
|
var $element = _this.context.contextService.getDomElement();
|
|
14537
|
-
var
|
|
14538
|
-
|
|
14539
|
-
outside =
|
|
14540
|
-
$element &&
|
|
14541
|
-
nativeEvent.target &&
|
|
14542
|
-
nativeEvent.target !== $element &&
|
|
14543
|
-
$element.contains &&
|
|
14544
|
-
!$element.contains(nativeEvent.target)
|
|
14545
|
-
? 'outside'
|
|
14546
|
-
: '';
|
|
14547
|
-
}
|
|
14548
|
-
catch (e) {
|
|
14549
|
-
// nativeEvent.target maybe not Node, such as Window
|
|
14550
|
-
// @see https://github.com/antvis/G/issues/1235
|
|
14551
|
-
}
|
|
14544
|
+
var isNativeEventFromCanvas = _this.context.eventService.isNativeEventFromCanvas($element, nativeEvent);
|
|
14545
|
+
var outside = !isNativeEventFromCanvas ? 'outside' : '';
|
|
14552
14546
|
var normalizedEvents = _this.normalizeToPointerEvent(nativeEvent, canvas);
|
|
14553
14547
|
try {
|
|
14554
14548
|
for (var normalizedEvents_3 = __values(normalizedEvents), normalizedEvents_3_1 = normalizedEvents_3.next(); !normalizedEvents_3_1.done; normalizedEvents_3_1 = normalizedEvents_3.next()) {
|