@antv/g-lite 1.0.48 → 1.0.50
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/Canvas.d.ts.map +1 -1
- package/dist/css/parser/dimension.d.ts.map +1 -1
- package/dist/dom/Element.d.ts.map +1 -1
- package/dist/index.esm.js +883 -922
- package/dist/index.js +883 -922
- package/dist/index.umd.js +883 -922
- package/dist/index.umd.min.js +1 -1
- package/dist/plugins/EventPlugin.d.ts.map +1 -1
- package/dist/services/EventService.d.ts +12 -10
- package/dist/services/EventService.d.ts.map +1 -1
- package/dist/services/RenderingService.d.ts +1 -0
- package/dist/services/RenderingService.d.ts.map +1 -1
- package/dist/services/SceneGraphService.d.ts.map +1 -1
- package/dist/services/TextService.d.ts.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -2028,9 +2028,7 @@ function normalize(out, mat) {
|
|
|
2028
2028
|
// Cannot normalize.
|
|
2029
2029
|
if (m44 === 0) return false;
|
|
2030
2030
|
var scale = 1 / m44;
|
|
2031
|
-
for (var i = 0; i < 16; i++)
|
|
2032
|
-
out[i] = mat[i] * scale;
|
|
2033
|
-
}
|
|
2031
|
+
for (var i = 0; i < 16; i++) out[i] = mat[i] * scale;
|
|
2034
2032
|
return true;
|
|
2035
2033
|
}
|
|
2036
2034
|
//gets upper-left of a 4x4 matrix into a 3x3 of vectors
|
|
@@ -3726,7 +3724,7 @@ var HookCodeFactory = /*#__PURE__*/function () {
|
|
|
3726
3724
|
var code = '';
|
|
3727
3725
|
var current = onDone;
|
|
3728
3726
|
var unrollCounter = 0;
|
|
3729
|
-
var _loop = function _loop(
|
|
3727
|
+
var _loop = function _loop() {
|
|
3730
3728
|
var i = j;
|
|
3731
3729
|
var unroll = current !== onDone && (_this2.options.taps[i].type !== 'sync' || unrollCounter++ > 20);
|
|
3732
3730
|
if (unroll) {
|
|
@@ -3758,7 +3756,7 @@ var HookCodeFactory = /*#__PURE__*/function () {
|
|
|
3758
3756
|
};
|
|
3759
3757
|
};
|
|
3760
3758
|
for (var j = this.options.taps.length - 1; j >= 0; j--) {
|
|
3761
|
-
_loop(
|
|
3759
|
+
_loop();
|
|
3762
3760
|
}
|
|
3763
3761
|
code += current();
|
|
3764
3762
|
return code;
|
|
@@ -4283,12 +4281,10 @@ function spaceColorStops(colorStops) {
|
|
|
4283
4281
|
// support '%' & 'px'
|
|
4284
4282
|
var offset = (_colorStops$i$length = colorStops[i].length) === null || _colorStops$i$length === void 0 ? void 0 : _colorStops$i$length.value;
|
|
4285
4283
|
if (!isNil(offset) && !isNil(previousOffset)) {
|
|
4286
|
-
for (var j = 1; j < i - previousIndex; j++) {
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
};
|
|
4291
|
-
}
|
|
4284
|
+
for (var j = 1; j < i - previousIndex; j++) colorStops[previousIndex + j].length = {
|
|
4285
|
+
type: '%',
|
|
4286
|
+
value: "" + (previousOffset + (Number(offset) - previousOffset) * j / (i - previousIndex))
|
|
4287
|
+
};
|
|
4292
4288
|
previousIndex = i;
|
|
4293
4289
|
previousOffset = Number(offset);
|
|
4294
4290
|
}
|
|
@@ -4565,9 +4561,7 @@ function mergeColors(left, right) {
|
|
|
4565
4561
|
return [[Number(left.r), Number(left.g), Number(left.b), Number(left.alpha)], [Number(right.r), Number(right.g), Number(right.b), Number(right.alpha)], function (color) {
|
|
4566
4562
|
var rgba = color.slice();
|
|
4567
4563
|
if (rgba[3]) {
|
|
4568
|
-
for (var i = 0; i < 3; i++)
|
|
4569
|
-
rgba[i] = Math.round(clamp(rgba[i], 0, 255));
|
|
4570
|
-
}
|
|
4564
|
+
for (var i = 0; i < 3; i++) rgba[i] = Math.round(clamp(rgba[i], 0, 255));
|
|
4571
4565
|
}
|
|
4572
4566
|
rgba[3] = clamp(rgba[3], 0, 1);
|
|
4573
4567
|
return "rgba(" + rgba.join(',') + ")";
|
|
@@ -5361,7 +5355,7 @@ function mergeTransforms(left, right, target) {
|
|
|
5361
5355
|
left = right;
|
|
5362
5356
|
right = [];
|
|
5363
5357
|
}
|
|
5364
|
-
var _loop = function _loop(
|
|
5358
|
+
var _loop = function _loop() {
|
|
5365
5359
|
var _left$i = left[i],
|
|
5366
5360
|
type = _left$i.t,
|
|
5367
5361
|
args = _left$i.d;
|
|
@@ -5382,7 +5376,7 @@ function mergeTransforms(left, right, target) {
|
|
|
5382
5376
|
});
|
|
5383
5377
|
};
|
|
5384
5378
|
for (var i = 0; i < left.length; i++) {
|
|
5385
|
-
_loop(
|
|
5379
|
+
_loop();
|
|
5386
5380
|
}
|
|
5387
5381
|
}
|
|
5388
5382
|
var leftResult = [];
|
|
@@ -6285,6 +6279,9 @@ var Rectangle = /*#__PURE__*/function () {
|
|
|
6285
6279
|
|
|
6286
6280
|
var CSSPropertyPath = /*#__PURE__*/function () {
|
|
6287
6281
|
function CSSPropertyPath() {
|
|
6282
|
+
/**
|
|
6283
|
+
* path2Curve
|
|
6284
|
+
*/
|
|
6288
6285
|
this.parser = parsePath;
|
|
6289
6286
|
this.parserWithCSSDisabled = parsePath;
|
|
6290
6287
|
this.mixer = mergePaths;
|
|
@@ -6532,26 +6529,83 @@ var FederatedEvent = /*#__PURE__*/function () {
|
|
|
6532
6529
|
* within the boundary's jurisdiction.
|
|
6533
6530
|
*/
|
|
6534
6531
|
function FederatedEvent(manager) {
|
|
6532
|
+
/**
|
|
6533
|
+
* The type of event, supports the following:
|
|
6534
|
+
* * pointerdown
|
|
6535
|
+
* * touchstart
|
|
6536
|
+
* * mousedown
|
|
6537
|
+
* * rightdown
|
|
6538
|
+
* * ...
|
|
6539
|
+
*/
|
|
6535
6540
|
this.type = void 0;
|
|
6541
|
+
/**
|
|
6542
|
+
* The propagation phase.
|
|
6543
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
|
|
6544
|
+
*/
|
|
6536
6545
|
this.eventPhase = FederatedEvent.prototype.NONE;
|
|
6546
|
+
/**
|
|
6547
|
+
* can be used to implement event delegation
|
|
6548
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/target
|
|
6549
|
+
*/
|
|
6537
6550
|
this.target = void 0;
|
|
6551
|
+
/**
|
|
6552
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/bubbles
|
|
6553
|
+
*/
|
|
6538
6554
|
this.bubbles = true;
|
|
6555
|
+
/**
|
|
6556
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/cancelBubble
|
|
6557
|
+
*/
|
|
6539
6558
|
this.cancelBubble = true;
|
|
6559
|
+
/**
|
|
6560
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable
|
|
6561
|
+
*/
|
|
6540
6562
|
this.cancelable = false;
|
|
6563
|
+
/** the event target when listeners binded */
|
|
6541
6564
|
this.currentTarget = void 0;
|
|
6565
|
+
/** Flags whether the default response of the user agent was prevent through this event. */
|
|
6542
6566
|
this.defaultPrevented = false;
|
|
6567
|
+
/**
|
|
6568
|
+
* timestamp when the event created
|
|
6569
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/timeStamp
|
|
6570
|
+
*/
|
|
6543
6571
|
this.timeStamp = void 0;
|
|
6572
|
+
/**
|
|
6573
|
+
* the original event.
|
|
6574
|
+
*/
|
|
6544
6575
|
this.nativeEvent = void 0;
|
|
6576
|
+
/** The original event that caused this event, if any. */
|
|
6545
6577
|
this.originalEvent = void 0;
|
|
6578
|
+
/** Flags whether propagation was stopped. */
|
|
6546
6579
|
this.propagationStopped = false;
|
|
6580
|
+
/** Flags whether propagation was immediately stopped. */
|
|
6547
6581
|
this.propagationImmediatelyStopped = false;
|
|
6548
6582
|
this.manager = void 0;
|
|
6583
|
+
/** Event-specific detail */
|
|
6549
6584
|
this.detail = void 0;
|
|
6585
|
+
/**
|
|
6586
|
+
* The coordinates of the evnet relative to the nearest DOM layer.
|
|
6587
|
+
* This is a non-standard property.
|
|
6588
|
+
*/
|
|
6550
6589
|
this.layer = new Point();
|
|
6590
|
+
/**
|
|
6591
|
+
* The coordinates of the event relative to the DOM document.
|
|
6592
|
+
* This is a non-standard property.
|
|
6593
|
+
* relative to the DOM document.
|
|
6594
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/pageX
|
|
6595
|
+
*/
|
|
6551
6596
|
this.page = new Point();
|
|
6597
|
+
/**
|
|
6598
|
+
* relative to Canvas, origin is left-top
|
|
6599
|
+
*/
|
|
6552
6600
|
this.canvas = new Point();
|
|
6601
|
+
/**
|
|
6602
|
+
* relative to Viewport, account for Camera
|
|
6603
|
+
*/
|
|
6553
6604
|
this.viewport = new Point();
|
|
6554
6605
|
this.path = void 0;
|
|
6606
|
+
/**
|
|
6607
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
|
|
6608
|
+
*/
|
|
6555
6609
|
this.view = void 0;
|
|
6556
6610
|
this.which = void 0;
|
|
6557
6611
|
this.returnValue = void 0;
|
|
@@ -6601,10 +6655,7 @@ var FederatedEvent = /*#__PURE__*/function () {
|
|
|
6601
6655
|
*/;
|
|
6602
6656
|
_proto.stopPropagation = function stopPropagation() {
|
|
6603
6657
|
this.propagationStopped = true;
|
|
6604
|
-
}
|
|
6605
|
-
/**
|
|
6606
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
|
|
6607
|
-
*/;
|
|
6658
|
+
};
|
|
6608
6659
|
/**
|
|
6609
6660
|
* added for compatibility with DOM Event,
|
|
6610
6661
|
* deprecated props and methods
|
|
@@ -6617,25 +6668,12 @@ var FederatedEvent = /*#__PURE__*/function () {
|
|
|
6617
6668
|
_createClass(FederatedEvent, [{
|
|
6618
6669
|
key: "name",
|
|
6619
6670
|
get:
|
|
6620
|
-
/**
|
|
6621
|
-
* The type of event, supports the following:
|
|
6622
|
-
* * pointerdown
|
|
6623
|
-
* * touchstart
|
|
6624
|
-
* * mousedown
|
|
6625
|
-
* * rightdown
|
|
6626
|
-
* * ...
|
|
6627
|
-
*/
|
|
6628
|
-
|
|
6629
6671
|
/**
|
|
6630
6672
|
* @deprecated
|
|
6631
6673
|
*/
|
|
6632
6674
|
function get() {
|
|
6633
6675
|
return this.type;
|
|
6634
6676
|
}
|
|
6635
|
-
/**
|
|
6636
|
-
* The propagation phase.
|
|
6637
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
|
|
6638
|
-
*/
|
|
6639
6677
|
}, {
|
|
6640
6678
|
key: "layerX",
|
|
6641
6679
|
get: function get() {
|
|
@@ -6646,12 +6684,6 @@ var FederatedEvent = /*#__PURE__*/function () {
|
|
|
6646
6684
|
get: function get() {
|
|
6647
6685
|
return this.layer.y;
|
|
6648
6686
|
}
|
|
6649
|
-
/**
|
|
6650
|
-
* The coordinates of the event relative to the DOM document.
|
|
6651
|
-
* This is a non-standard property.
|
|
6652
|
-
* relative to the DOM document.
|
|
6653
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/pageX
|
|
6654
|
-
*/
|
|
6655
6687
|
}, {
|
|
6656
6688
|
key: "pageX",
|
|
6657
6689
|
get: function get() {
|
|
@@ -6662,9 +6694,6 @@ var FederatedEvent = /*#__PURE__*/function () {
|
|
|
6662
6694
|
get: function get() {
|
|
6663
6695
|
return this.page.y;
|
|
6664
6696
|
}
|
|
6665
|
-
/**
|
|
6666
|
-
* relative to Canvas, origin is left-top
|
|
6667
|
-
*/
|
|
6668
6697
|
}, {
|
|
6669
6698
|
key: "x",
|
|
6670
6699
|
get: function get() {
|
|
@@ -6685,9 +6714,6 @@ var FederatedEvent = /*#__PURE__*/function () {
|
|
|
6685
6714
|
get: function get() {
|
|
6686
6715
|
return this.canvas.y;
|
|
6687
6716
|
}
|
|
6688
|
-
/**
|
|
6689
|
-
* relative to Viewport, account for Camera
|
|
6690
|
-
*/
|
|
6691
6717
|
}, {
|
|
6692
6718
|
key: "viewportX",
|
|
6693
6719
|
get: function get() {
|
|
@@ -6742,6 +6768,9 @@ var DELEGATION_SPLITTER = ':';
|
|
|
6742
6768
|
*/
|
|
6743
6769
|
var EventTarget = /*#__PURE__*/function () {
|
|
6744
6770
|
function EventTarget() {
|
|
6771
|
+
/**
|
|
6772
|
+
* event emitter
|
|
6773
|
+
*/
|
|
6745
6774
|
this.emitter = new EventEmitter();
|
|
6746
6775
|
}
|
|
6747
6776
|
var _proto = EventTarget.prototype;
|
|
@@ -6884,13 +6913,44 @@ var Node = /*#__PURE__*/function (_EventTarget) {
|
|
|
6884
6913
|
}
|
|
6885
6914
|
_this = _EventTarget.call.apply(_EventTarget, [this].concat(args)) || this;
|
|
6886
6915
|
_this.shadow = false;
|
|
6916
|
+
/**
|
|
6917
|
+
* points to canvas.document
|
|
6918
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument
|
|
6919
|
+
*/
|
|
6887
6920
|
_this.ownerDocument = null;
|
|
6921
|
+
/**
|
|
6922
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isConnected
|
|
6923
|
+
* @example
|
|
6924
|
+
circle.isConnected; // false
|
|
6925
|
+
canvas.appendChild(circle);
|
|
6926
|
+
circle.isConnected; // true
|
|
6927
|
+
*/
|
|
6888
6928
|
_this.isConnected = false;
|
|
6929
|
+
/**
|
|
6930
|
+
* Returns node's node document's document base URL.
|
|
6931
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node
|
|
6932
|
+
*/
|
|
6889
6933
|
_this.baseURI = '';
|
|
6934
|
+
/**
|
|
6935
|
+
* Returns the children.
|
|
6936
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
|
|
6937
|
+
*/
|
|
6890
6938
|
_this.childNodes = [];
|
|
6939
|
+
/**
|
|
6940
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeType
|
|
6941
|
+
*/
|
|
6891
6942
|
_this.nodeType = 0;
|
|
6943
|
+
/**
|
|
6944
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeName
|
|
6945
|
+
*/
|
|
6892
6946
|
_this.nodeName = '';
|
|
6947
|
+
/**
|
|
6948
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeValue
|
|
6949
|
+
*/
|
|
6893
6950
|
_this.nodeValue = null;
|
|
6951
|
+
/**
|
|
6952
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
6953
|
+
*/
|
|
6894
6954
|
_this.parentNode = null;
|
|
6895
6955
|
return _this;
|
|
6896
6956
|
}
|
|
@@ -6937,10 +6997,7 @@ var Node = /*#__PURE__*/function (_EventTarget) {
|
|
|
6937
6997
|
};
|
|
6938
6998
|
_proto.isSameNode = function isSameNode(otherNode) {
|
|
6939
6999
|
return this.isEqualNode(otherNode);
|
|
6940
|
-
}
|
|
6941
|
-
/**
|
|
6942
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
6943
|
-
*/;
|
|
7000
|
+
};
|
|
6944
7001
|
/**
|
|
6945
7002
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
6946
7003
|
* @see https://github.com/b-fuze/deno-dom/blob/master/src/dom/node.ts#L338
|
|
@@ -7115,11 +7172,30 @@ var Node = /*#__PURE__*/function (_EventTarget) {
|
|
|
7115
7172
|
}]);
|
|
7116
7173
|
return Node;
|
|
7117
7174
|
}(EventTarget);
|
|
7175
|
+
/**
|
|
7176
|
+
* Both nodes are in different documents or different trees in the same document.
|
|
7177
|
+
*/
|
|
7118
7178
|
Node.DOCUMENT_POSITION_DISCONNECTED = 1;
|
|
7179
|
+
/**
|
|
7180
|
+
* otherNode precedes the node in either a pre-order depth-first traversal
|
|
7181
|
+
* of a tree containing both (e.g., as an ancestor or previous sibling or a descendant of a previous sibling or previous sibling of an ancestor) or (if they are disconnected) in an arbitrary but consistent ordering.
|
|
7182
|
+
*/
|
|
7119
7183
|
Node.DOCUMENT_POSITION_PRECEDING = 2;
|
|
7184
|
+
/**
|
|
7185
|
+
* otherNode follows the node in either a pre-order depth-first traversal of a tree containing both (e.g., as a descendant or following sibling or a descendant of a following sibling or following sibling of an ancestor) or (if they are disconnected) in an arbitrary but consistent ordering.
|
|
7186
|
+
*/
|
|
7120
7187
|
Node.DOCUMENT_POSITION_FOLLOWING = 4;
|
|
7188
|
+
/**
|
|
7189
|
+
* otherNode is an ancestor of the node.
|
|
7190
|
+
*/
|
|
7121
7191
|
Node.DOCUMENT_POSITION_CONTAINS = 8;
|
|
7192
|
+
/**
|
|
7193
|
+
* otherNode is a descendant of the node.
|
|
7194
|
+
*/
|
|
7122
7195
|
Node.DOCUMENT_POSITION_CONTAINED_BY = 16;
|
|
7196
|
+
/**
|
|
7197
|
+
* The result relies upon arbitrary and/or implementation-specific behavior and is not guaranteed to be portable.
|
|
7198
|
+
*/
|
|
7123
7199
|
Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
|
|
7124
7200
|
|
|
7125
7201
|
/**
|
|
@@ -7132,8 +7208,19 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
7132
7208
|
function Document() {
|
|
7133
7209
|
var _this;
|
|
7134
7210
|
_this = _Node.call(this) || this;
|
|
7211
|
+
/**
|
|
7212
|
+
* only document has defaultView, points to canvas,
|
|
7213
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/defaultView
|
|
7214
|
+
*/
|
|
7135
7215
|
_this.defaultView = null;
|
|
7216
|
+
/**
|
|
7217
|
+
* the root element of document, eg. <html>
|
|
7218
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement
|
|
7219
|
+
*/
|
|
7136
7220
|
_this.documentElement = void 0;
|
|
7221
|
+
/**
|
|
7222
|
+
* document.timeline in WAAPI
|
|
7223
|
+
*/
|
|
7137
7224
|
_this.timeline = void 0;
|
|
7138
7225
|
_this.ownerDocument = null;
|
|
7139
7226
|
_this.nodeName = 'document';
|
|
@@ -7271,45 +7358,43 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
7271
7358
|
var _elementFromPoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(x, y) {
|
|
7272
7359
|
var _this$defaultView$can2, viewportX, viewportY, _this$defaultView$get3, width, height, _this$defaultView$vie2, clientX, clientY, _yield$this$defaultVi, picked;
|
|
7273
7360
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7274
|
-
while (1) {
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7361
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7362
|
+
case 0:
|
|
7363
|
+
_this$defaultView$can2 = this.defaultView.canvas2Viewport({
|
|
7364
|
+
x: x,
|
|
7365
|
+
y: y
|
|
7366
|
+
}), viewportX = _this$defaultView$can2.x, viewportY = _this$defaultView$can2.y;
|
|
7367
|
+
_this$defaultView$get3 = this.defaultView.getConfig(), width = _this$defaultView$get3.width, height = _this$defaultView$get3.height; // outside canvas' viewport
|
|
7368
|
+
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
7369
|
+
_context.next = 4;
|
|
7370
|
+
break;
|
|
7371
|
+
}
|
|
7372
|
+
return _context.abrupt("return", null);
|
|
7373
|
+
case 4:
|
|
7374
|
+
_this$defaultView$vie2 = this.defaultView.viewport2Client({
|
|
7375
|
+
x: viewportX,
|
|
7376
|
+
y: viewportY
|
|
7377
|
+
}), clientX = _this$defaultView$vie2.x, clientY = _this$defaultView$vie2.y;
|
|
7378
|
+
_context.next = 7;
|
|
7379
|
+
return this.defaultView.getRenderingService().hooks.pick.promise({
|
|
7380
|
+
topmost: true,
|
|
7381
|
+
position: {
|
|
7278
7382
|
x: x,
|
|
7279
|
-
y: y
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
topmost: true,
|
|
7295
|
-
position: {
|
|
7296
|
-
x: x,
|
|
7297
|
-
y: y,
|
|
7298
|
-
viewportX: viewportX,
|
|
7299
|
-
viewportY: viewportY,
|
|
7300
|
-
clientX: clientX,
|
|
7301
|
-
clientY: clientY
|
|
7302
|
-
},
|
|
7303
|
-
picked: []
|
|
7304
|
-
});
|
|
7305
|
-
case 7:
|
|
7306
|
-
_yield$this$defaultVi = _context.sent;
|
|
7307
|
-
picked = _yield$this$defaultVi.picked;
|
|
7308
|
-
return _context.abrupt("return", picked && picked[0] || this.documentElement);
|
|
7309
|
-
case 10:
|
|
7310
|
-
case "end":
|
|
7311
|
-
return _context.stop();
|
|
7312
|
-
}
|
|
7383
|
+
y: y,
|
|
7384
|
+
viewportX: viewportX,
|
|
7385
|
+
viewportY: viewportY,
|
|
7386
|
+
clientX: clientX,
|
|
7387
|
+
clientY: clientY
|
|
7388
|
+
},
|
|
7389
|
+
picked: []
|
|
7390
|
+
});
|
|
7391
|
+
case 7:
|
|
7392
|
+
_yield$this$defaultVi = _context.sent;
|
|
7393
|
+
picked = _yield$this$defaultVi.picked;
|
|
7394
|
+
return _context.abrupt("return", picked && picked[0] || this.documentElement);
|
|
7395
|
+
case 10:
|
|
7396
|
+
case "end":
|
|
7397
|
+
return _context.stop();
|
|
7313
7398
|
}
|
|
7314
7399
|
}, _callee, this);
|
|
7315
7400
|
}));
|
|
@@ -7367,48 +7452,46 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
7367
7452
|
var _elementsFromPoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(x, y) {
|
|
7368
7453
|
var _this$defaultView$can4, viewportX, viewportY, _this$defaultView$get6, width, height, _this$defaultView$vie4, clientX, clientY, _yield$this$defaultVi2, picked;
|
|
7369
7454
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7370
|
-
while (1) {
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7455
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7456
|
+
case 0:
|
|
7457
|
+
_this$defaultView$can4 = this.defaultView.canvas2Viewport({
|
|
7458
|
+
x: x,
|
|
7459
|
+
y: y
|
|
7460
|
+
}), viewportX = _this$defaultView$can4.x, viewportY = _this$defaultView$can4.y;
|
|
7461
|
+
_this$defaultView$get6 = this.defaultView.getConfig(), width = _this$defaultView$get6.width, height = _this$defaultView$get6.height; // outside canvas' viewport
|
|
7462
|
+
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
7463
|
+
_context2.next = 4;
|
|
7464
|
+
break;
|
|
7465
|
+
}
|
|
7466
|
+
return _context2.abrupt("return", []);
|
|
7467
|
+
case 4:
|
|
7468
|
+
_this$defaultView$vie4 = this.defaultView.viewport2Client({
|
|
7469
|
+
x: viewportX,
|
|
7470
|
+
y: viewportY
|
|
7471
|
+
}), clientX = _this$defaultView$vie4.x, clientY = _this$defaultView$vie4.y;
|
|
7472
|
+
_context2.next = 7;
|
|
7473
|
+
return this.defaultView.getRenderingService().hooks.pick.promise({
|
|
7474
|
+
topmost: false,
|
|
7475
|
+
position: {
|
|
7374
7476
|
x: x,
|
|
7375
|
-
y: y
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
y: y,
|
|
7394
|
-
viewportX: viewportX,
|
|
7395
|
-
viewportY: viewportY,
|
|
7396
|
-
clientX: clientX,
|
|
7397
|
-
clientY: clientY
|
|
7398
|
-
},
|
|
7399
|
-
picked: []
|
|
7400
|
-
});
|
|
7401
|
-
case 7:
|
|
7402
|
-
_yield$this$defaultVi2 = _context2.sent;
|
|
7403
|
-
picked = _yield$this$defaultVi2.picked;
|
|
7404
|
-
if (picked[picked.length - 1] !== this.documentElement) {
|
|
7405
|
-
picked.push(this.documentElement);
|
|
7406
|
-
}
|
|
7407
|
-
return _context2.abrupt("return", picked);
|
|
7408
|
-
case 11:
|
|
7409
|
-
case "end":
|
|
7410
|
-
return _context2.stop();
|
|
7411
|
-
}
|
|
7477
|
+
y: y,
|
|
7478
|
+
viewportX: viewportX,
|
|
7479
|
+
viewportY: viewportY,
|
|
7480
|
+
clientX: clientX,
|
|
7481
|
+
clientY: clientY
|
|
7482
|
+
},
|
|
7483
|
+
picked: []
|
|
7484
|
+
});
|
|
7485
|
+
case 7:
|
|
7486
|
+
_yield$this$defaultVi2 = _context2.sent;
|
|
7487
|
+
picked = _yield$this$defaultVi2.picked;
|
|
7488
|
+
if (picked[picked.length - 1] !== this.documentElement) {
|
|
7489
|
+
picked.push(this.documentElement);
|
|
7490
|
+
}
|
|
7491
|
+
return _context2.abrupt("return", picked);
|
|
7492
|
+
case 11:
|
|
7493
|
+
case "end":
|
|
7494
|
+
return _context2.stop();
|
|
7412
7495
|
}
|
|
7413
7496
|
}, _callee2, this);
|
|
7414
7497
|
}));
|
|
@@ -7486,10 +7569,6 @@ var Document = /*#__PURE__*/function (_Node) {
|
|
|
7486
7569
|
get: function get() {
|
|
7487
7570
|
return this.lastChild;
|
|
7488
7571
|
}
|
|
7489
|
-
/**
|
|
7490
|
-
* only document has defaultView, points to canvas,
|
|
7491
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/defaultView
|
|
7492
|
-
*/
|
|
7493
7572
|
}]);
|
|
7494
7573
|
return Document;
|
|
7495
7574
|
}(Node);
|
|
@@ -7593,6 +7672,9 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
7593
7672
|
args[_key] = arguments[_key];
|
|
7594
7673
|
}
|
|
7595
7674
|
_this = _Node.call.apply(_Node, [this].concat(args)) || this;
|
|
7675
|
+
/**
|
|
7676
|
+
* Unique id.
|
|
7677
|
+
*/
|
|
7596
7678
|
_this.entity = entityCounter++;
|
|
7597
7679
|
_this.renderable = {
|
|
7598
7680
|
bounds: undefined,
|
|
@@ -7647,14 +7729,36 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
7647
7729
|
_this.rBushNode = {
|
|
7648
7730
|
aabb: undefined
|
|
7649
7731
|
};
|
|
7732
|
+
/**
|
|
7733
|
+
* used with `getElementById()`
|
|
7734
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
|
|
7735
|
+
*/
|
|
7650
7736
|
_this.id = void 0;
|
|
7737
|
+
/**
|
|
7738
|
+
* used in `getElementsByName`
|
|
7739
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
|
|
7740
|
+
*/
|
|
7651
7741
|
_this.name = void 0;
|
|
7742
|
+
/**
|
|
7743
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/API/Element/namespaceURI
|
|
7744
|
+
*/
|
|
7652
7745
|
_this.namespaceURI = 'g';
|
|
7653
7746
|
_this.scrollLeft = 0;
|
|
7654
7747
|
_this.scrollTop = 0;
|
|
7748
|
+
/**
|
|
7749
|
+
* We don't support border now
|
|
7750
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/clientTop
|
|
7751
|
+
*/
|
|
7655
7752
|
_this.clientTop = 0;
|
|
7656
7753
|
_this.clientLeft = 0;
|
|
7754
|
+
/**
|
|
7755
|
+
* is destroyed or not
|
|
7756
|
+
*/
|
|
7657
7757
|
_this.destroyed = false;
|
|
7758
|
+
/**
|
|
7759
|
+
* compatible with `style`
|
|
7760
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
7761
|
+
*/
|
|
7658
7762
|
_this.style = {};
|
|
7659
7763
|
_this.computedStyle = runtime.enableCSSParsing ? {
|
|
7660
7764
|
anchor: unsetKeywordValue,
|
|
@@ -7683,6 +7787,9 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
7683
7787
|
filter: unsetKeywordValue,
|
|
7684
7788
|
shadowType: unsetKeywordValue
|
|
7685
7789
|
} : null;
|
|
7790
|
+
/**
|
|
7791
|
+
* Renderers will use these used values.
|
|
7792
|
+
*/
|
|
7686
7793
|
_this.parsedStyle = {
|
|
7687
7794
|
// opacity: '',
|
|
7688
7795
|
// fillOpacity: '',
|
|
@@ -7703,15 +7810,15 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
7703
7810
|
// textBaseline: '',
|
|
7704
7811
|
// textTransform: '',
|
|
7705
7812
|
};
|
|
7813
|
+
/**
|
|
7814
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
7815
|
+
*/
|
|
7706
7816
|
_this.attributes = {};
|
|
7707
7817
|
return _this;
|
|
7708
7818
|
}
|
|
7709
7819
|
Element.isElement = function isElement(target) {
|
|
7710
7820
|
return !!target.getAttribute;
|
|
7711
|
-
}
|
|
7712
|
-
/**
|
|
7713
|
-
* Unique id.
|
|
7714
|
-
*/;
|
|
7821
|
+
};
|
|
7715
7822
|
var _proto = Element.prototype;
|
|
7716
7823
|
_proto.cloneNode = function cloneNode(deep) {
|
|
7717
7824
|
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
@@ -7919,10 +8026,7 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
7919
8026
|
return this.parentNode.removeChild(this);
|
|
7920
8027
|
}
|
|
7921
8028
|
return this;
|
|
7922
|
-
}
|
|
7923
|
-
/**
|
|
7924
|
-
* is destroyed or not
|
|
7925
|
-
*/;
|
|
8029
|
+
};
|
|
7926
8030
|
_proto.destroy = function destroy() {
|
|
7927
8031
|
// destroy itself before remove
|
|
7928
8032
|
this.dispatchEvent(destroyEvent);
|
|
@@ -7963,21 +8067,14 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
7963
8067
|
*/;
|
|
7964
8068
|
_proto.getClientRects = function getClientRects() {
|
|
7965
8069
|
return [this.getBoundingClientRect()];
|
|
7966
|
-
}
|
|
7967
|
-
/**
|
|
7968
|
-
* compatible with `style`
|
|
7969
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
7970
|
-
*/;
|
|
8070
|
+
};
|
|
7971
8071
|
/**
|
|
7972
8072
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/computedStyleMap
|
|
7973
8073
|
* eg. circle.computedStyleMap().get('fill');
|
|
7974
8074
|
*/
|
|
7975
8075
|
_proto.computedStyleMap = function computedStyleMap() {
|
|
7976
8076
|
return new Map(Object.entries(this.computedStyle));
|
|
7977
|
-
}
|
|
7978
|
-
/**
|
|
7979
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
7980
|
-
*/;
|
|
8077
|
+
};
|
|
7981
8078
|
/**
|
|
7982
8079
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
|
|
7983
8080
|
*/
|
|
@@ -8072,10 +8169,6 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
8072
8169
|
set: function set(className) {
|
|
8073
8170
|
this.setAttribute('class', className);
|
|
8074
8171
|
}
|
|
8075
|
-
/**
|
|
8076
|
-
* used in `getElementsByName`
|
|
8077
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
|
|
8078
|
-
*/
|
|
8079
8172
|
}, {
|
|
8080
8173
|
key: "classList",
|
|
8081
8174
|
get:
|
|
@@ -8147,17 +8240,40 @@ var FederatedMouseEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
|
8147
8240
|
args[_key] = arguments[_key];
|
|
8148
8241
|
}
|
|
8149
8242
|
_this = _FederatedEvent.call.apply(_FederatedEvent, [this].concat(args)) || this;
|
|
8243
|
+
/** Whether the "alt" key was pressed when this mouse event occurred. */
|
|
8150
8244
|
_this.altKey = void 0;
|
|
8245
|
+
/** The specific button that was pressed in this mouse event. */
|
|
8151
8246
|
_this.button = void 0;
|
|
8247
|
+
/** The button depressed when this event occurred. */
|
|
8152
8248
|
_this.buttons = void 0;
|
|
8249
|
+
/** Whether the "control" key was pressed when this mouse event occurred. */
|
|
8153
8250
|
_this.ctrlKey = void 0;
|
|
8251
|
+
/** Whether the "meta" key was pressed when this mouse event occurred. */
|
|
8154
8252
|
_this.metaKey = void 0;
|
|
8253
|
+
/** This is currently not implemented in the Federated Events API. */
|
|
8155
8254
|
_this.relatedTarget = void 0;
|
|
8255
|
+
/** Whether the "shift" key was pressed when this mouse event occurred. */
|
|
8156
8256
|
_this.shiftKey = void 0;
|
|
8257
|
+
/**
|
|
8258
|
+
* The coordinates of the mouse event relative to the canvas.
|
|
8259
|
+
*/
|
|
8157
8260
|
_this.client = new Point();
|
|
8261
|
+
/**
|
|
8262
|
+
* The movement in this pointer relative to the last `mousemove` event.
|
|
8263
|
+
*/
|
|
8158
8264
|
_this.movement = new Point();
|
|
8265
|
+
/**
|
|
8266
|
+
* The offset of the pointer coordinates w.r.t. target DisplayObject in world space. This is
|
|
8267
|
+
* not supported at the moment.
|
|
8268
|
+
*/
|
|
8159
8269
|
_this.offset = new Point();
|
|
8270
|
+
/**
|
|
8271
|
+
* The pointer coordinates in world space.
|
|
8272
|
+
*/
|
|
8160
8273
|
_this.global = new Point();
|
|
8274
|
+
/**
|
|
8275
|
+
* The pointer coordinates in sceen space.
|
|
8276
|
+
*/
|
|
8161
8277
|
_this.screen = new Point();
|
|
8162
8278
|
return _this;
|
|
8163
8279
|
}
|
|
@@ -8178,9 +8294,6 @@ var FederatedMouseEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
|
8178
8294
|
get: function get() {
|
|
8179
8295
|
return this.client.y;
|
|
8180
8296
|
}
|
|
8181
|
-
/**
|
|
8182
|
-
* The movement in this pointer relative to the last `mousemove` event.
|
|
8183
|
-
*/
|
|
8184
8297
|
}, {
|
|
8185
8298
|
key: "movementX",
|
|
8186
8299
|
get: function get() {
|
|
@@ -8191,10 +8304,6 @@ var FederatedMouseEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
|
8191
8304
|
get: function get() {
|
|
8192
8305
|
return this.movement.y;
|
|
8193
8306
|
}
|
|
8194
|
-
/**
|
|
8195
|
-
* The offset of the pointer coordinates w.r.t. target DisplayObject in world space. This is
|
|
8196
|
-
* not supported at the moment.
|
|
8197
|
-
*/
|
|
8198
8307
|
}, {
|
|
8199
8308
|
key: "offsetX",
|
|
8200
8309
|
get: function get() {
|
|
@@ -8205,9 +8314,6 @@ var FederatedMouseEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
|
8205
8314
|
get: function get() {
|
|
8206
8315
|
return this.offset.y;
|
|
8207
8316
|
}
|
|
8208
|
-
/**
|
|
8209
|
-
* The pointer coordinates in world space.
|
|
8210
|
-
*/
|
|
8211
8317
|
}, {
|
|
8212
8318
|
key: "globalX",
|
|
8213
8319
|
get: function get() {
|
|
@@ -8218,9 +8324,6 @@ var FederatedMouseEvent = /*#__PURE__*/function (_FederatedEvent) {
|
|
|
8218
8324
|
get: function get() {
|
|
8219
8325
|
return this.global.y;
|
|
8220
8326
|
}
|
|
8221
|
-
/**
|
|
8222
|
-
* The pointer coordinates in sceen space.
|
|
8223
|
-
*/
|
|
8224
8327
|
}, {
|
|
8225
8328
|
key: "screenX",
|
|
8226
8329
|
get: function get() {
|
|
@@ -8243,15 +8346,69 @@ var FederatedPointerEvent = /*#__PURE__*/function (_FederatedMouseEvent) {
|
|
|
8243
8346
|
args[_key] = arguments[_key];
|
|
8244
8347
|
}
|
|
8245
8348
|
_this = _FederatedMouseEvent.call.apply(_FederatedMouseEvent, [this].concat(args)) || this;
|
|
8349
|
+
/**
|
|
8350
|
+
* The unique identifier of the pointer.
|
|
8351
|
+
*
|
|
8352
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
|
|
8353
|
+
*/
|
|
8246
8354
|
_this.pointerId = void 0;
|
|
8355
|
+
/**
|
|
8356
|
+
* The width of the pointer's contact along the x-axis, measured in CSS pixels.
|
|
8357
|
+
* radiusX of TouchEvents will be represented by this value.
|
|
8358
|
+
*
|
|
8359
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width
|
|
8360
|
+
*/
|
|
8247
8361
|
_this.width = 0;
|
|
8362
|
+
/**
|
|
8363
|
+
* The height of the pointer's contact along the y-axis, measured in CSS pixels.
|
|
8364
|
+
* radiusY of TouchEvents will be represented by this value.
|
|
8365
|
+
*
|
|
8366
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height
|
|
8367
|
+
*/
|
|
8248
8368
|
_this.height = 0;
|
|
8369
|
+
/**
|
|
8370
|
+
* Indicates whether or not the pointer device that created the event is the primary pointer.
|
|
8371
|
+
*
|
|
8372
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary
|
|
8373
|
+
*/
|
|
8249
8374
|
_this.isPrimary = false;
|
|
8375
|
+
/**
|
|
8376
|
+
* The type of pointer that triggered the event.
|
|
8377
|
+
*
|
|
8378
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
|
8379
|
+
*/
|
|
8250
8380
|
_this.pointerType = void 0;
|
|
8381
|
+
/**
|
|
8382
|
+
* Pressure applied by the pointing device during the event.
|
|
8383
|
+
*s
|
|
8384
|
+
* A Touch's force property will be represented by this value.
|
|
8385
|
+
*
|
|
8386
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure
|
|
8387
|
+
*/
|
|
8251
8388
|
_this.pressure = void 0;
|
|
8389
|
+
/**
|
|
8390
|
+
* Barrel pressure on a stylus pointer.
|
|
8391
|
+
*
|
|
8392
|
+
* @see https://w3c.github.io/pointerevents/#pointerevent-interface
|
|
8393
|
+
*/
|
|
8252
8394
|
_this.tangentialPressure = void 0;
|
|
8395
|
+
/**
|
|
8396
|
+
* The angle, in degrees, between the pointer device and the screen.
|
|
8397
|
+
*
|
|
8398
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX
|
|
8399
|
+
*/
|
|
8253
8400
|
_this.tiltX = void 0;
|
|
8401
|
+
/**
|
|
8402
|
+
* The angle, in degrees, between the pointer device and the screen.
|
|
8403
|
+
*
|
|
8404
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY
|
|
8405
|
+
*/
|
|
8254
8406
|
_this.tiltY = void 0;
|
|
8407
|
+
/**
|
|
8408
|
+
* Twist of a stylus pointer.
|
|
8409
|
+
*
|
|
8410
|
+
* @see https://w3c.github.io/pointerevents/#pointerevent-interface
|
|
8411
|
+
*/
|
|
8255
8412
|
_this.twist = void 0;
|
|
8256
8413
|
return _this;
|
|
8257
8414
|
}
|
|
@@ -8296,12 +8453,22 @@ var FederatedWheelEvent = /*#__PURE__*/function (_FederatedMouseEvent) {
|
|
|
8296
8453
|
args[_key] = arguments[_key];
|
|
8297
8454
|
}
|
|
8298
8455
|
_this = _FederatedMouseEvent.call.apply(_FederatedMouseEvent, [this].concat(args)) || this;
|
|
8456
|
+
/**
|
|
8457
|
+
* The units of `deltaX`, `deltaY`, and `deltaZ`. This is one of `DOM_DELTA_LINE`,
|
|
8458
|
+
* `DOM_DELTA_PAGE`, `DOM_DELTA_PIXEL`.
|
|
8459
|
+
*/
|
|
8299
8460
|
_this.deltaMode = void 0;
|
|
8461
|
+
/** Horizontal scroll amount */
|
|
8300
8462
|
_this.deltaX = void 0;
|
|
8463
|
+
/** Vertical scroll amount */
|
|
8301
8464
|
_this.deltaY = void 0;
|
|
8465
|
+
/** z-axis scroll amount. */
|
|
8302
8466
|
_this.deltaZ = void 0;
|
|
8467
|
+
/** Units specified in lines. */
|
|
8303
8468
|
_this.DOM_DELTA_LINE = 0;
|
|
8469
|
+
/** Units specified in pages. */
|
|
8304
8470
|
_this.DOM_DELTA_PAGE = 1;
|
|
8471
|
+
/** Units specified in pixels. */
|
|
8305
8472
|
_this.DOM_DELTA_PIXEL = 2;
|
|
8306
8473
|
return _this;
|
|
8307
8474
|
}
|
|
@@ -8417,6 +8584,10 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
8417
8584
|
_this.isMutationObserved = false;
|
|
8418
8585
|
_this.activeAnimations = [];
|
|
8419
8586
|
_this.dataset = void 0;
|
|
8587
|
+
/**
|
|
8588
|
+
* Use `this.style.clipPath` instead.
|
|
8589
|
+
* @deprecated
|
|
8590
|
+
*/
|
|
8420
8591
|
_this.getClip = function () {
|
|
8421
8592
|
return this.style.clipPath || null;
|
|
8422
8593
|
};
|
|
@@ -9059,11 +9230,7 @@ var DisplayObject = /*#__PURE__*/function (_Element) {
|
|
|
9059
9230
|
*/;
|
|
9060
9231
|
_proto.setClip = function setClip(clipPath) {
|
|
9061
9232
|
this.style.clipPath = clipPath;
|
|
9062
|
-
}
|
|
9063
|
-
/**
|
|
9064
|
-
* Use `this.style.clipPath` instead.
|
|
9065
|
-
* @deprecated
|
|
9066
|
-
*/;
|
|
9233
|
+
};
|
|
9067
9234
|
/**
|
|
9068
9235
|
* @deprecated
|
|
9069
9236
|
*/
|
|
@@ -11314,25 +11481,72 @@ var Camera = /*#__PURE__*/function () {
|
|
|
11314
11481
|
function Camera() {
|
|
11315
11482
|
this.canvas = void 0;
|
|
11316
11483
|
this.eventEmitter = new EventEmitter();
|
|
11484
|
+
/**
|
|
11485
|
+
* 相机矩阵
|
|
11486
|
+
*/
|
|
11317
11487
|
this.matrix = mat4.create();
|
|
11488
|
+
/**
|
|
11489
|
+
* u 轴
|
|
11490
|
+
* @see http://learnwebgl.brown37.net/07_cameras/camera_introduction.html#a-camera-definition
|
|
11491
|
+
*/
|
|
11318
11492
|
this.right = vec3.fromValues(1, 0, 0);
|
|
11493
|
+
/**
|
|
11494
|
+
* v 轴 +Y is down
|
|
11495
|
+
*/
|
|
11319
11496
|
this.up = vec3.fromValues(0, 1, 0);
|
|
11497
|
+
/**
|
|
11498
|
+
* n 轴 +Z is inside
|
|
11499
|
+
*/
|
|
11320
11500
|
this.forward = vec3.fromValues(0, 0, 1);
|
|
11501
|
+
/**
|
|
11502
|
+
* 相机位置
|
|
11503
|
+
*/
|
|
11321
11504
|
this.position = vec3.fromValues(0, 0, 1);
|
|
11505
|
+
/**
|
|
11506
|
+
* 视点位置
|
|
11507
|
+
*/
|
|
11322
11508
|
this.focalPoint = vec3.fromValues(0, 0, 0);
|
|
11509
|
+
/**
|
|
11510
|
+
* 视点到相机位置的向量
|
|
11511
|
+
* focalPoint - position
|
|
11512
|
+
*/
|
|
11323
11513
|
this.distanceVector = vec3.fromValues(0, 0, -1);
|
|
11514
|
+
/**
|
|
11515
|
+
* 相机位置到视点距离
|
|
11516
|
+
* length(focalPoint - position)
|
|
11517
|
+
*/
|
|
11324
11518
|
this.distance = 1;
|
|
11519
|
+
/**
|
|
11520
|
+
* @see https://en.wikipedia.org/wiki/Azimuth
|
|
11521
|
+
*/
|
|
11325
11522
|
this.azimuth = 0;
|
|
11326
11523
|
this.elevation = 0;
|
|
11327
11524
|
this.roll = 0;
|
|
11328
11525
|
this.relAzimuth = 0;
|
|
11329
11526
|
this.relElevation = 0;
|
|
11330
11527
|
this.relRoll = 0;
|
|
11528
|
+
/**
|
|
11529
|
+
* 沿 n 轴移动时,保证移动速度从快到慢
|
|
11530
|
+
*/
|
|
11331
11531
|
this.dollyingStep = 0;
|
|
11332
11532
|
this.maxDistance = Infinity;
|
|
11333
11533
|
this.minDistance = -Infinity;
|
|
11534
|
+
/**
|
|
11535
|
+
* zoom factor of the camera, default is 1
|
|
11536
|
+
* eg. https://threejs.org/docs/#api/en/cameras/OrthographicCamera.zoom
|
|
11537
|
+
*/
|
|
11334
11538
|
this.zoom = 1;
|
|
11539
|
+
/**
|
|
11540
|
+
* invert the horizontal coordinate system HCS
|
|
11541
|
+
*/
|
|
11335
11542
|
this.rotateWorld = false;
|
|
11543
|
+
/**
|
|
11544
|
+
* 投影矩阵参数
|
|
11545
|
+
*/
|
|
11546
|
+
/**
|
|
11547
|
+
* field of view [0-360]
|
|
11548
|
+
* @see http://en.wikipedia.org/wiki/Angle_of_view
|
|
11549
|
+
*/
|
|
11336
11550
|
this.fov = 30;
|
|
11337
11551
|
this.near = 0.1;
|
|
11338
11552
|
this.far = 1000;
|
|
@@ -11346,10 +11560,17 @@ var Camera = /*#__PURE__*/function () {
|
|
|
11346
11560
|
this.jitteredProjectionMatrix = undefined;
|
|
11347
11561
|
this.view = void 0;
|
|
11348
11562
|
this.enableUpdate = true;
|
|
11563
|
+
// protected following = undefined;
|
|
11349
11564
|
this.type = CameraType.EXPLORING;
|
|
11350
11565
|
this.trackingMode = CameraTrackingMode.DEFAULT;
|
|
11351
11566
|
this.projectionMode = CameraProjectionMode.PERSPECTIVE;
|
|
11567
|
+
/**
|
|
11568
|
+
* for culling use
|
|
11569
|
+
*/
|
|
11352
11570
|
this.frustum = new Frustum();
|
|
11571
|
+
/**
|
|
11572
|
+
* ortho matrix for Canvas2D & SVG
|
|
11573
|
+
*/
|
|
11353
11574
|
this.orthoMatrix = mat4.create();
|
|
11354
11575
|
}
|
|
11355
11576
|
var _proto = Camera.prototype;
|
|
@@ -12170,410 +12391,271 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12170
12391
|
this.pickHandler = void 0;
|
|
12171
12392
|
this.tmpMatrix = mat4.create();
|
|
12172
12393
|
this.tmpVec3 = vec3.create();
|
|
12173
|
-
this.onPointerDown =
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
12188
|
-
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12192
|
-
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12394
|
+
this.onPointerDown = function (from) {
|
|
12395
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12396
|
+
// return;
|
|
12397
|
+
// }
|
|
12398
|
+
var e = _this.createPointerEvent(from);
|
|
12399
|
+
_this.dispatchEvent(e, 'pointerdown');
|
|
12400
|
+
if (e.pointerType === 'touch') {
|
|
12401
|
+
_this.dispatchEvent(e, 'touchstart');
|
|
12402
|
+
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
12403
|
+
var isRightButton = e.button === 2;
|
|
12404
|
+
_this.dispatchEvent(e, isRightButton ? 'rightdown' : 'mousedown');
|
|
12405
|
+
}
|
|
12406
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
12407
|
+
trackingData.pressTargetsByButton[from.button] = e.composedPath();
|
|
12408
|
+
_this.freeEvent(e);
|
|
12409
|
+
};
|
|
12410
|
+
this.onPointerUp = function (from) {
|
|
12411
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12412
|
+
// return;
|
|
12413
|
+
// }
|
|
12414
|
+
var now = performance.now();
|
|
12415
|
+
var e = _this.createPointerEvent(from);
|
|
12416
|
+
_this.dispatchEvent(e, 'pointerup');
|
|
12417
|
+
if (e.pointerType === 'touch') {
|
|
12418
|
+
_this.dispatchEvent(e, 'touchend');
|
|
12419
|
+
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
12420
|
+
var isRightButton = e.button === 2;
|
|
12421
|
+
_this.dispatchEvent(e, isRightButton ? 'rightup' : 'mouseup');
|
|
12422
|
+
}
|
|
12423
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
12424
|
+
var pressTarget = _this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);
|
|
12425
|
+
var clickTarget = pressTarget;
|
|
12426
|
+
// pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
|
|
12427
|
+
// the pointerup location.
|
|
12428
|
+
if (pressTarget && !e.composedPath().includes(pressTarget)) {
|
|
12429
|
+
var currentTarget = pressTarget;
|
|
12430
|
+
while (currentTarget && !e.composedPath().includes(currentTarget)) {
|
|
12431
|
+
e.currentTarget = currentTarget;
|
|
12432
|
+
_this.notifyTarget(e, 'pointerupoutside');
|
|
12433
|
+
if (e.pointerType === 'touch') {
|
|
12434
|
+
_this.notifyTarget(e, 'touchendoutside');
|
|
12435
|
+
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
12436
|
+
var _isRightButton = e.button === 2;
|
|
12437
|
+
_this.notifyTarget(e, _isRightButton ? 'rightupoutside' : 'mouseupoutside');
|
|
12198
12438
|
}
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
return function (_x) {
|
|
12202
|
-
return _ref.apply(this, arguments);
|
|
12203
|
-
};
|
|
12204
|
-
}();
|
|
12205
|
-
this.onPointerUp = /*#__PURE__*/function () {
|
|
12206
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(from) {
|
|
12207
|
-
var now, e, isRightButton, trackingData, pressTarget, clickTarget, currentTarget, _isRightButton, _e$detail, clickEvent, clickHistory;
|
|
12208
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
12209
|
-
while (1) {
|
|
12210
|
-
switch (_context2.prev = _context2.next) {
|
|
12211
|
-
case 0:
|
|
12212
|
-
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12213
|
-
// return;
|
|
12214
|
-
// }
|
|
12215
|
-
now = performance.now();
|
|
12216
|
-
_context2.next = 3;
|
|
12217
|
-
return _this.createPointerEvent(from);
|
|
12218
|
-
case 3:
|
|
12219
|
-
e = _context2.sent;
|
|
12220
|
-
_this.dispatchEvent(e, 'pointerup');
|
|
12221
|
-
if (e.pointerType === 'touch') {
|
|
12222
|
-
_this.dispatchEvent(e, 'touchend');
|
|
12223
|
-
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
12224
|
-
isRightButton = e.button === 2;
|
|
12225
|
-
_this.dispatchEvent(e, isRightButton ? 'rightup' : 'mouseup');
|
|
12226
|
-
}
|
|
12227
|
-
trackingData = _this.trackingData(from.pointerId);
|
|
12228
|
-
pressTarget = _this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);
|
|
12229
|
-
clickTarget = pressTarget; // pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
|
|
12230
|
-
// the pointerup location.
|
|
12231
|
-
if (pressTarget && !e.composedPath().includes(pressTarget)) {
|
|
12232
|
-
currentTarget = pressTarget;
|
|
12233
|
-
while (currentTarget && !e.composedPath().includes(currentTarget)) {
|
|
12234
|
-
e.currentTarget = currentTarget;
|
|
12235
|
-
_this.notifyTarget(e, 'pointerupoutside');
|
|
12236
|
-
if (e.pointerType === 'touch') {
|
|
12237
|
-
_this.notifyTarget(e, 'touchendoutside');
|
|
12238
|
-
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
12239
|
-
_isRightButton = e.button === 2;
|
|
12240
|
-
_this.notifyTarget(e, _isRightButton ? 'rightupoutside' : 'mouseupoutside');
|
|
12241
|
-
}
|
|
12242
|
-
if (Node.isNode(currentTarget)) {
|
|
12243
|
-
currentTarget = currentTarget.parentNode;
|
|
12244
|
-
}
|
|
12245
|
-
}
|
|
12246
|
-
delete trackingData.pressTargetsByButton[from.button];
|
|
12247
|
-
// currentTarget is the most specific ancestor holding both the pointerdown and pointerup
|
|
12248
|
-
// targets. That is - it's our click target!
|
|
12249
|
-
clickTarget = currentTarget;
|
|
12250
|
-
}
|
|
12251
|
-
if (clickTarget) {
|
|
12252
|
-
clickEvent = _this.clonePointerEvent(e, 'click');
|
|
12253
|
-
clickEvent.target = clickTarget;
|
|
12254
|
-
clickEvent.path = [];
|
|
12255
|
-
if (!trackingData.clicksByButton[from.button]) {
|
|
12256
|
-
trackingData.clicksByButton[from.button] = {
|
|
12257
|
-
clickCount: 0,
|
|
12258
|
-
target: clickEvent.target,
|
|
12259
|
-
timeStamp: now
|
|
12260
|
-
};
|
|
12261
|
-
}
|
|
12262
|
-
clickHistory = trackingData.clicksByButton[from.button];
|
|
12263
|
-
if (clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < 200) {
|
|
12264
|
-
++clickHistory.clickCount;
|
|
12265
|
-
} else {
|
|
12266
|
-
clickHistory.clickCount = 1;
|
|
12267
|
-
}
|
|
12268
|
-
clickHistory.target = clickEvent.target;
|
|
12269
|
-
clickHistory.timeStamp = now;
|
|
12270
|
-
clickEvent.detail = clickHistory.clickCount;
|
|
12271
|
-
// @see https://github.com/antvis/G/issues/1091
|
|
12272
|
-
if (!((_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.preventClick)) {
|
|
12273
|
-
if (clickEvent.pointerType === 'mouse' || clickEvent.pointerType === 'touch') {
|
|
12274
|
-
_this.dispatchEvent(clickEvent, 'click');
|
|
12275
|
-
}
|
|
12276
|
-
_this.dispatchEvent(clickEvent, 'pointertap');
|
|
12277
|
-
}
|
|
12278
|
-
_this.freeEvent(clickEvent);
|
|
12279
|
-
}
|
|
12280
|
-
_this.freeEvent(e);
|
|
12281
|
-
case 12:
|
|
12282
|
-
case "end":
|
|
12283
|
-
return _context2.stop();
|
|
12284
|
-
}
|
|
12439
|
+
if (Node.isNode(currentTarget)) {
|
|
12440
|
+
currentTarget = currentTarget.parentNode;
|
|
12285
12441
|
}
|
|
12286
|
-
}
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
|
|
12291
|
-
|
|
12292
|
-
|
|
12293
|
-
|
|
12294
|
-
var
|
|
12295
|
-
|
|
12296
|
-
|
|
12297
|
-
|
|
12298
|
-
|
|
12299
|
-
|
|
12300
|
-
|
|
12301
|
-
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
|
|
12308
|
-
|
|
12309
|
-
|
|
12310
|
-
|
|
12311
|
-
|
|
12312
|
-
|
|
12313
|
-
|
|
12314
|
-
|
|
12315
|
-
|
|
12316
|
-
|
|
12317
|
-
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
12318
|
-
// If the pointer exits overTarget and its descendants, then a pointerleave event is also fired. This event
|
|
12319
|
-
// is dispatched to all ancestors that no longer capture the pointer.
|
|
12320
|
-
if (e.composedPath().includes(outTarget)) {
|
|
12321
|
-
_context3.next = 20;
|
|
12322
|
-
break;
|
|
12323
|
-
}
|
|
12324
|
-
_context3.next = 16;
|
|
12325
|
-
return _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
12326
|
-
case 16:
|
|
12327
|
-
leaveEvent = _context3.sent;
|
|
12328
|
-
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
12329
|
-
while (leaveEvent.target && !e.composedPath().includes(leaveEvent.target)) {
|
|
12330
|
-
leaveEvent.currentTarget = leaveEvent.target;
|
|
12331
|
-
_this.notifyTarget(leaveEvent);
|
|
12332
|
-
if (isMouse) {
|
|
12333
|
-
_this.notifyTarget(leaveEvent, 'mouseleave');
|
|
12334
|
-
}
|
|
12335
|
-
if (Node.isNode(leaveEvent.target)) {
|
|
12336
|
-
leaveEvent.target = leaveEvent.target.parentNode;
|
|
12337
|
-
}
|
|
12338
|
-
}
|
|
12339
|
-
_this.freeEvent(leaveEvent);
|
|
12340
|
-
case 20:
|
|
12341
|
-
_this.freeEvent(outEvent);
|
|
12342
|
-
case 21:
|
|
12343
|
-
if (!(outTarget !== e.target)) {
|
|
12344
|
-
_context3.next = 36;
|
|
12345
|
-
break;
|
|
12346
|
-
}
|
|
12347
|
-
// pointerover always occurs on the new overTarget
|
|
12348
|
-
overType = from.type === 'mousemove' ? 'mouseover' : 'pointerover';
|
|
12349
|
-
overEvent = _this.clonePointerEvent(e, overType); // clone faster
|
|
12350
|
-
_this.dispatchEvent(overEvent, 'pointerover');
|
|
12351
|
-
if (isMouse) _this.dispatchEvent(overEvent, 'mouseover');
|
|
12352
|
-
// Probe whether the newly hovered Node is an ancestor of the original overTarget.
|
|
12353
|
-
overTargetAncestor = outTarget && Node.isNode(outTarget) && outTarget.parentNode;
|
|
12354
|
-
case 27:
|
|
12355
|
-
if (!(overTargetAncestor && overTargetAncestor !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode))) {
|
|
12356
|
-
_context3.next = 33;
|
|
12357
|
-
break;
|
|
12358
|
-
}
|
|
12359
|
-
if (!(overTargetAncestor === e.target)) {
|
|
12360
|
-
_context3.next = 30;
|
|
12361
|
-
break;
|
|
12362
|
-
}
|
|
12363
|
-
return _context3.abrupt("break", 33);
|
|
12364
|
-
case 30:
|
|
12365
|
-
overTargetAncestor = overTargetAncestor.parentNode;
|
|
12366
|
-
_context3.next = 27;
|
|
12367
|
-
break;
|
|
12368
|
-
case 33:
|
|
12369
|
-
// The pointer has entered a non-ancestor of the original overTarget. This means we need a pointerentered
|
|
12370
|
-
// event.
|
|
12371
|
-
didPointerEnter = !overTargetAncestor || overTargetAncestor === (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode);
|
|
12372
|
-
if (didPointerEnter) {
|
|
12373
|
-
enterEvent = _this.clonePointerEvent(e, 'pointerenter');
|
|
12374
|
-
enterEvent.eventPhase = enterEvent.AT_TARGET;
|
|
12375
|
-
while (enterEvent.target && enterEvent.target !== outTarget && enterEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
12376
|
-
enterEvent.currentTarget = enterEvent.target;
|
|
12377
|
-
_this.notifyTarget(enterEvent);
|
|
12378
|
-
if (isMouse) _this.notifyTarget(enterEvent, 'mouseenter');
|
|
12379
|
-
if (Node.isNode(enterEvent.target)) {
|
|
12380
|
-
enterEvent.target = enterEvent.target.parentNode;
|
|
12381
|
-
}
|
|
12382
|
-
}
|
|
12383
|
-
_this.freeEvent(enterEvent);
|
|
12384
|
-
}
|
|
12385
|
-
_this.freeEvent(overEvent);
|
|
12386
|
-
case 36:
|
|
12387
|
-
// Then pointermove
|
|
12388
|
-
_this.dispatchEvent(e, 'pointermove');
|
|
12389
|
-
if (e.pointerType === 'touch') _this.dispatchEvent(e, 'touchmove');
|
|
12390
|
-
if (isMouse) {
|
|
12391
|
-
_this.dispatchEvent(e, 'mousemove');
|
|
12392
|
-
_this.cursor = _this.getCursor(e.target);
|
|
12393
|
-
}
|
|
12394
|
-
trackingData.overTargets = e.composedPath();
|
|
12395
|
-
_this.freeEvent(e);
|
|
12396
|
-
case 41:
|
|
12397
|
-
case "end":
|
|
12398
|
-
return _context3.stop();
|
|
12399
|
-
}
|
|
12442
|
+
}
|
|
12443
|
+
delete trackingData.pressTargetsByButton[from.button];
|
|
12444
|
+
// currentTarget is the most specific ancestor holding both the pointerdown and pointerup
|
|
12445
|
+
// targets. That is - it's our click target!
|
|
12446
|
+
clickTarget = currentTarget;
|
|
12447
|
+
}
|
|
12448
|
+
if (clickTarget) {
|
|
12449
|
+
var _e$detail;
|
|
12450
|
+
var clickEvent = _this.clonePointerEvent(e, 'click');
|
|
12451
|
+
clickEvent.target = clickTarget;
|
|
12452
|
+
clickEvent.path = [];
|
|
12453
|
+
if (!trackingData.clicksByButton[from.button]) {
|
|
12454
|
+
trackingData.clicksByButton[from.button] = {
|
|
12455
|
+
clickCount: 0,
|
|
12456
|
+
target: clickEvent.target,
|
|
12457
|
+
timeStamp: now
|
|
12458
|
+
};
|
|
12459
|
+
}
|
|
12460
|
+
var clickHistory = trackingData.clicksByButton[from.button];
|
|
12461
|
+
if (clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < 200) {
|
|
12462
|
+
++clickHistory.clickCount;
|
|
12463
|
+
} else {
|
|
12464
|
+
clickHistory.clickCount = 1;
|
|
12465
|
+
}
|
|
12466
|
+
clickHistory.target = clickEvent.target;
|
|
12467
|
+
clickHistory.timeStamp = now;
|
|
12468
|
+
clickEvent.detail = clickHistory.clickCount;
|
|
12469
|
+
// @see https://github.com/antvis/G/issues/1091
|
|
12470
|
+
if (!((_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.preventClick)) {
|
|
12471
|
+
if (!_this.context.config.useNativeClickEvent && (clickEvent.pointerType === 'mouse' || clickEvent.pointerType === 'touch')) {
|
|
12472
|
+
_this.dispatchEvent(clickEvent, 'click');
|
|
12400
12473
|
}
|
|
12401
|
-
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12405
|
-
|
|
12406
|
-
}
|
|
12407
|
-
this.
|
|
12408
|
-
|
|
12409
|
-
|
|
12410
|
-
|
|
12411
|
-
|
|
12412
|
-
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12419
|
-
|
|
12420
|
-
|
|
12421
|
-
|
|
12422
|
-
|
|
12423
|
-
|
|
12424
|
-
|
|
12425
|
-
|
|
12426
|
-
|
|
12427
|
-
|
|
12428
|
-
|
|
12429
|
-
|
|
12430
|
-
|
|
12431
|
-
|
|
12432
|
-
_context4.next = 11;
|
|
12433
|
-
return _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
12434
|
-
case 11:
|
|
12435
|
-
leaveEvent = _context4.sent;
|
|
12436
|
-
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
12437
|
-
while (leaveEvent.target && leaveEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
12438
|
-
leaveEvent.currentTarget = leaveEvent.target;
|
|
12439
|
-
_this.notifyTarget(leaveEvent);
|
|
12440
|
-
if (isMouse) {
|
|
12441
|
-
_this.notifyTarget(leaveEvent, 'mouseleave');
|
|
12442
|
-
}
|
|
12443
|
-
if (Node.isNode(leaveEvent.target)) {
|
|
12444
|
-
leaveEvent.target = leaveEvent.target.parentNode;
|
|
12445
|
-
}
|
|
12446
|
-
}
|
|
12447
|
-
trackingData.overTargets = null;
|
|
12448
|
-
_this.freeEvent(outEvent);
|
|
12449
|
-
_this.freeEvent(leaveEvent);
|
|
12450
|
-
case 17:
|
|
12451
|
-
_this.cursor = null;
|
|
12452
|
-
case 18:
|
|
12453
|
-
case "end":
|
|
12454
|
-
return _context4.stop();
|
|
12474
|
+
_this.dispatchEvent(clickEvent, 'pointertap');
|
|
12475
|
+
}
|
|
12476
|
+
_this.freeEvent(clickEvent);
|
|
12477
|
+
}
|
|
12478
|
+
_this.freeEvent(e);
|
|
12479
|
+
};
|
|
12480
|
+
this.onPointerMove = function (from) {
|
|
12481
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12482
|
+
// return;
|
|
12483
|
+
// }
|
|
12484
|
+
var e = _this.createPointerEvent(from);
|
|
12485
|
+
var isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
12486
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
12487
|
+
var outTarget = _this.findMountedTarget(trackingData.overTargets);
|
|
12488
|
+
// First pointerout/pointerleave
|
|
12489
|
+
if (trackingData.overTargets && outTarget !== e.target) {
|
|
12490
|
+
// pointerout always occurs on the overTarget when the pointer hovers over another element.
|
|
12491
|
+
var outType = from.type === 'mousemove' ? 'mouseout' : 'pointerout';
|
|
12492
|
+
var outEvent = _this.createPointerEvent(from, outType, outTarget || undefined);
|
|
12493
|
+
_this.dispatchEvent(outEvent, 'pointerout');
|
|
12494
|
+
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
12495
|
+
// If the pointer exits overTarget and its descendants, then a pointerleave event is also fired. This event
|
|
12496
|
+
// is dispatched to all ancestors that no longer capture the pointer.
|
|
12497
|
+
if (!e.composedPath().includes(outTarget)) {
|
|
12498
|
+
var leaveEvent = _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
12499
|
+
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
12500
|
+
while (leaveEvent.target && !e.composedPath().includes(leaveEvent.target)) {
|
|
12501
|
+
leaveEvent.currentTarget = leaveEvent.target;
|
|
12502
|
+
_this.notifyTarget(leaveEvent);
|
|
12503
|
+
if (isMouse) {
|
|
12504
|
+
_this.notifyTarget(leaveEvent, 'mouseleave');
|
|
12455
12505
|
}
|
|
12456
|
-
|
|
12457
|
-
|
|
12458
|
-
}));
|
|
12459
|
-
return function (_x4) {
|
|
12460
|
-
return _ref4.apply(this, arguments);
|
|
12461
|
-
};
|
|
12462
|
-
}();
|
|
12463
|
-
this.onPointerOver = /*#__PURE__*/function () {
|
|
12464
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(from) {
|
|
12465
|
-
var trackingData, e, isMouse, enterEvent;
|
|
12466
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
12467
|
-
while (1) {
|
|
12468
|
-
switch (_context5.prev = _context5.next) {
|
|
12469
|
-
case 0:
|
|
12470
|
-
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12471
|
-
// return;
|
|
12472
|
-
// }
|
|
12473
|
-
trackingData = _this.trackingData(from.pointerId);
|
|
12474
|
-
_context5.next = 3;
|
|
12475
|
-
return _this.createPointerEvent(from);
|
|
12476
|
-
case 3:
|
|
12477
|
-
e = _context5.sent;
|
|
12478
|
-
isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
12479
|
-
_this.dispatchEvent(e, 'pointerover');
|
|
12480
|
-
if (isMouse) _this.dispatchEvent(e, 'mouseover');
|
|
12481
|
-
if (e.pointerType === 'mouse') _this.cursor = _this.getCursor(e.target);
|
|
12482
|
-
// pointerenter events must be fired since the pointer entered from upstream.
|
|
12483
|
-
enterEvent = _this.clonePointerEvent(e, 'pointerenter');
|
|
12484
|
-
enterEvent.eventPhase = enterEvent.AT_TARGET;
|
|
12485
|
-
while (enterEvent.target && enterEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
12486
|
-
enterEvent.currentTarget = enterEvent.target;
|
|
12487
|
-
_this.notifyTarget(enterEvent);
|
|
12488
|
-
if (isMouse) {
|
|
12489
|
-
// mouseenter should not bubble
|
|
12490
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseenter_event#usage_notes
|
|
12491
|
-
_this.notifyTarget(enterEvent, 'mouseenter');
|
|
12492
|
-
}
|
|
12493
|
-
if (Node.isNode(enterEvent.target)) {
|
|
12494
|
-
enterEvent.target = enterEvent.target.parentNode;
|
|
12495
|
-
}
|
|
12496
|
-
}
|
|
12497
|
-
trackingData.overTargets = e.composedPath();
|
|
12498
|
-
_this.freeEvent(e);
|
|
12499
|
-
_this.freeEvent(enterEvent);
|
|
12500
|
-
case 14:
|
|
12501
|
-
case "end":
|
|
12502
|
-
return _context5.stop();
|
|
12506
|
+
if (Node.isNode(leaveEvent.target)) {
|
|
12507
|
+
leaveEvent.target = leaveEvent.target.parentNode;
|
|
12503
12508
|
}
|
|
12504
12509
|
}
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
var
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
}
|
|
12535
|
-
if (Node.isNode(currentTarget)) {
|
|
12536
|
-
currentTarget = currentTarget.parentNode;
|
|
12537
|
-
}
|
|
12538
|
-
}
|
|
12539
|
-
delete trackingData.pressTargetsByButton[from.button];
|
|
12540
|
-
}
|
|
12541
|
-
_this.freeEvent(e);
|
|
12542
|
-
case 7:
|
|
12543
|
-
case "end":
|
|
12544
|
-
return _context6.stop();
|
|
12510
|
+
_this.freeEvent(leaveEvent);
|
|
12511
|
+
}
|
|
12512
|
+
_this.freeEvent(outEvent);
|
|
12513
|
+
}
|
|
12514
|
+
// Then pointerover
|
|
12515
|
+
if (outTarget !== e.target) {
|
|
12516
|
+
// pointerover always occurs on the new overTarget
|
|
12517
|
+
var overType = from.type === 'mousemove' ? 'mouseover' : 'pointerover';
|
|
12518
|
+
var overEvent = _this.clonePointerEvent(e, overType); // clone faster
|
|
12519
|
+
_this.dispatchEvent(overEvent, 'pointerover');
|
|
12520
|
+
if (isMouse) _this.dispatchEvent(overEvent, 'mouseover');
|
|
12521
|
+
// Probe whether the newly hovered Node is an ancestor of the original overTarget.
|
|
12522
|
+
var overTargetAncestor = outTarget && Node.isNode(outTarget) && outTarget.parentNode;
|
|
12523
|
+
while (overTargetAncestor && overTargetAncestor !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
12524
|
+
if (overTargetAncestor === e.target) break;
|
|
12525
|
+
overTargetAncestor = overTargetAncestor.parentNode;
|
|
12526
|
+
}
|
|
12527
|
+
// The pointer has entered a non-ancestor of the original overTarget. This means we need a pointerentered
|
|
12528
|
+
// event.
|
|
12529
|
+
var didPointerEnter = !overTargetAncestor || overTargetAncestor === (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode);
|
|
12530
|
+
if (didPointerEnter) {
|
|
12531
|
+
var enterEvent = _this.clonePointerEvent(e, 'pointerenter');
|
|
12532
|
+
enterEvent.eventPhase = enterEvent.AT_TARGET;
|
|
12533
|
+
while (enterEvent.target && enterEvent.target !== outTarget && enterEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
12534
|
+
enterEvent.currentTarget = enterEvent.target;
|
|
12535
|
+
_this.notifyTarget(enterEvent);
|
|
12536
|
+
if (isMouse) _this.notifyTarget(enterEvent, 'mouseenter');
|
|
12537
|
+
if (Node.isNode(enterEvent.target)) {
|
|
12538
|
+
enterEvent.target = enterEvent.target.parentNode;
|
|
12545
12539
|
}
|
|
12546
12540
|
}
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
|
|
12566
|
-
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12541
|
+
_this.freeEvent(enterEvent);
|
|
12542
|
+
}
|
|
12543
|
+
_this.freeEvent(overEvent);
|
|
12544
|
+
}
|
|
12545
|
+
// Then pointermove
|
|
12546
|
+
_this.dispatchEvent(e, 'pointermove');
|
|
12547
|
+
if (e.pointerType === 'touch') _this.dispatchEvent(e, 'touchmove');
|
|
12548
|
+
if (isMouse) {
|
|
12549
|
+
_this.dispatchEvent(e, 'mousemove');
|
|
12550
|
+
_this.cursor = _this.getCursor(e.target);
|
|
12551
|
+
}
|
|
12552
|
+
trackingData.overTargets = e.composedPath();
|
|
12553
|
+
_this.freeEvent(e);
|
|
12554
|
+
};
|
|
12555
|
+
this.onPointerOut = function (from) {
|
|
12556
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12557
|
+
// return;
|
|
12558
|
+
// }
|
|
12559
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
12560
|
+
if (trackingData.overTargets) {
|
|
12561
|
+
var isMouse = from.pointerType === 'mouse' || from.pointerType === 'pen';
|
|
12562
|
+
var outTarget = _this.findMountedTarget(trackingData.overTargets);
|
|
12563
|
+
// pointerout first
|
|
12564
|
+
var outEvent = _this.createPointerEvent(from, 'pointerout', outTarget || undefined);
|
|
12565
|
+
_this.dispatchEvent(outEvent);
|
|
12566
|
+
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
12567
|
+
// pointerleave(s) are also dispatched b/c the pointer must've left rootTarget and its descendants to
|
|
12568
|
+
// get an upstream pointerout event (upstream events do not know rootTarget has descendants).
|
|
12569
|
+
var leaveEvent = _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
12570
|
+
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
12571
|
+
while (leaveEvent.target && leaveEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
12572
|
+
leaveEvent.currentTarget = leaveEvent.target;
|
|
12573
|
+
_this.notifyTarget(leaveEvent);
|
|
12574
|
+
if (isMouse) {
|
|
12575
|
+
_this.notifyTarget(leaveEvent, 'mouseleave');
|
|
12570
12576
|
}
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
+
if (Node.isNode(leaveEvent.target)) {
|
|
12578
|
+
leaveEvent.target = leaveEvent.target.parentNode;
|
|
12579
|
+
}
|
|
12580
|
+
}
|
|
12581
|
+
trackingData.overTargets = null;
|
|
12582
|
+
_this.freeEvent(outEvent);
|
|
12583
|
+
_this.freeEvent(leaveEvent);
|
|
12584
|
+
}
|
|
12585
|
+
_this.cursor = null;
|
|
12586
|
+
};
|
|
12587
|
+
this.onPointerOver = function (from) {
|
|
12588
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12589
|
+
// return;
|
|
12590
|
+
// }
|
|
12591
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
12592
|
+
var e = _this.createPointerEvent(from);
|
|
12593
|
+
var isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
12594
|
+
_this.dispatchEvent(e, 'pointerover');
|
|
12595
|
+
if (isMouse) _this.dispatchEvent(e, 'mouseover');
|
|
12596
|
+
if (e.pointerType === 'mouse') _this.cursor = _this.getCursor(e.target);
|
|
12597
|
+
// pointerenter events must be fired since the pointer entered from upstream.
|
|
12598
|
+
var enterEvent = _this.clonePointerEvent(e, 'pointerenter');
|
|
12599
|
+
enterEvent.eventPhase = enterEvent.AT_TARGET;
|
|
12600
|
+
while (enterEvent.target && enterEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
12601
|
+
enterEvent.currentTarget = enterEvent.target;
|
|
12602
|
+
_this.notifyTarget(enterEvent);
|
|
12603
|
+
if (isMouse) {
|
|
12604
|
+
// mouseenter should not bubble
|
|
12605
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseenter_event#usage_notes
|
|
12606
|
+
_this.notifyTarget(enterEvent, 'mouseenter');
|
|
12607
|
+
}
|
|
12608
|
+
if (Node.isNode(enterEvent.target)) {
|
|
12609
|
+
enterEvent.target = enterEvent.target.parentNode;
|
|
12610
|
+
}
|
|
12611
|
+
}
|
|
12612
|
+
trackingData.overTargets = e.composedPath();
|
|
12613
|
+
_this.freeEvent(e);
|
|
12614
|
+
_this.freeEvent(enterEvent);
|
|
12615
|
+
};
|
|
12616
|
+
this.onPointerUpOutside = function (from) {
|
|
12617
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
12618
|
+
// return;
|
|
12619
|
+
// }
|
|
12620
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
12621
|
+
var pressTarget = _this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);
|
|
12622
|
+
var e = _this.createPointerEvent(from);
|
|
12623
|
+
if (pressTarget) {
|
|
12624
|
+
var currentTarget = pressTarget;
|
|
12625
|
+
while (currentTarget) {
|
|
12626
|
+
e.currentTarget = currentTarget;
|
|
12627
|
+
_this.notifyTarget(e, 'pointerupoutside');
|
|
12628
|
+
if (e.pointerType === 'touch') ; else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
12629
|
+
_this.notifyTarget(e, e.button === 2 ? 'rightupoutside' : 'mouseupoutside');
|
|
12630
|
+
}
|
|
12631
|
+
if (Node.isNode(currentTarget)) {
|
|
12632
|
+
currentTarget = currentTarget.parentNode;
|
|
12633
|
+
}
|
|
12634
|
+
}
|
|
12635
|
+
delete trackingData.pressTargetsByButton[from.button];
|
|
12636
|
+
}
|
|
12637
|
+
_this.freeEvent(e);
|
|
12638
|
+
};
|
|
12639
|
+
this.onWheel = function (from) {
|
|
12640
|
+
// if (!(from instanceof FederatedWheelEvent)) {
|
|
12641
|
+
// return;
|
|
12642
|
+
// }
|
|
12643
|
+
var wheelEvent = _this.createWheelEvent(from);
|
|
12644
|
+
_this.dispatchEvent(wheelEvent);
|
|
12645
|
+
_this.freeEvent(wheelEvent);
|
|
12646
|
+
};
|
|
12647
|
+
this.onClick = function (from) {
|
|
12648
|
+
if (_this.context.config.useNativeClickEvent) {
|
|
12649
|
+
var e = _this.createPointerEvent(from);
|
|
12650
|
+
_this.dispatchEvent(e);
|
|
12651
|
+
_this.freeEvent(e);
|
|
12652
|
+
}
|
|
12653
|
+
};
|
|
12654
|
+
this.onPointerCancel = function (from) {
|
|
12655
|
+
var e = _this.createPointerEvent(from);
|
|
12656
|
+
_this.dispatchEvent(e);
|
|
12657
|
+
_this.freeEvent(e);
|
|
12658
|
+
};
|
|
12577
12659
|
this.globalRuntime = globalRuntime;
|
|
12578
12660
|
this.context = context;
|
|
12579
12661
|
}
|
|
@@ -12585,9 +12667,11 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12585
12667
|
this.addEventMapping('pointermove', this.onPointerMove);
|
|
12586
12668
|
this.addEventMapping('pointerout', this.onPointerOut);
|
|
12587
12669
|
this.addEventMapping('pointerleave', this.onPointerOut);
|
|
12670
|
+
this.addEventMapping('pointercancel', this.onPointerCancel);
|
|
12588
12671
|
this.addEventMapping('pointerover', this.onPointerOver);
|
|
12589
12672
|
this.addEventMapping('pointerupoutside', this.onPointerUpOutside);
|
|
12590
12673
|
this.addEventMapping('wheel', this.onWheel);
|
|
12674
|
+
this.addEventMapping('click', this.onClick);
|
|
12591
12675
|
};
|
|
12592
12676
|
_proto.destroy = function destroy() {
|
|
12593
12677
|
this.emitter.removeAllListeners();
|
|
@@ -12603,9 +12687,9 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12603
12687
|
var bbox = this.context.contextService.getBoundingClientRect();
|
|
12604
12688
|
return new Point(canvas.x + ((bbox === null || bbox === void 0 ? void 0 : bbox.left) || 0), canvas.y + ((bbox === null || bbox === void 0 ? void 0 : bbox.top) || 0));
|
|
12605
12689
|
};
|
|
12606
|
-
_proto.viewport2Canvas = function viewport2Canvas(
|
|
12607
|
-
var x =
|
|
12608
|
-
y =
|
|
12690
|
+
_proto.viewport2Canvas = function viewport2Canvas(_ref) {
|
|
12691
|
+
var x = _ref.x,
|
|
12692
|
+
y = _ref.y;
|
|
12609
12693
|
var canvas = this.rootTarget.defaultView;
|
|
12610
12694
|
var camera = canvas.getCamera();
|
|
12611
12695
|
var _this$context$config = this.context.config,
|
|
@@ -12728,58 +12812,24 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12728
12812
|
}
|
|
12729
12813
|
return propagationPath;
|
|
12730
12814
|
};
|
|
12731
|
-
_proto.hitTest =
|
|
12732
|
-
var
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
|
|
12740
|
-
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
12741
|
-
_context8.next = 4;
|
|
12742
|
-
break;
|
|
12743
|
-
}
|
|
12744
|
-
return _context8.abrupt("return", null);
|
|
12745
|
-
case 4:
|
|
12746
|
-
_context8.next = 6;
|
|
12747
|
-
return this.pickHandler(position);
|
|
12748
|
-
case 6:
|
|
12749
|
-
_context8.t1 = _context8.sent;
|
|
12750
|
-
if (_context8.t1) {
|
|
12751
|
-
_context8.next = 9;
|
|
12752
|
-
break;
|
|
12753
|
-
}
|
|
12754
|
-
_context8.t1 = this.rootTarget;
|
|
12755
|
-
case 9:
|
|
12756
|
-
_context8.t0 = _context8.t1;
|
|
12757
|
-
if (_context8.t0) {
|
|
12758
|
-
_context8.next = 12;
|
|
12759
|
-
break;
|
|
12760
|
-
}
|
|
12761
|
-
_context8.t0 =
|
|
12762
|
-
// return Document
|
|
12763
|
-
null;
|
|
12764
|
-
case 12:
|
|
12765
|
-
return _context8.abrupt("return", _context8.t0);
|
|
12766
|
-
case 13:
|
|
12767
|
-
case "end":
|
|
12768
|
-
return _context8.stop();
|
|
12769
|
-
}
|
|
12770
|
-
}
|
|
12771
|
-
}, _callee8, this);
|
|
12772
|
-
}));
|
|
12773
|
-
function hitTest(_x8) {
|
|
12774
|
-
return _hitTest.apply(this, arguments);
|
|
12815
|
+
_proto.hitTest = function hitTest(position) {
|
|
12816
|
+
var viewportX = position.viewportX,
|
|
12817
|
+
viewportY = position.viewportY;
|
|
12818
|
+
var _this$context$config3 = this.context.config,
|
|
12819
|
+
width = _this$context$config3.width,
|
|
12820
|
+
height = _this$context$config3.height;
|
|
12821
|
+
// outside canvas
|
|
12822
|
+
if (viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height) {
|
|
12823
|
+
return null;
|
|
12775
12824
|
}
|
|
12776
|
-
return
|
|
12777
|
-
|
|
12825
|
+
return this.pickHandler(position) || this.rootTarget ||
|
|
12826
|
+
// return Document
|
|
12827
|
+
null;
|
|
12828
|
+
}
|
|
12778
12829
|
/**
|
|
12779
12830
|
* whether the native event trigger came from Canvas,
|
|
12780
12831
|
* should account for HTML shape
|
|
12781
|
-
|
|
12782
|
-
;
|
|
12832
|
+
*/;
|
|
12783
12833
|
_proto.isNativeEventFromCanvas = function isNativeEventFromCanvas(event) {
|
|
12784
12834
|
var _event$nativeEvent;
|
|
12785
12835
|
var $el = this.context.contextService.getDomElement();
|
|
@@ -12812,135 +12862,41 @@ var EventService = /*#__PURE__*/function () {
|
|
|
12812
12862
|
}
|
|
12813
12863
|
return null;
|
|
12814
12864
|
};
|
|
12815
|
-
_proto.pickTarget =
|
|
12816
|
-
|
|
12817
|
-
|
|
12818
|
-
|
|
12819
|
-
|
|
12820
|
-
|
|
12821
|
-
|
|
12822
|
-
|
|
12823
|
-
|
|
12824
|
-
|
|
12825
|
-
|
|
12826
|
-
|
|
12827
|
-
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
|
|
12831
|
-
|
|
12832
|
-
|
|
12833
|
-
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
function pickTarget(_x9) {
|
|
12837
|
-
return _pickTarget.apply(this, arguments);
|
|
12838
|
-
}
|
|
12839
|
-
return pickTarget;
|
|
12840
|
-
}();
|
|
12841
|
-
_proto.createPointerEvent = /*#__PURE__*/function () {
|
|
12842
|
-
var _createPointerEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(from, type, target) {
|
|
12843
|
-
var event, existedHTML;
|
|
12844
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
12845
|
-
while (1) {
|
|
12846
|
-
switch (_context10.prev = _context10.next) {
|
|
12847
|
-
case 0:
|
|
12848
|
-
event = this.allocateEvent(FederatedPointerEvent);
|
|
12849
|
-
this.copyPointerData(from, event);
|
|
12850
|
-
this.copyMouseData(from, event);
|
|
12851
|
-
this.copyData(from, event);
|
|
12852
|
-
event.nativeEvent = from.nativeEvent;
|
|
12853
|
-
event.originalEvent = from;
|
|
12854
|
-
existedHTML = this.getExistedHTML(event);
|
|
12855
|
-
if (!(target !== null && target !== void 0)) {
|
|
12856
|
-
_context10.next = 11;
|
|
12857
|
-
break;
|
|
12858
|
-
}
|
|
12859
|
-
_context10.t0 = target;
|
|
12860
|
-
_context10.next = 20;
|
|
12861
|
-
break;
|
|
12862
|
-
case 11:
|
|
12863
|
-
_context10.t1 = existedHTML;
|
|
12864
|
-
if (_context10.t1) {
|
|
12865
|
-
_context10.next = 19;
|
|
12866
|
-
break;
|
|
12867
|
-
}
|
|
12868
|
-
_context10.t2 = this.isNativeEventFromCanvas(event);
|
|
12869
|
-
if (!_context10.t2) {
|
|
12870
|
-
_context10.next = 18;
|
|
12871
|
-
break;
|
|
12872
|
-
}
|
|
12873
|
-
_context10.next = 17;
|
|
12874
|
-
return this.pickTarget(event);
|
|
12875
|
-
case 17:
|
|
12876
|
-
_context10.t2 = _context10.sent;
|
|
12877
|
-
case 18:
|
|
12878
|
-
_context10.t1 = _context10.t2;
|
|
12879
|
-
case 19:
|
|
12880
|
-
_context10.t0 = _context10.t1;
|
|
12881
|
-
case 20:
|
|
12882
|
-
event.target = _context10.t0;
|
|
12883
|
-
if (typeof type === 'string') {
|
|
12884
|
-
event.type = type;
|
|
12885
|
-
}
|
|
12886
|
-
return _context10.abrupt("return", event);
|
|
12887
|
-
case 23:
|
|
12888
|
-
case "end":
|
|
12889
|
-
return _context10.stop();
|
|
12890
|
-
}
|
|
12891
|
-
}
|
|
12892
|
-
}, _callee10, this);
|
|
12893
|
-
}));
|
|
12894
|
-
function createPointerEvent(_x10, _x11, _x12) {
|
|
12895
|
-
return _createPointerEvent.apply(this, arguments);
|
|
12896
|
-
}
|
|
12897
|
-
return createPointerEvent;
|
|
12898
|
-
}();
|
|
12899
|
-
_proto.createWheelEvent = /*#__PURE__*/function () {
|
|
12900
|
-
var _createWheelEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(from) {
|
|
12901
|
-
var event, existedHTML;
|
|
12902
|
-
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
12903
|
-
while (1) {
|
|
12904
|
-
switch (_context11.prev = _context11.next) {
|
|
12905
|
-
case 0:
|
|
12906
|
-
event = this.allocateEvent(FederatedWheelEvent);
|
|
12907
|
-
this.copyWheelData(from, event);
|
|
12908
|
-
this.copyMouseData(from, event);
|
|
12909
|
-
this.copyData(from, event);
|
|
12910
|
-
event.nativeEvent = from.nativeEvent;
|
|
12911
|
-
event.originalEvent = from;
|
|
12912
|
-
existedHTML = this.getExistedHTML(event);
|
|
12913
|
-
_context11.t0 = existedHTML;
|
|
12914
|
-
if (_context11.t0) {
|
|
12915
|
-
_context11.next = 15;
|
|
12916
|
-
break;
|
|
12917
|
-
}
|
|
12918
|
-
_context11.t1 = this.isNativeEventFromCanvas(event);
|
|
12919
|
-
if (!_context11.t1) {
|
|
12920
|
-
_context11.next = 14;
|
|
12921
|
-
break;
|
|
12922
|
-
}
|
|
12923
|
-
_context11.next = 13;
|
|
12924
|
-
return this.pickTarget(event);
|
|
12925
|
-
case 13:
|
|
12926
|
-
_context11.t1 = _context11.sent;
|
|
12927
|
-
case 14:
|
|
12928
|
-
_context11.t0 = _context11.t1;
|
|
12929
|
-
case 15:
|
|
12930
|
-
event.target = _context11.t0;
|
|
12931
|
-
return _context11.abrupt("return", event);
|
|
12932
|
-
case 17:
|
|
12933
|
-
case "end":
|
|
12934
|
-
return _context11.stop();
|
|
12935
|
-
}
|
|
12936
|
-
}
|
|
12937
|
-
}, _callee11, this);
|
|
12938
|
-
}));
|
|
12939
|
-
function createWheelEvent(_x13) {
|
|
12940
|
-
return _createWheelEvent.apply(this, arguments);
|
|
12865
|
+
_proto.pickTarget = function pickTarget(event) {
|
|
12866
|
+
return this.hitTest({
|
|
12867
|
+
clientX: event.clientX,
|
|
12868
|
+
clientY: event.clientY,
|
|
12869
|
+
viewportX: event.viewportX,
|
|
12870
|
+
viewportY: event.viewportY,
|
|
12871
|
+
x: event.canvasX,
|
|
12872
|
+
y: event.canvasY
|
|
12873
|
+
});
|
|
12874
|
+
};
|
|
12875
|
+
_proto.createPointerEvent = function createPointerEvent(from, type, target) {
|
|
12876
|
+
var event = this.allocateEvent(FederatedPointerEvent);
|
|
12877
|
+
this.copyPointerData(from, event);
|
|
12878
|
+
this.copyMouseData(from, event);
|
|
12879
|
+
this.copyData(from, event);
|
|
12880
|
+
event.nativeEvent = from.nativeEvent;
|
|
12881
|
+
event.originalEvent = from;
|
|
12882
|
+
var existedHTML = this.getExistedHTML(event);
|
|
12883
|
+
event.target = target !== null && target !== void 0 ? target : existedHTML || this.isNativeEventFromCanvas(event) && this.pickTarget(event);
|
|
12884
|
+
if (typeof type === 'string') {
|
|
12885
|
+
event.type = type;
|
|
12941
12886
|
}
|
|
12942
|
-
return
|
|
12943
|
-
}
|
|
12887
|
+
return event;
|
|
12888
|
+
};
|
|
12889
|
+
_proto.createWheelEvent = function createWheelEvent(from) {
|
|
12890
|
+
var event = this.allocateEvent(FederatedWheelEvent);
|
|
12891
|
+
this.copyWheelData(from, event);
|
|
12892
|
+
this.copyMouseData(from, event);
|
|
12893
|
+
this.copyData(from, event);
|
|
12894
|
+
event.nativeEvent = from.nativeEvent;
|
|
12895
|
+
event.originalEvent = from;
|
|
12896
|
+
var existedHTML = this.getExistedHTML(event);
|
|
12897
|
+
event.target = existedHTML || this.isNativeEventFromCanvas(event) && this.pickTarget(event);
|
|
12898
|
+
return event;
|
|
12899
|
+
};
|
|
12944
12900
|
_proto.trackingData = function trackingData(id) {
|
|
12945
12901
|
if (!this.mappingState.trackingData[id]) {
|
|
12946
12902
|
this.mappingState.trackingData[id] = {
|
|
@@ -13198,6 +13154,9 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
13198
13154
|
rendered: 0
|
|
13199
13155
|
};
|
|
13200
13156
|
this.zIndexCounter = 0;
|
|
13157
|
+
/**
|
|
13158
|
+
* avoid re-creating too many custom events
|
|
13159
|
+
*/
|
|
13201
13160
|
this.renderOrderChangedEvent = new CustomEvent(ElementEvent.RENDER_ORDER_CHANGED);
|
|
13202
13161
|
this.hooks = {
|
|
13203
13162
|
/**
|
|
@@ -13247,7 +13206,8 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
13247
13206
|
pointerOut: new SyncHook(['event']),
|
|
13248
13207
|
pointerOver: new SyncHook(['event']),
|
|
13249
13208
|
pointerWheel: new SyncHook(['event']),
|
|
13250
|
-
pointerCancel: new SyncHook(['event'])
|
|
13209
|
+
pointerCancel: new SyncHook(['event']),
|
|
13210
|
+
click: new SyncHook(['event'])
|
|
13251
13211
|
};
|
|
13252
13212
|
this.globalRuntime = globalRuntime;
|
|
13253
13213
|
this.context = context;
|
|
@@ -13257,22 +13217,20 @@ var RenderingService = /*#__PURE__*/function () {
|
|
|
13257
13217
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
13258
13218
|
var context;
|
|
13259
13219
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13260
|
-
while (1) {
|
|
13261
|
-
|
|
13262
|
-
|
|
13263
|
-
|
|
13264
|
-
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
return _context.stop();
|
|
13275
|
-
}
|
|
13220
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13221
|
+
case 0:
|
|
13222
|
+
context = _extends({}, this.globalRuntime, this.context); // register rendering plugins
|
|
13223
|
+
this.context.renderingPlugins.forEach(function (plugin) {
|
|
13224
|
+
plugin.apply(context, runtime);
|
|
13225
|
+
});
|
|
13226
|
+
// await this.hooks.init.callPromise();
|
|
13227
|
+
_context.next = 4;
|
|
13228
|
+
return this.hooks.init.promise();
|
|
13229
|
+
case 4:
|
|
13230
|
+
this.inited = true;
|
|
13231
|
+
case 5:
|
|
13232
|
+
case "end":
|
|
13233
|
+
return _context.stop();
|
|
13276
13234
|
}
|
|
13277
13235
|
}, _callee, this);
|
|
13278
13236
|
}));
|
|
@@ -13517,6 +13475,9 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13517
13475
|
this.runtime = void 0;
|
|
13518
13476
|
this.pendingEvents = [];
|
|
13519
13477
|
this.boundsChangedEvent = new CustomEvent(ElementEvent.BOUNDS_CHANGED);
|
|
13478
|
+
/**
|
|
13479
|
+
* rotate in world space
|
|
13480
|
+
*/
|
|
13520
13481
|
this.rotate = function () {
|
|
13521
13482
|
var parentInvertRotation = quat$1.create();
|
|
13522
13483
|
return function (element, degrees, y, z) {
|
|
@@ -13546,6 +13507,10 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13546
13507
|
}
|
|
13547
13508
|
};
|
|
13548
13509
|
}();
|
|
13510
|
+
/**
|
|
13511
|
+
* rotate in local space
|
|
13512
|
+
* @see @see https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-xmquaternionrotationrollpitchyaw
|
|
13513
|
+
*/
|
|
13549
13514
|
this.rotateLocal = function () {
|
|
13550
13515
|
var rotation = quat$1.create();
|
|
13551
13516
|
return function (element, degrees, y, z) {
|
|
@@ -13564,6 +13529,9 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13564
13529
|
_this.dirtifyLocal(element, transform);
|
|
13565
13530
|
};
|
|
13566
13531
|
}();
|
|
13532
|
+
/**
|
|
13533
|
+
* set euler angles(degrees) in world space
|
|
13534
|
+
*/
|
|
13567
13535
|
this.setEulerAngles = function () {
|
|
13568
13536
|
var invParentRot = quat$1.create();
|
|
13569
13537
|
return function (element, degrees, y, z) {
|
|
@@ -13588,6 +13556,15 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13588
13556
|
}
|
|
13589
13557
|
};
|
|
13590
13558
|
}();
|
|
13559
|
+
/**
|
|
13560
|
+
* translate in local space
|
|
13561
|
+
*
|
|
13562
|
+
* @example
|
|
13563
|
+
* ```
|
|
13564
|
+
* translateLocal(x, y, z)
|
|
13565
|
+
* translateLocal(vec3(x, y, z))
|
|
13566
|
+
* ```
|
|
13567
|
+
*/
|
|
13591
13568
|
this.translateLocal = function () {
|
|
13592
13569
|
return function (element, translation, y, z) {
|
|
13593
13570
|
if (y === void 0) {
|
|
@@ -13608,6 +13585,12 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13608
13585
|
_this.dirtifyLocal(element, transform);
|
|
13609
13586
|
};
|
|
13610
13587
|
}();
|
|
13588
|
+
/**
|
|
13589
|
+
* move to position in world space
|
|
13590
|
+
*
|
|
13591
|
+
* 对应 g 原版的 move/moveTo
|
|
13592
|
+
* @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L684-L689
|
|
13593
|
+
*/
|
|
13611
13594
|
this.setPosition = function () {
|
|
13612
13595
|
var parentInvertMatrix = mat4.create();
|
|
13613
13596
|
var tmpPosition = vec3.create();
|
|
@@ -13631,6 +13614,9 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13631
13614
|
_this.dirtifyLocal(element, transform);
|
|
13632
13615
|
};
|
|
13633
13616
|
}();
|
|
13617
|
+
/**
|
|
13618
|
+
* move to position in local space
|
|
13619
|
+
*/
|
|
13634
13620
|
this.setLocalPosition = function () {
|
|
13635
13621
|
var tmpPosition = vec3.create();
|
|
13636
13622
|
return function (element, position) {
|
|
@@ -13645,6 +13631,18 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13645
13631
|
_this.dirtifyLocal(element, transform);
|
|
13646
13632
|
};
|
|
13647
13633
|
}();
|
|
13634
|
+
/**
|
|
13635
|
+
* translate in world space
|
|
13636
|
+
*
|
|
13637
|
+
* @example
|
|
13638
|
+
* ```
|
|
13639
|
+
* translate(x, y, z)
|
|
13640
|
+
* translate(vec3(x, y, z))
|
|
13641
|
+
* ```
|
|
13642
|
+
*
|
|
13643
|
+
* 对应 g 原版的 translate 2D
|
|
13644
|
+
* @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L665-L676
|
|
13645
|
+
*/
|
|
13648
13646
|
this.translate = function () {
|
|
13649
13647
|
var zeroVec3 = vec3.create();
|
|
13650
13648
|
var tmpVec3 = vec3.create();
|
|
@@ -13811,10 +13809,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13811
13809
|
originVec[1] = origin[1];
|
|
13812
13810
|
originVec[2] = origin[2] || 0;
|
|
13813
13811
|
this.dirtifyLocal(element, transform);
|
|
13814
|
-
}
|
|
13815
|
-
/**
|
|
13816
|
-
* rotate in world space
|
|
13817
|
-
*/;
|
|
13812
|
+
};
|
|
13818
13813
|
/**
|
|
13819
13814
|
* set euler angles(degrees) in local space
|
|
13820
13815
|
*/
|
|
@@ -13831,16 +13826,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13831
13826
|
var transform = element.transformable;
|
|
13832
13827
|
quat$1.fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
13833
13828
|
this.dirtifyLocal(element, transform);
|
|
13834
|
-
}
|
|
13835
|
-
/**
|
|
13836
|
-
* translate in local space
|
|
13837
|
-
*
|
|
13838
|
-
* @example
|
|
13839
|
-
* ```
|
|
13840
|
-
* translateLocal(x, y, z)
|
|
13841
|
-
* translateLocal(vec3(x, y, z))
|
|
13842
|
-
* ```
|
|
13843
|
-
*/;
|
|
13829
|
+
};
|
|
13844
13830
|
/**
|
|
13845
13831
|
* scale in local space
|
|
13846
13832
|
*/
|
|
@@ -13857,19 +13843,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13857
13843
|
}
|
|
13858
13844
|
vec3.copy(transform.localScale, updatedScaling);
|
|
13859
13845
|
this.dirtifyLocal(element, transform);
|
|
13860
|
-
}
|
|
13861
|
-
/**
|
|
13862
|
-
* translate in world space
|
|
13863
|
-
*
|
|
13864
|
-
* @example
|
|
13865
|
-
* ```
|
|
13866
|
-
* translate(x, y, z)
|
|
13867
|
-
* translate(vec3(x, y, z))
|
|
13868
|
-
* ```
|
|
13869
|
-
*
|
|
13870
|
-
* 对应 g 原版的 translate 2D
|
|
13871
|
-
* @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L665-L676
|
|
13872
|
-
*/;
|
|
13846
|
+
};
|
|
13873
13847
|
_proto.setLocalRotation = function setLocalRotation(element, rotation, y, z, w) {
|
|
13874
13848
|
if (typeof rotation === 'number') {
|
|
13875
13849
|
rotation = quat$1.fromValues(rotation, y, z, w);
|
|
@@ -14278,6 +14252,9 @@ var TextService = /*#__PURE__*/function () {
|
|
|
14278
14252
|
function TextService(runtime) {
|
|
14279
14253
|
var _this = this;
|
|
14280
14254
|
this.runtime = void 0;
|
|
14255
|
+
/**
|
|
14256
|
+
* font metrics cache
|
|
14257
|
+
*/
|
|
14281
14258
|
this.fontMetricsCache = {};
|
|
14282
14259
|
this.shouldBreakByKinsokuShorui = function (char, nextChar) {
|
|
14283
14260
|
if (_this.isBreakingSpace(nextChar)) return false;
|
|
@@ -14302,9 +14279,6 @@ var TextService = /*#__PURE__*/function () {
|
|
|
14302
14279
|
};
|
|
14303
14280
|
this.runtime = runtime;
|
|
14304
14281
|
}
|
|
14305
|
-
/**
|
|
14306
|
-
* font metrics cache
|
|
14307
|
-
*/
|
|
14308
14282
|
var _proto = TextService.prototype;
|
|
14309
14283
|
/**
|
|
14310
14284
|
* Calculates the ascent, descent and fontSize of a given font-style.
|
|
@@ -14393,9 +14367,8 @@ var TextService = /*#__PURE__*/function () {
|
|
|
14393
14367
|
_parsedStyle$leading = parsedStyle.leading,
|
|
14394
14368
|
leading = _parsedStyle$leading === void 0 ? 0 : _parsedStyle$leading;
|
|
14395
14369
|
var font = toFontString(parsedStyle);
|
|
14396
|
-
var fontProperties;
|
|
14397
14370
|
// if (runtime.enableCSSParsing) {
|
|
14398
|
-
fontProperties = this.measureFont(font, offscreenCanvas);
|
|
14371
|
+
var fontProperties = this.measureFont(font, offscreenCanvas);
|
|
14399
14372
|
// fallback in case UA disallow canvas data extraction
|
|
14400
14373
|
// (toDataURI, getImageData functions)
|
|
14401
14374
|
if (fontProperties.fontSize === 0) {
|
|
@@ -14867,34 +14840,15 @@ var EventPlugin = /*#__PURE__*/function () {
|
|
|
14867
14840
|
this.context = context;
|
|
14868
14841
|
var renderingService = context.renderingService;
|
|
14869
14842
|
var canvas = this.context.renderingContext.root.ownerDocument.defaultView;
|
|
14870
|
-
this.context.eventService.setPickHandler(
|
|
14871
|
-
var
|
|
14872
|
-
|
|
14873
|
-
|
|
14874
|
-
|
|
14875
|
-
|
|
14876
|
-
|
|
14877
|
-
|
|
14878
|
-
|
|
14879
|
-
position: position,
|
|
14880
|
-
picked: [],
|
|
14881
|
-
topmost: true // we only concern the topmost element
|
|
14882
|
-
});
|
|
14883
|
-
case 2:
|
|
14884
|
-
_yield$_this2$context = _context.sent;
|
|
14885
|
-
picked = _yield$_this2$context.picked;
|
|
14886
|
-
return _context.abrupt("return", picked[0] || null);
|
|
14887
|
-
case 5:
|
|
14888
|
-
case "end":
|
|
14889
|
-
return _context.stop();
|
|
14890
|
-
}
|
|
14891
|
-
}
|
|
14892
|
-
}, _callee);
|
|
14893
|
-
}));
|
|
14894
|
-
return function (_x) {
|
|
14895
|
-
return _ref.apply(this, arguments);
|
|
14896
|
-
};
|
|
14897
|
-
}());
|
|
14843
|
+
this.context.eventService.setPickHandler(function (position) {
|
|
14844
|
+
var _this2$context$render = _this2.context.renderingService.hooks.pickSync.call({
|
|
14845
|
+
position: position,
|
|
14846
|
+
picked: [],
|
|
14847
|
+
topmost: true // we only concern the topmost element
|
|
14848
|
+
}),
|
|
14849
|
+
picked = _this2$context$render.picked;
|
|
14850
|
+
return picked[0] || null;
|
|
14851
|
+
});
|
|
14898
14852
|
renderingService.hooks.pointerWheel.tap(EventPlugin.tag, function (nativeEvent) {
|
|
14899
14853
|
var wheelEvent = _this2.normalizeWheelEvent(nativeEvent);
|
|
14900
14854
|
_this2.context.eventService.mapEvent(wheelEvent);
|
|
@@ -14938,6 +14892,16 @@ var EventPlugin = /*#__PURE__*/function () {
|
|
|
14938
14892
|
renderingService.hooks.pointerMove.tap(EventPlugin.tag, this.onPointerMove);
|
|
14939
14893
|
renderingService.hooks.pointerOver.tap(EventPlugin.tag, this.onPointerMove);
|
|
14940
14894
|
renderingService.hooks.pointerOut.tap(EventPlugin.tag, this.onPointerMove);
|
|
14895
|
+
renderingService.hooks.click.tap(EventPlugin.tag, this.onPointerMove);
|
|
14896
|
+
renderingService.hooks.pointerCancel.tap(EventPlugin.tag, function (nativeEvent) {
|
|
14897
|
+
var normalizedEvents = _this2.normalizeToPointerEvent(nativeEvent, canvas);
|
|
14898
|
+
for (var _iterator4 = _createForOfIteratorHelperLoose(normalizedEvents), _step4; !(_step4 = _iterator4()).done;) {
|
|
14899
|
+
var normalizedEvent = _step4.value;
|
|
14900
|
+
var event = _this2.bootstrapEvent(_this2.rootPointerEvent, normalizedEvent, canvas, nativeEvent);
|
|
14901
|
+
_this2.context.eventService.mapEvent(event);
|
|
14902
|
+
}
|
|
14903
|
+
_this2.setCursor(_this2.context.eventService.cursor);
|
|
14904
|
+
});
|
|
14941
14905
|
};
|
|
14942
14906
|
_proto.getViewportXY = function getViewportXY(nativeEvent) {
|
|
14943
14907
|
var x;
|
|
@@ -15182,6 +15146,9 @@ var FrustumCullingStrategy = /*#__PURE__*/function () {
|
|
|
15182
15146
|
var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
15183
15147
|
function PrepareRendererPlugin() {
|
|
15184
15148
|
this.rBush = void 0;
|
|
15149
|
+
/**
|
|
15150
|
+
* sync to RBush later
|
|
15151
|
+
*/
|
|
15185
15152
|
this.toSync = new Set();
|
|
15186
15153
|
}
|
|
15187
15154
|
var _proto = PrepareRendererPlugin.prototype;
|
|
@@ -15238,17 +15205,15 @@ var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
|
15238
15205
|
};
|
|
15239
15206
|
renderingService.hooks.init.tapPromise(PrepareRendererPlugin.tag, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
15240
15207
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15241
|
-
while (1) {
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
return _context.stop();
|
|
15251
|
-
}
|
|
15208
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15209
|
+
case 0:
|
|
15210
|
+
canvas.addEventListener(ElementEvent.MOUNTED, handleMounted);
|
|
15211
|
+
canvas.addEventListener(ElementEvent.UNMOUNTED, handleUnmounted);
|
|
15212
|
+
canvas.addEventListener(ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
15213
|
+
canvas.addEventListener(ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
15214
|
+
case 4:
|
|
15215
|
+
case "end":
|
|
15216
|
+
return _context.stop();
|
|
15252
15217
|
}
|
|
15253
15218
|
}, _callee);
|
|
15254
15219
|
})));
|
|
@@ -15447,6 +15412,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
15447
15412
|
supportsPointerEvents = config.supportsPointerEvents,
|
|
15448
15413
|
supportsTouchEvents = config.supportsTouchEvents,
|
|
15449
15414
|
supportsCSSTransform = config.supportsCSSTransform,
|
|
15415
|
+
useNativeClickEvent = config.useNativeClickEvent,
|
|
15450
15416
|
isTouchEvent = config.isTouchEvent,
|
|
15451
15417
|
isMouseEvent = config.isMouseEvent;
|
|
15452
15418
|
cleanExistedCanvas(container, _assertThisInitialized(_this));
|
|
@@ -15492,25 +15458,24 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
15492
15458
|
background: background || 'transparent',
|
|
15493
15459
|
createImage: createImage,
|
|
15494
15460
|
document: document,
|
|
15495
|
-
supportsCSSTransform: supportsCSSTransform
|
|
15461
|
+
supportsCSSTransform: supportsCSSTransform,
|
|
15462
|
+
useNativeClickEvent: useNativeClickEvent
|
|
15496
15463
|
});
|
|
15497
15464
|
_this.initDefaultCamera(canvasWidth, canvasHeight);
|
|
15498
15465
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
15499
15466
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15500
|
-
while (1) {
|
|
15501
|
-
|
|
15502
|
-
|
|
15503
|
-
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15512
|
-
return _context.stop();
|
|
15513
|
-
}
|
|
15467
|
+
while (1) switch (_context.prev = _context.next) {
|
|
15468
|
+
case 0:
|
|
15469
|
+
_context.next = 2;
|
|
15470
|
+
return _this.initRenderer(renderer);
|
|
15471
|
+
case 2:
|
|
15472
|
+
_this.dispatchEvent(new CustomEvent(CanvasEvent.READY));
|
|
15473
|
+
if (_this.readyPromise) {
|
|
15474
|
+
_this.resolveReadyPromise();
|
|
15475
|
+
}
|
|
15476
|
+
case 4:
|
|
15477
|
+
case "end":
|
|
15478
|
+
return _context.stop();
|
|
15514
15479
|
}
|
|
15515
15480
|
}, _callee);
|
|
15516
15481
|
}))();
|
|
@@ -15698,56 +15663,54 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
15698
15663
|
_proto.initRenderer = /*#__PURE__*/function () {
|
|
15699
15664
|
var _initRenderer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(renderer) {
|
|
15700
15665
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
15701
|
-
while (1) {
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
|
|
15727
|
-
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15731
|
-
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
|
|
15735
|
-
|
|
15736
|
-
|
|
15737
|
-
|
|
15738
|
-
|
|
15739
|
-
renderable.dirty = true;
|
|
15740
|
-
}
|
|
15741
|
-
});
|
|
15742
|
-
// keep current scenegraph unchanged, just trigger mounted event
|
|
15743
|
-
this.mountChildren(this.getRoot());
|
|
15744
|
-
if (renderer.getConfig().enableAutoRendering) {
|
|
15745
|
-
this.run();
|
|
15666
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
15667
|
+
case 0:
|
|
15668
|
+
if (renderer) {
|
|
15669
|
+
_context2.next = 2;
|
|
15670
|
+
break;
|
|
15671
|
+
}
|
|
15672
|
+
throw new Error('Renderer is required.');
|
|
15673
|
+
case 2:
|
|
15674
|
+
// reset
|
|
15675
|
+
this.inited = false;
|
|
15676
|
+
this.readyPromise = undefined;
|
|
15677
|
+
// FIXME: should re-create here?
|
|
15678
|
+
this.context.rBushRoot = new RBush();
|
|
15679
|
+
// reset rendering plugins
|
|
15680
|
+
this.context.renderingPlugins = [];
|
|
15681
|
+
this.context.renderingPlugins.push(new EventPlugin(), new PrepareRendererPlugin(), new DirtyCheckPlugin(), new CullingPlugin([new FrustumCullingStrategy()]));
|
|
15682
|
+
//
|
|
15683
|
+
this.loadRendererContainerModule(renderer);
|
|
15684
|
+
// init context service
|
|
15685
|
+
this.context.contextService = new this.context.ContextService(_extends({}, runtime, this.context));
|
|
15686
|
+
// init rendering service
|
|
15687
|
+
this.context.renderingService = new RenderingService(runtime, this.context);
|
|
15688
|
+
// init event service
|
|
15689
|
+
this.context.eventService = new EventService(runtime, this.context);
|
|
15690
|
+
this.context.eventService.init();
|
|
15691
|
+
_context2.next = 14;
|
|
15692
|
+
return this.context.contextService.init();
|
|
15693
|
+
case 14:
|
|
15694
|
+
_context2.next = 16;
|
|
15695
|
+
return this.context.renderingService.init();
|
|
15696
|
+
case 16:
|
|
15697
|
+
this.inited = true;
|
|
15698
|
+
this.getRoot().forEach(function (node) {
|
|
15699
|
+
var renderable = node.renderable;
|
|
15700
|
+
if (renderable) {
|
|
15701
|
+
renderable.renderBoundsDirty = true;
|
|
15702
|
+
renderable.boundsDirty = true;
|
|
15703
|
+
renderable.dirty = true;
|
|
15746
15704
|
}
|
|
15747
|
-
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
15705
|
+
});
|
|
15706
|
+
// keep current scenegraph unchanged, just trigger mounted event
|
|
15707
|
+
this.mountChildren(this.getRoot());
|
|
15708
|
+
if (renderer.getConfig().enableAutoRendering) {
|
|
15709
|
+
this.run();
|
|
15710
|
+
}
|
|
15711
|
+
case 20:
|
|
15712
|
+
case "end":
|
|
15713
|
+
return _context2.stop();
|
|
15751
15714
|
}
|
|
15752
15715
|
}, _callee2, this);
|
|
15753
15716
|
}));
|
|
@@ -15769,31 +15732,29 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
|
|
|
15769
15732
|
var _setRenderer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(renderer) {
|
|
15770
15733
|
var canvasConfig, oldRenderer;
|
|
15771
15734
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
15772
|
-
while (1) {
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
15779
|
-
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
15787
|
-
|
|
15788
|
-
|
|
15789
|
-
|
|
15790
|
-
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15794
|
-
|
|
15795
|
-
return _context3.stop();
|
|
15796
|
-
}
|
|
15735
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
15736
|
+
case 0:
|
|
15737
|
+
// update canvas' config
|
|
15738
|
+
canvasConfig = this.getConfig();
|
|
15739
|
+
if (!(canvasConfig.renderer === renderer)) {
|
|
15740
|
+
_context3.next = 3;
|
|
15741
|
+
break;
|
|
15742
|
+
}
|
|
15743
|
+
return _context3.abrupt("return");
|
|
15744
|
+
case 3:
|
|
15745
|
+
oldRenderer = canvasConfig.renderer;
|
|
15746
|
+
canvasConfig.renderer = renderer;
|
|
15747
|
+
// keep all children undestroyed
|
|
15748
|
+
this.destroy(false, true);
|
|
15749
|
+
// destroy all plugins, reverse will mutate origin array
|
|
15750
|
+
[].concat(oldRenderer === null || oldRenderer === void 0 ? void 0 : oldRenderer.getPlugins()).reverse().forEach(function (plugin) {
|
|
15751
|
+
plugin.destroy(runtime);
|
|
15752
|
+
});
|
|
15753
|
+
_context3.next = 9;
|
|
15754
|
+
return this.initRenderer(renderer);
|
|
15755
|
+
case 9:
|
|
15756
|
+
case "end":
|
|
15757
|
+
return _context3.stop();
|
|
15797
15758
|
}
|
|
15798
15759
|
}, _callee3, this);
|
|
15799
15760
|
}));
|