@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.umd.js
CHANGED
|
@@ -7777,9 +7777,7 @@
|
|
|
7777
7777
|
// Cannot normalize.
|
|
7778
7778
|
if (m44 === 0) return false;
|
|
7779
7779
|
var scale = 1 / m44;
|
|
7780
|
-
for (var i = 0; i < 16; i++)
|
|
7781
|
-
out[i] = mat[i] * scale;
|
|
7782
|
-
}
|
|
7780
|
+
for (var i = 0; i < 16; i++) out[i] = mat[i] * scale;
|
|
7783
7781
|
return true;
|
|
7784
7782
|
}
|
|
7785
7783
|
//gets upper-left of a 4x4 matrix into a 3x3 of vectors
|
|
@@ -10365,7 +10363,7 @@
|
|
|
10365
10363
|
var code = '';
|
|
10366
10364
|
var current = onDone;
|
|
10367
10365
|
var unrollCounter = 0;
|
|
10368
|
-
var _loop = function _loop(
|
|
10366
|
+
var _loop = function _loop() {
|
|
10369
10367
|
var i = j;
|
|
10370
10368
|
var unroll = current !== onDone && (_this2.options.taps[i].type !== 'sync' || unrollCounter++ > 20);
|
|
10371
10369
|
if (unroll) {
|
|
@@ -10397,7 +10395,7 @@
|
|
|
10397
10395
|
};
|
|
10398
10396
|
};
|
|
10399
10397
|
for (var j = this.options.taps.length - 1; j >= 0; j--) {
|
|
10400
|
-
_loop(
|
|
10398
|
+
_loop();
|
|
10401
10399
|
}
|
|
10402
10400
|
code += current();
|
|
10403
10401
|
return code;
|
|
@@ -10922,12 +10920,10 @@
|
|
|
10922
10920
|
// support '%' & 'px'
|
|
10923
10921
|
var offset = (_colorStops$i$length = colorStops[i].length) === null || _colorStops$i$length === void 0 ? void 0 : _colorStops$i$length.value;
|
|
10924
10922
|
if (!isNil(offset) && !isNil(previousOffset)) {
|
|
10925
|
-
for (var j = 1; j < i - previousIndex; j++) {
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
10929
|
-
};
|
|
10930
|
-
}
|
|
10923
|
+
for (var j = 1; j < i - previousIndex; j++) colorStops[previousIndex + j].length = {
|
|
10924
|
+
type: '%',
|
|
10925
|
+
value: "" + (previousOffset + (Number(offset) - previousOffset) * j / (i - previousIndex))
|
|
10926
|
+
};
|
|
10931
10927
|
previousIndex = i;
|
|
10932
10928
|
previousOffset = Number(offset);
|
|
10933
10929
|
}
|
|
@@ -11204,9 +11200,7 @@
|
|
|
11204
11200
|
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) {
|
|
11205
11201
|
var rgba = color.slice();
|
|
11206
11202
|
if (rgba[3]) {
|
|
11207
|
-
for (var i = 0; i < 3; i++)
|
|
11208
|
-
rgba[i] = Math.round(clamp(rgba[i], 0, 255));
|
|
11209
|
-
}
|
|
11203
|
+
for (var i = 0; i < 3; i++) rgba[i] = Math.round(clamp(rgba[i], 0, 255));
|
|
11210
11204
|
}
|
|
11211
11205
|
rgba[3] = clamp(rgba[3], 0, 1);
|
|
11212
11206
|
return "rgba(" + rgba.join(',') + ")";
|
|
@@ -12000,7 +11994,7 @@
|
|
|
12000
11994
|
left = right;
|
|
12001
11995
|
right = [];
|
|
12002
11996
|
}
|
|
12003
|
-
var _loop = function _loop(
|
|
11997
|
+
var _loop = function _loop() {
|
|
12004
11998
|
var _left$i = left[i],
|
|
12005
11999
|
type = _left$i.t,
|
|
12006
12000
|
args = _left$i.d;
|
|
@@ -12021,7 +12015,7 @@
|
|
|
12021
12015
|
});
|
|
12022
12016
|
};
|
|
12023
12017
|
for (var i = 0; i < left.length; i++) {
|
|
12024
|
-
_loop(
|
|
12018
|
+
_loop();
|
|
12025
12019
|
}
|
|
12026
12020
|
}
|
|
12027
12021
|
var leftResult = [];
|
|
@@ -12923,6 +12917,9 @@
|
|
|
12923
12917
|
|
|
12924
12918
|
var CSSPropertyPath = /*#__PURE__*/function () {
|
|
12925
12919
|
function CSSPropertyPath() {
|
|
12920
|
+
/**
|
|
12921
|
+
* path2Curve
|
|
12922
|
+
*/
|
|
12926
12923
|
this.parser = parsePath;
|
|
12927
12924
|
this.parserWithCSSDisabled = parsePath;
|
|
12928
12925
|
this.mixer = mergePaths;
|
|
@@ -13170,26 +13167,83 @@
|
|
|
13170
13167
|
* within the boundary's jurisdiction.
|
|
13171
13168
|
*/
|
|
13172
13169
|
function FederatedEvent(manager) {
|
|
13170
|
+
/**
|
|
13171
|
+
* The type of event, supports the following:
|
|
13172
|
+
* * pointerdown
|
|
13173
|
+
* * touchstart
|
|
13174
|
+
* * mousedown
|
|
13175
|
+
* * rightdown
|
|
13176
|
+
* * ...
|
|
13177
|
+
*/
|
|
13173
13178
|
this.type = void 0;
|
|
13179
|
+
/**
|
|
13180
|
+
* The propagation phase.
|
|
13181
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
|
|
13182
|
+
*/
|
|
13174
13183
|
this.eventPhase = FederatedEvent.prototype.NONE;
|
|
13184
|
+
/**
|
|
13185
|
+
* can be used to implement event delegation
|
|
13186
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/target
|
|
13187
|
+
*/
|
|
13175
13188
|
this.target = void 0;
|
|
13189
|
+
/**
|
|
13190
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/bubbles
|
|
13191
|
+
*/
|
|
13176
13192
|
this.bubbles = true;
|
|
13193
|
+
/**
|
|
13194
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/cancelBubble
|
|
13195
|
+
*/
|
|
13177
13196
|
this.cancelBubble = true;
|
|
13197
|
+
/**
|
|
13198
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/cancelable
|
|
13199
|
+
*/
|
|
13178
13200
|
this.cancelable = false;
|
|
13201
|
+
/** the event target when listeners binded */
|
|
13179
13202
|
this.currentTarget = void 0;
|
|
13203
|
+
/** Flags whether the default response of the user agent was prevent through this event. */
|
|
13180
13204
|
this.defaultPrevented = false;
|
|
13205
|
+
/**
|
|
13206
|
+
* timestamp when the event created
|
|
13207
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Event/timeStamp
|
|
13208
|
+
*/
|
|
13181
13209
|
this.timeStamp = void 0;
|
|
13210
|
+
/**
|
|
13211
|
+
* the original event.
|
|
13212
|
+
*/
|
|
13182
13213
|
this.nativeEvent = void 0;
|
|
13214
|
+
/** The original event that caused this event, if any. */
|
|
13183
13215
|
this.originalEvent = void 0;
|
|
13216
|
+
/** Flags whether propagation was stopped. */
|
|
13184
13217
|
this.propagationStopped = false;
|
|
13218
|
+
/** Flags whether propagation was immediately stopped. */
|
|
13185
13219
|
this.propagationImmediatelyStopped = false;
|
|
13186
13220
|
this.manager = void 0;
|
|
13221
|
+
/** Event-specific detail */
|
|
13187
13222
|
this.detail = void 0;
|
|
13223
|
+
/**
|
|
13224
|
+
* The coordinates of the evnet relative to the nearest DOM layer.
|
|
13225
|
+
* This is a non-standard property.
|
|
13226
|
+
*/
|
|
13188
13227
|
this.layer = new Point();
|
|
13228
|
+
/**
|
|
13229
|
+
* The coordinates of the event relative to the DOM document.
|
|
13230
|
+
* This is a non-standard property.
|
|
13231
|
+
* relative to the DOM document.
|
|
13232
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/pageX
|
|
13233
|
+
*/
|
|
13189
13234
|
this.page = new Point();
|
|
13235
|
+
/**
|
|
13236
|
+
* relative to Canvas, origin is left-top
|
|
13237
|
+
*/
|
|
13190
13238
|
this.canvas = new Point();
|
|
13239
|
+
/**
|
|
13240
|
+
* relative to Viewport, account for Camera
|
|
13241
|
+
*/
|
|
13191
13242
|
this.viewport = new Point();
|
|
13192
13243
|
this.path = void 0;
|
|
13244
|
+
/**
|
|
13245
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
|
|
13246
|
+
*/
|
|
13193
13247
|
this.view = void 0;
|
|
13194
13248
|
this.which = void 0;
|
|
13195
13249
|
this.returnValue = void 0;
|
|
@@ -13239,10 +13293,7 @@
|
|
|
13239
13293
|
*/;
|
|
13240
13294
|
_proto.stopPropagation = function stopPropagation() {
|
|
13241
13295
|
this.propagationStopped = true;
|
|
13242
|
-
}
|
|
13243
|
-
/**
|
|
13244
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/UIEvent/view
|
|
13245
|
-
*/;
|
|
13296
|
+
};
|
|
13246
13297
|
/**
|
|
13247
13298
|
* added for compatibility with DOM Event,
|
|
13248
13299
|
* deprecated props and methods
|
|
@@ -13255,25 +13306,12 @@
|
|
|
13255
13306
|
_createClass(FederatedEvent, [{
|
|
13256
13307
|
key: "name",
|
|
13257
13308
|
get:
|
|
13258
|
-
/**
|
|
13259
|
-
* The type of event, supports the following:
|
|
13260
|
-
* * pointerdown
|
|
13261
|
-
* * touchstart
|
|
13262
|
-
* * mousedown
|
|
13263
|
-
* * rightdown
|
|
13264
|
-
* * ...
|
|
13265
|
-
*/
|
|
13266
|
-
|
|
13267
13309
|
/**
|
|
13268
13310
|
* @deprecated
|
|
13269
13311
|
*/
|
|
13270
13312
|
function get() {
|
|
13271
13313
|
return this.type;
|
|
13272
13314
|
}
|
|
13273
|
-
/**
|
|
13274
|
-
* The propagation phase.
|
|
13275
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Event/eventPhase
|
|
13276
|
-
*/
|
|
13277
13315
|
}, {
|
|
13278
13316
|
key: "layerX",
|
|
13279
13317
|
get: function get() {
|
|
@@ -13284,12 +13322,6 @@
|
|
|
13284
13322
|
get: function get() {
|
|
13285
13323
|
return this.layer.y;
|
|
13286
13324
|
}
|
|
13287
|
-
/**
|
|
13288
|
-
* The coordinates of the event relative to the DOM document.
|
|
13289
|
-
* This is a non-standard property.
|
|
13290
|
-
* relative to the DOM document.
|
|
13291
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/MouseEvent/pageX
|
|
13292
|
-
*/
|
|
13293
13325
|
}, {
|
|
13294
13326
|
key: "pageX",
|
|
13295
13327
|
get: function get() {
|
|
@@ -13300,9 +13332,6 @@
|
|
|
13300
13332
|
get: function get() {
|
|
13301
13333
|
return this.page.y;
|
|
13302
13334
|
}
|
|
13303
|
-
/**
|
|
13304
|
-
* relative to Canvas, origin is left-top
|
|
13305
|
-
*/
|
|
13306
13335
|
}, {
|
|
13307
13336
|
key: "x",
|
|
13308
13337
|
get: function get() {
|
|
@@ -13323,9 +13352,6 @@
|
|
|
13323
13352
|
get: function get() {
|
|
13324
13353
|
return this.canvas.y;
|
|
13325
13354
|
}
|
|
13326
|
-
/**
|
|
13327
|
-
* relative to Viewport, account for Camera
|
|
13328
|
-
*/
|
|
13329
13355
|
}, {
|
|
13330
13356
|
key: "viewportX",
|
|
13331
13357
|
get: function get() {
|
|
@@ -13718,6 +13744,9 @@
|
|
|
13718
13744
|
*/
|
|
13719
13745
|
var EventTarget = /*#__PURE__*/function () {
|
|
13720
13746
|
function EventTarget() {
|
|
13747
|
+
/**
|
|
13748
|
+
* event emitter
|
|
13749
|
+
*/
|
|
13721
13750
|
this.emitter = new eventemitter3();
|
|
13722
13751
|
}
|
|
13723
13752
|
var _proto = EventTarget.prototype;
|
|
@@ -13860,13 +13889,44 @@
|
|
|
13860
13889
|
}
|
|
13861
13890
|
_this = _EventTarget.call.apply(_EventTarget, [this].concat(args)) || this;
|
|
13862
13891
|
_this.shadow = false;
|
|
13892
|
+
/**
|
|
13893
|
+
* points to canvas.document
|
|
13894
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/ownerDocument
|
|
13895
|
+
*/
|
|
13863
13896
|
_this.ownerDocument = null;
|
|
13897
|
+
/**
|
|
13898
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/isConnected
|
|
13899
|
+
* @example
|
|
13900
|
+
circle.isConnected; // false
|
|
13901
|
+
canvas.appendChild(circle);
|
|
13902
|
+
circle.isConnected; // true
|
|
13903
|
+
*/
|
|
13864
13904
|
_this.isConnected = false;
|
|
13905
|
+
/**
|
|
13906
|
+
* Returns node's node document's document base URL.
|
|
13907
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node
|
|
13908
|
+
*/
|
|
13865
13909
|
_this.baseURI = '';
|
|
13910
|
+
/**
|
|
13911
|
+
* Returns the children.
|
|
13912
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/childNodes
|
|
13913
|
+
*/
|
|
13866
13914
|
_this.childNodes = [];
|
|
13915
|
+
/**
|
|
13916
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeType
|
|
13917
|
+
*/
|
|
13867
13918
|
_this.nodeType = 0;
|
|
13919
|
+
/**
|
|
13920
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeName
|
|
13921
|
+
*/
|
|
13868
13922
|
_this.nodeName = '';
|
|
13923
|
+
/**
|
|
13924
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/API/Node/nodeValue
|
|
13925
|
+
*/
|
|
13869
13926
|
_this.nodeValue = null;
|
|
13927
|
+
/**
|
|
13928
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
13929
|
+
*/
|
|
13870
13930
|
_this.parentNode = null;
|
|
13871
13931
|
return _this;
|
|
13872
13932
|
}
|
|
@@ -13913,10 +13973,7 @@
|
|
|
13913
13973
|
};
|
|
13914
13974
|
_proto.isSameNode = function isSameNode(otherNode) {
|
|
13915
13975
|
return this.isEqualNode(otherNode);
|
|
13916
|
-
}
|
|
13917
|
-
/**
|
|
13918
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/ParentNode
|
|
13919
|
-
*/;
|
|
13976
|
+
};
|
|
13920
13977
|
/**
|
|
13921
13978
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
13922
13979
|
* @see https://github.com/b-fuze/deno-dom/blob/master/src/dom/node.ts#L338
|
|
@@ -14091,11 +14148,30 @@
|
|
|
14091
14148
|
}]);
|
|
14092
14149
|
return Node;
|
|
14093
14150
|
}(EventTarget);
|
|
14151
|
+
/**
|
|
14152
|
+
* Both nodes are in different documents or different trees in the same document.
|
|
14153
|
+
*/
|
|
14094
14154
|
Node.DOCUMENT_POSITION_DISCONNECTED = 1;
|
|
14155
|
+
/**
|
|
14156
|
+
* otherNode precedes the node in either a pre-order depth-first traversal
|
|
14157
|
+
* 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.
|
|
14158
|
+
*/
|
|
14095
14159
|
Node.DOCUMENT_POSITION_PRECEDING = 2;
|
|
14160
|
+
/**
|
|
14161
|
+
* 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.
|
|
14162
|
+
*/
|
|
14096
14163
|
Node.DOCUMENT_POSITION_FOLLOWING = 4;
|
|
14164
|
+
/**
|
|
14165
|
+
* otherNode is an ancestor of the node.
|
|
14166
|
+
*/
|
|
14097
14167
|
Node.DOCUMENT_POSITION_CONTAINS = 8;
|
|
14168
|
+
/**
|
|
14169
|
+
* otherNode is a descendant of the node.
|
|
14170
|
+
*/
|
|
14098
14171
|
Node.DOCUMENT_POSITION_CONTAINED_BY = 16;
|
|
14172
|
+
/**
|
|
14173
|
+
* The result relies upon arbitrary and/or implementation-specific behavior and is not guaranteed to be portable.
|
|
14174
|
+
*/
|
|
14099
14175
|
Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 32;
|
|
14100
14176
|
|
|
14101
14177
|
/**
|
|
@@ -14108,8 +14184,19 @@
|
|
|
14108
14184
|
function Document() {
|
|
14109
14185
|
var _this;
|
|
14110
14186
|
_this = _Node.call(this) || this;
|
|
14187
|
+
/**
|
|
14188
|
+
* only document has defaultView, points to canvas,
|
|
14189
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/defaultView
|
|
14190
|
+
*/
|
|
14111
14191
|
_this.defaultView = null;
|
|
14192
|
+
/**
|
|
14193
|
+
* the root element of document, eg. <html>
|
|
14194
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/documentElement
|
|
14195
|
+
*/
|
|
14112
14196
|
_this.documentElement = void 0;
|
|
14197
|
+
/**
|
|
14198
|
+
* document.timeline in WAAPI
|
|
14199
|
+
*/
|
|
14113
14200
|
_this.timeline = void 0;
|
|
14114
14201
|
_this.ownerDocument = null;
|
|
14115
14202
|
_this.nodeName = 'document';
|
|
@@ -14247,45 +14334,43 @@
|
|
|
14247
14334
|
var _elementFromPoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(x, y) {
|
|
14248
14335
|
var _this$defaultView$can2, viewportX, viewportY, _this$defaultView$get3, width, height, _this$defaultView$vie2, clientX, clientY, _yield$this$defaultVi, picked;
|
|
14249
14336
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
14250
|
-
while (1) {
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14337
|
+
while (1) switch (_context.prev = _context.next) {
|
|
14338
|
+
case 0:
|
|
14339
|
+
_this$defaultView$can2 = this.defaultView.canvas2Viewport({
|
|
14340
|
+
x: x,
|
|
14341
|
+
y: y
|
|
14342
|
+
}), viewportX = _this$defaultView$can2.x, viewportY = _this$defaultView$can2.y;
|
|
14343
|
+
_this$defaultView$get3 = this.defaultView.getConfig(), width = _this$defaultView$get3.width, height = _this$defaultView$get3.height; // outside canvas' viewport
|
|
14344
|
+
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
14345
|
+
_context.next = 4;
|
|
14346
|
+
break;
|
|
14347
|
+
}
|
|
14348
|
+
return _context.abrupt("return", null);
|
|
14349
|
+
case 4:
|
|
14350
|
+
_this$defaultView$vie2 = this.defaultView.viewport2Client({
|
|
14351
|
+
x: viewportX,
|
|
14352
|
+
y: viewportY
|
|
14353
|
+
}), clientX = _this$defaultView$vie2.x, clientY = _this$defaultView$vie2.y;
|
|
14354
|
+
_context.next = 7;
|
|
14355
|
+
return this.defaultView.getRenderingService().hooks.pick.promise({
|
|
14356
|
+
topmost: true,
|
|
14357
|
+
position: {
|
|
14254
14358
|
x: x,
|
|
14255
|
-
y: y
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
14267
|
-
|
|
14268
|
-
|
|
14269
|
-
|
|
14270
|
-
topmost: true,
|
|
14271
|
-
position: {
|
|
14272
|
-
x: x,
|
|
14273
|
-
y: y,
|
|
14274
|
-
viewportX: viewportX,
|
|
14275
|
-
viewportY: viewportY,
|
|
14276
|
-
clientX: clientX,
|
|
14277
|
-
clientY: clientY
|
|
14278
|
-
},
|
|
14279
|
-
picked: []
|
|
14280
|
-
});
|
|
14281
|
-
case 7:
|
|
14282
|
-
_yield$this$defaultVi = _context.sent;
|
|
14283
|
-
picked = _yield$this$defaultVi.picked;
|
|
14284
|
-
return _context.abrupt("return", picked && picked[0] || this.documentElement);
|
|
14285
|
-
case 10:
|
|
14286
|
-
case "end":
|
|
14287
|
-
return _context.stop();
|
|
14288
|
-
}
|
|
14359
|
+
y: y,
|
|
14360
|
+
viewportX: viewportX,
|
|
14361
|
+
viewportY: viewportY,
|
|
14362
|
+
clientX: clientX,
|
|
14363
|
+
clientY: clientY
|
|
14364
|
+
},
|
|
14365
|
+
picked: []
|
|
14366
|
+
});
|
|
14367
|
+
case 7:
|
|
14368
|
+
_yield$this$defaultVi = _context.sent;
|
|
14369
|
+
picked = _yield$this$defaultVi.picked;
|
|
14370
|
+
return _context.abrupt("return", picked && picked[0] || this.documentElement);
|
|
14371
|
+
case 10:
|
|
14372
|
+
case "end":
|
|
14373
|
+
return _context.stop();
|
|
14289
14374
|
}
|
|
14290
14375
|
}, _callee, this);
|
|
14291
14376
|
}));
|
|
@@ -14343,48 +14428,46 @@
|
|
|
14343
14428
|
var _elementsFromPoint = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(x, y) {
|
|
14344
14429
|
var _this$defaultView$can4, viewportX, viewportY, _this$defaultView$get6, width, height, _this$defaultView$vie4, clientX, clientY, _yield$this$defaultVi2, picked;
|
|
14345
14430
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
14346
|
-
while (1) {
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14431
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
14432
|
+
case 0:
|
|
14433
|
+
_this$defaultView$can4 = this.defaultView.canvas2Viewport({
|
|
14434
|
+
x: x,
|
|
14435
|
+
y: y
|
|
14436
|
+
}), viewportX = _this$defaultView$can4.x, viewportY = _this$defaultView$can4.y;
|
|
14437
|
+
_this$defaultView$get6 = this.defaultView.getConfig(), width = _this$defaultView$get6.width, height = _this$defaultView$get6.height; // outside canvas' viewport
|
|
14438
|
+
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
14439
|
+
_context2.next = 4;
|
|
14440
|
+
break;
|
|
14441
|
+
}
|
|
14442
|
+
return _context2.abrupt("return", []);
|
|
14443
|
+
case 4:
|
|
14444
|
+
_this$defaultView$vie4 = this.defaultView.viewport2Client({
|
|
14445
|
+
x: viewportX,
|
|
14446
|
+
y: viewportY
|
|
14447
|
+
}), clientX = _this$defaultView$vie4.x, clientY = _this$defaultView$vie4.y;
|
|
14448
|
+
_context2.next = 7;
|
|
14449
|
+
return this.defaultView.getRenderingService().hooks.pick.promise({
|
|
14450
|
+
topmost: false,
|
|
14451
|
+
position: {
|
|
14350
14452
|
x: x,
|
|
14351
|
-
y: y
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14368
|
-
|
|
14369
|
-
y: y,
|
|
14370
|
-
viewportX: viewportX,
|
|
14371
|
-
viewportY: viewportY,
|
|
14372
|
-
clientX: clientX,
|
|
14373
|
-
clientY: clientY
|
|
14374
|
-
},
|
|
14375
|
-
picked: []
|
|
14376
|
-
});
|
|
14377
|
-
case 7:
|
|
14378
|
-
_yield$this$defaultVi2 = _context2.sent;
|
|
14379
|
-
picked = _yield$this$defaultVi2.picked;
|
|
14380
|
-
if (picked[picked.length - 1] !== this.documentElement) {
|
|
14381
|
-
picked.push(this.documentElement);
|
|
14382
|
-
}
|
|
14383
|
-
return _context2.abrupt("return", picked);
|
|
14384
|
-
case 11:
|
|
14385
|
-
case "end":
|
|
14386
|
-
return _context2.stop();
|
|
14387
|
-
}
|
|
14453
|
+
y: y,
|
|
14454
|
+
viewportX: viewportX,
|
|
14455
|
+
viewportY: viewportY,
|
|
14456
|
+
clientX: clientX,
|
|
14457
|
+
clientY: clientY
|
|
14458
|
+
},
|
|
14459
|
+
picked: []
|
|
14460
|
+
});
|
|
14461
|
+
case 7:
|
|
14462
|
+
_yield$this$defaultVi2 = _context2.sent;
|
|
14463
|
+
picked = _yield$this$defaultVi2.picked;
|
|
14464
|
+
if (picked[picked.length - 1] !== this.documentElement) {
|
|
14465
|
+
picked.push(this.documentElement);
|
|
14466
|
+
}
|
|
14467
|
+
return _context2.abrupt("return", picked);
|
|
14468
|
+
case 11:
|
|
14469
|
+
case "end":
|
|
14470
|
+
return _context2.stop();
|
|
14388
14471
|
}
|
|
14389
14472
|
}, _callee2, this);
|
|
14390
14473
|
}));
|
|
@@ -14462,10 +14545,6 @@
|
|
|
14462
14545
|
get: function get() {
|
|
14463
14546
|
return this.lastChild;
|
|
14464
14547
|
}
|
|
14465
|
-
/**
|
|
14466
|
-
* only document has defaultView, points to canvas,
|
|
14467
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/defaultView
|
|
14468
|
-
*/
|
|
14469
14548
|
}]);
|
|
14470
14549
|
return Document;
|
|
14471
14550
|
}(Node);
|
|
@@ -14567,6 +14646,9 @@
|
|
|
14567
14646
|
args[_key] = arguments[_key];
|
|
14568
14647
|
}
|
|
14569
14648
|
_this = _Node.call.apply(_Node, [this].concat(args)) || this;
|
|
14649
|
+
/**
|
|
14650
|
+
* Unique id.
|
|
14651
|
+
*/
|
|
14570
14652
|
_this.entity = entityCounter++;
|
|
14571
14653
|
_this.renderable = {
|
|
14572
14654
|
bounds: undefined,
|
|
@@ -14621,14 +14703,36 @@
|
|
|
14621
14703
|
_this.rBushNode = {
|
|
14622
14704
|
aabb: undefined
|
|
14623
14705
|
};
|
|
14706
|
+
/**
|
|
14707
|
+
* used with `getElementById()`
|
|
14708
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/id
|
|
14709
|
+
*/
|
|
14624
14710
|
_this.id = void 0;
|
|
14711
|
+
/**
|
|
14712
|
+
* used in `getElementsByName`
|
|
14713
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
|
|
14714
|
+
*/
|
|
14625
14715
|
_this.name = void 0;
|
|
14716
|
+
/**
|
|
14717
|
+
* https://developer.mozilla.org/zh-CN/docs/Web/API/Element/namespaceURI
|
|
14718
|
+
*/
|
|
14626
14719
|
_this.namespaceURI = 'g';
|
|
14627
14720
|
_this.scrollLeft = 0;
|
|
14628
14721
|
_this.scrollTop = 0;
|
|
14722
|
+
/**
|
|
14723
|
+
* We don't support border now
|
|
14724
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/clientTop
|
|
14725
|
+
*/
|
|
14629
14726
|
_this.clientTop = 0;
|
|
14630
14727
|
_this.clientLeft = 0;
|
|
14728
|
+
/**
|
|
14729
|
+
* is destroyed or not
|
|
14730
|
+
*/
|
|
14631
14731
|
_this.destroyed = false;
|
|
14732
|
+
/**
|
|
14733
|
+
* compatible with `style`
|
|
14734
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
14735
|
+
*/
|
|
14632
14736
|
_this.style = {};
|
|
14633
14737
|
_this.computedStyle = runtime.enableCSSParsing ? {
|
|
14634
14738
|
anchor: unsetKeywordValue,
|
|
@@ -14657,6 +14761,9 @@
|
|
|
14657
14761
|
filter: unsetKeywordValue,
|
|
14658
14762
|
shadowType: unsetKeywordValue
|
|
14659
14763
|
} : null;
|
|
14764
|
+
/**
|
|
14765
|
+
* Renderers will use these used values.
|
|
14766
|
+
*/
|
|
14660
14767
|
_this.parsedStyle = {
|
|
14661
14768
|
// opacity: '',
|
|
14662
14769
|
// fillOpacity: '',
|
|
@@ -14677,15 +14784,15 @@
|
|
|
14677
14784
|
// textBaseline: '',
|
|
14678
14785
|
// textTransform: '',
|
|
14679
14786
|
};
|
|
14787
|
+
/**
|
|
14788
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
14789
|
+
*/
|
|
14680
14790
|
_this.attributes = {};
|
|
14681
14791
|
return _this;
|
|
14682
14792
|
}
|
|
14683
14793
|
Element.isElement = function isElement(target) {
|
|
14684
14794
|
return !!target.getAttribute;
|
|
14685
|
-
}
|
|
14686
|
-
/**
|
|
14687
|
-
* Unique id.
|
|
14688
|
-
*/;
|
|
14795
|
+
};
|
|
14689
14796
|
var _proto = Element.prototype;
|
|
14690
14797
|
_proto.cloneNode = function cloneNode(deep) {
|
|
14691
14798
|
throw new Error(ERROR_MSG_METHOD_NOT_IMPLEMENTED);
|
|
@@ -14893,10 +15000,7 @@
|
|
|
14893
15000
|
return this.parentNode.removeChild(this);
|
|
14894
15001
|
}
|
|
14895
15002
|
return this;
|
|
14896
|
-
}
|
|
14897
|
-
/**
|
|
14898
|
-
* is destroyed or not
|
|
14899
|
-
*/;
|
|
15003
|
+
};
|
|
14900
15004
|
_proto.destroy = function destroy() {
|
|
14901
15005
|
// destroy itself before remove
|
|
14902
15006
|
this.dispatchEvent(destroyEvent);
|
|
@@ -14937,21 +15041,14 @@
|
|
|
14937
15041
|
*/;
|
|
14938
15042
|
_proto.getClientRects = function getClientRects() {
|
|
14939
15043
|
return [this.getBoundingClientRect()];
|
|
14940
|
-
}
|
|
14941
|
-
/**
|
|
14942
|
-
* compatible with `style`
|
|
14943
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/style
|
|
14944
|
-
*/;
|
|
15044
|
+
};
|
|
14945
15045
|
/**
|
|
14946
15046
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/computedStyleMap
|
|
14947
15047
|
* eg. circle.computedStyleMap().get('fill');
|
|
14948
15048
|
*/
|
|
14949
15049
|
_proto.computedStyleMap = function computedStyleMap() {
|
|
14950
15050
|
return new Map(Object.entries(this.computedStyle));
|
|
14951
|
-
}
|
|
14952
|
-
/**
|
|
14953
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes
|
|
14954
|
-
*/;
|
|
15051
|
+
};
|
|
14955
15052
|
/**
|
|
14956
15053
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNames
|
|
14957
15054
|
*/
|
|
@@ -15046,10 +15143,6 @@
|
|
|
15046
15143
|
set: function set(className) {
|
|
15047
15144
|
this.setAttribute('class', className);
|
|
15048
15145
|
}
|
|
15049
|
-
/**
|
|
15050
|
-
* used in `getElementsByName`
|
|
15051
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByName
|
|
15052
|
-
*/
|
|
15053
15146
|
}, {
|
|
15054
15147
|
key: "classList",
|
|
15055
15148
|
get:
|
|
@@ -15121,17 +15214,40 @@
|
|
|
15121
15214
|
args[_key] = arguments[_key];
|
|
15122
15215
|
}
|
|
15123
15216
|
_this = _FederatedEvent.call.apply(_FederatedEvent, [this].concat(args)) || this;
|
|
15217
|
+
/** Whether the "alt" key was pressed when this mouse event occurred. */
|
|
15124
15218
|
_this.altKey = void 0;
|
|
15219
|
+
/** The specific button that was pressed in this mouse event. */
|
|
15125
15220
|
_this.button = void 0;
|
|
15221
|
+
/** The button depressed when this event occurred. */
|
|
15126
15222
|
_this.buttons = void 0;
|
|
15223
|
+
/** Whether the "control" key was pressed when this mouse event occurred. */
|
|
15127
15224
|
_this.ctrlKey = void 0;
|
|
15225
|
+
/** Whether the "meta" key was pressed when this mouse event occurred. */
|
|
15128
15226
|
_this.metaKey = void 0;
|
|
15227
|
+
/** This is currently not implemented in the Federated Events API. */
|
|
15129
15228
|
_this.relatedTarget = void 0;
|
|
15229
|
+
/** Whether the "shift" key was pressed when this mouse event occurred. */
|
|
15130
15230
|
_this.shiftKey = void 0;
|
|
15231
|
+
/**
|
|
15232
|
+
* The coordinates of the mouse event relative to the canvas.
|
|
15233
|
+
*/
|
|
15131
15234
|
_this.client = new Point();
|
|
15235
|
+
/**
|
|
15236
|
+
* The movement in this pointer relative to the last `mousemove` event.
|
|
15237
|
+
*/
|
|
15132
15238
|
_this.movement = new Point();
|
|
15239
|
+
/**
|
|
15240
|
+
* The offset of the pointer coordinates w.r.t. target DisplayObject in world space. This is
|
|
15241
|
+
* not supported at the moment.
|
|
15242
|
+
*/
|
|
15133
15243
|
_this.offset = new Point();
|
|
15244
|
+
/**
|
|
15245
|
+
* The pointer coordinates in world space.
|
|
15246
|
+
*/
|
|
15134
15247
|
_this.global = new Point();
|
|
15248
|
+
/**
|
|
15249
|
+
* The pointer coordinates in sceen space.
|
|
15250
|
+
*/
|
|
15135
15251
|
_this.screen = new Point();
|
|
15136
15252
|
return _this;
|
|
15137
15253
|
}
|
|
@@ -15152,9 +15268,6 @@
|
|
|
15152
15268
|
get: function get() {
|
|
15153
15269
|
return this.client.y;
|
|
15154
15270
|
}
|
|
15155
|
-
/**
|
|
15156
|
-
* The movement in this pointer relative to the last `mousemove` event.
|
|
15157
|
-
*/
|
|
15158
15271
|
}, {
|
|
15159
15272
|
key: "movementX",
|
|
15160
15273
|
get: function get() {
|
|
@@ -15165,10 +15278,6 @@
|
|
|
15165
15278
|
get: function get() {
|
|
15166
15279
|
return this.movement.y;
|
|
15167
15280
|
}
|
|
15168
|
-
/**
|
|
15169
|
-
* The offset of the pointer coordinates w.r.t. target DisplayObject in world space. This is
|
|
15170
|
-
* not supported at the moment.
|
|
15171
|
-
*/
|
|
15172
15281
|
}, {
|
|
15173
15282
|
key: "offsetX",
|
|
15174
15283
|
get: function get() {
|
|
@@ -15179,9 +15288,6 @@
|
|
|
15179
15288
|
get: function get() {
|
|
15180
15289
|
return this.offset.y;
|
|
15181
15290
|
}
|
|
15182
|
-
/**
|
|
15183
|
-
* The pointer coordinates in world space.
|
|
15184
|
-
*/
|
|
15185
15291
|
}, {
|
|
15186
15292
|
key: "globalX",
|
|
15187
15293
|
get: function get() {
|
|
@@ -15192,9 +15298,6 @@
|
|
|
15192
15298
|
get: function get() {
|
|
15193
15299
|
return this.global.y;
|
|
15194
15300
|
}
|
|
15195
|
-
/**
|
|
15196
|
-
* The pointer coordinates in sceen space.
|
|
15197
|
-
*/
|
|
15198
15301
|
}, {
|
|
15199
15302
|
key: "screenX",
|
|
15200
15303
|
get: function get() {
|
|
@@ -15217,15 +15320,69 @@
|
|
|
15217
15320
|
args[_key] = arguments[_key];
|
|
15218
15321
|
}
|
|
15219
15322
|
_this = _FederatedMouseEvent.call.apply(_FederatedMouseEvent, [this].concat(args)) || this;
|
|
15323
|
+
/**
|
|
15324
|
+
* The unique identifier of the pointer.
|
|
15325
|
+
*
|
|
15326
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
|
|
15327
|
+
*/
|
|
15220
15328
|
_this.pointerId = void 0;
|
|
15329
|
+
/**
|
|
15330
|
+
* The width of the pointer's contact along the x-axis, measured in CSS pixels.
|
|
15331
|
+
* radiusX of TouchEvents will be represented by this value.
|
|
15332
|
+
*
|
|
15333
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/width
|
|
15334
|
+
*/
|
|
15221
15335
|
_this.width = 0;
|
|
15336
|
+
/**
|
|
15337
|
+
* The height of the pointer's contact along the y-axis, measured in CSS pixels.
|
|
15338
|
+
* radiusY of TouchEvents will be represented by this value.
|
|
15339
|
+
*
|
|
15340
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/height
|
|
15341
|
+
*/
|
|
15222
15342
|
_this.height = 0;
|
|
15343
|
+
/**
|
|
15344
|
+
* Indicates whether or not the pointer device that created the event is the primary pointer.
|
|
15345
|
+
*
|
|
15346
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary
|
|
15347
|
+
*/
|
|
15223
15348
|
_this.isPrimary = false;
|
|
15349
|
+
/**
|
|
15350
|
+
* The type of pointer that triggered the event.
|
|
15351
|
+
*
|
|
15352
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
|
15353
|
+
*/
|
|
15224
15354
|
_this.pointerType = void 0;
|
|
15355
|
+
/**
|
|
15356
|
+
* Pressure applied by the pointing device during the event.
|
|
15357
|
+
*s
|
|
15358
|
+
* A Touch's force property will be represented by this value.
|
|
15359
|
+
*
|
|
15360
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pressure
|
|
15361
|
+
*/
|
|
15225
15362
|
_this.pressure = void 0;
|
|
15363
|
+
/**
|
|
15364
|
+
* Barrel pressure on a stylus pointer.
|
|
15365
|
+
*
|
|
15366
|
+
* @see https://w3c.github.io/pointerevents/#pointerevent-interface
|
|
15367
|
+
*/
|
|
15226
15368
|
_this.tangentialPressure = void 0;
|
|
15369
|
+
/**
|
|
15370
|
+
* The angle, in degrees, between the pointer device and the screen.
|
|
15371
|
+
*
|
|
15372
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltX
|
|
15373
|
+
*/
|
|
15227
15374
|
_this.tiltX = void 0;
|
|
15375
|
+
/**
|
|
15376
|
+
* The angle, in degrees, between the pointer device and the screen.
|
|
15377
|
+
*
|
|
15378
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/tiltY
|
|
15379
|
+
*/
|
|
15228
15380
|
_this.tiltY = void 0;
|
|
15381
|
+
/**
|
|
15382
|
+
* Twist of a stylus pointer.
|
|
15383
|
+
*
|
|
15384
|
+
* @see https://w3c.github.io/pointerevents/#pointerevent-interface
|
|
15385
|
+
*/
|
|
15229
15386
|
_this.twist = void 0;
|
|
15230
15387
|
return _this;
|
|
15231
15388
|
}
|
|
@@ -15270,12 +15427,22 @@
|
|
|
15270
15427
|
args[_key] = arguments[_key];
|
|
15271
15428
|
}
|
|
15272
15429
|
_this = _FederatedMouseEvent.call.apply(_FederatedMouseEvent, [this].concat(args)) || this;
|
|
15430
|
+
/**
|
|
15431
|
+
* The units of `deltaX`, `deltaY`, and `deltaZ`. This is one of `DOM_DELTA_LINE`,
|
|
15432
|
+
* `DOM_DELTA_PAGE`, `DOM_DELTA_PIXEL`.
|
|
15433
|
+
*/
|
|
15273
15434
|
_this.deltaMode = void 0;
|
|
15435
|
+
/** Horizontal scroll amount */
|
|
15274
15436
|
_this.deltaX = void 0;
|
|
15437
|
+
/** Vertical scroll amount */
|
|
15275
15438
|
_this.deltaY = void 0;
|
|
15439
|
+
/** z-axis scroll amount. */
|
|
15276
15440
|
_this.deltaZ = void 0;
|
|
15441
|
+
/** Units specified in lines. */
|
|
15277
15442
|
_this.DOM_DELTA_LINE = 0;
|
|
15443
|
+
/** Units specified in pages. */
|
|
15278
15444
|
_this.DOM_DELTA_PAGE = 1;
|
|
15445
|
+
/** Units specified in pixels. */
|
|
15279
15446
|
_this.DOM_DELTA_PIXEL = 2;
|
|
15280
15447
|
return _this;
|
|
15281
15448
|
}
|
|
@@ -15391,6 +15558,10 @@
|
|
|
15391
15558
|
_this.isMutationObserved = false;
|
|
15392
15559
|
_this.activeAnimations = [];
|
|
15393
15560
|
_this.dataset = void 0;
|
|
15561
|
+
/**
|
|
15562
|
+
* Use `this.style.clipPath` instead.
|
|
15563
|
+
* @deprecated
|
|
15564
|
+
*/
|
|
15394
15565
|
_this.getClip = function () {
|
|
15395
15566
|
return this.style.clipPath || null;
|
|
15396
15567
|
};
|
|
@@ -16033,11 +16204,7 @@
|
|
|
16033
16204
|
*/;
|
|
16034
16205
|
_proto.setClip = function setClip(clipPath) {
|
|
16035
16206
|
this.style.clipPath = clipPath;
|
|
16036
|
-
}
|
|
16037
|
-
/**
|
|
16038
|
-
* Use `this.style.clipPath` instead.
|
|
16039
|
-
* @deprecated
|
|
16040
|
-
*/;
|
|
16207
|
+
};
|
|
16041
16208
|
/**
|
|
16042
16209
|
* @deprecated
|
|
16043
16210
|
*/
|
|
@@ -18282,25 +18449,72 @@
|
|
|
18282
18449
|
function Camera() {
|
|
18283
18450
|
this.canvas = void 0;
|
|
18284
18451
|
this.eventEmitter = new eventemitter3();
|
|
18452
|
+
/**
|
|
18453
|
+
* 相机矩阵
|
|
18454
|
+
*/
|
|
18285
18455
|
this.matrix = create$1();
|
|
18456
|
+
/**
|
|
18457
|
+
* u 轴
|
|
18458
|
+
* @see http://learnwebgl.brown37.net/07_cameras/camera_introduction.html#a-camera-definition
|
|
18459
|
+
*/
|
|
18286
18460
|
this.right = fromValues$2(1, 0, 0);
|
|
18461
|
+
/**
|
|
18462
|
+
* v 轴 +Y is down
|
|
18463
|
+
*/
|
|
18287
18464
|
this.up = fromValues$2(0, 1, 0);
|
|
18465
|
+
/**
|
|
18466
|
+
* n 轴 +Z is inside
|
|
18467
|
+
*/
|
|
18288
18468
|
this.forward = fromValues$2(0, 0, 1);
|
|
18469
|
+
/**
|
|
18470
|
+
* 相机位置
|
|
18471
|
+
*/
|
|
18289
18472
|
this.position = fromValues$2(0, 0, 1);
|
|
18473
|
+
/**
|
|
18474
|
+
* 视点位置
|
|
18475
|
+
*/
|
|
18290
18476
|
this.focalPoint = fromValues$2(0, 0, 0);
|
|
18477
|
+
/**
|
|
18478
|
+
* 视点到相机位置的向量
|
|
18479
|
+
* focalPoint - position
|
|
18480
|
+
*/
|
|
18291
18481
|
this.distanceVector = fromValues$2(0, 0, -1);
|
|
18482
|
+
/**
|
|
18483
|
+
* 相机位置到视点距离
|
|
18484
|
+
* length(focalPoint - position)
|
|
18485
|
+
*/
|
|
18292
18486
|
this.distance = 1;
|
|
18487
|
+
/**
|
|
18488
|
+
* @see https://en.wikipedia.org/wiki/Azimuth
|
|
18489
|
+
*/
|
|
18293
18490
|
this.azimuth = 0;
|
|
18294
18491
|
this.elevation = 0;
|
|
18295
18492
|
this.roll = 0;
|
|
18296
18493
|
this.relAzimuth = 0;
|
|
18297
18494
|
this.relElevation = 0;
|
|
18298
18495
|
this.relRoll = 0;
|
|
18496
|
+
/**
|
|
18497
|
+
* 沿 n 轴移动时,保证移动速度从快到慢
|
|
18498
|
+
*/
|
|
18299
18499
|
this.dollyingStep = 0;
|
|
18300
18500
|
this.maxDistance = Infinity;
|
|
18301
18501
|
this.minDistance = -Infinity;
|
|
18502
|
+
/**
|
|
18503
|
+
* zoom factor of the camera, default is 1
|
|
18504
|
+
* eg. https://threejs.org/docs/#api/en/cameras/OrthographicCamera.zoom
|
|
18505
|
+
*/
|
|
18302
18506
|
this.zoom = 1;
|
|
18507
|
+
/**
|
|
18508
|
+
* invert the horizontal coordinate system HCS
|
|
18509
|
+
*/
|
|
18303
18510
|
this.rotateWorld = false;
|
|
18511
|
+
/**
|
|
18512
|
+
* 投影矩阵参数
|
|
18513
|
+
*/
|
|
18514
|
+
/**
|
|
18515
|
+
* field of view [0-360]
|
|
18516
|
+
* @see http://en.wikipedia.org/wiki/Angle_of_view
|
|
18517
|
+
*/
|
|
18304
18518
|
this.fov = 30;
|
|
18305
18519
|
this.near = 0.1;
|
|
18306
18520
|
this.far = 1000;
|
|
@@ -18314,10 +18528,17 @@
|
|
|
18314
18528
|
this.jitteredProjectionMatrix = undefined;
|
|
18315
18529
|
this.view = void 0;
|
|
18316
18530
|
this.enableUpdate = true;
|
|
18531
|
+
// protected following = undefined;
|
|
18317
18532
|
this.type = exports.CameraType.EXPLORING;
|
|
18318
18533
|
this.trackingMode = exports.CameraTrackingMode.DEFAULT;
|
|
18319
18534
|
this.projectionMode = exports.CameraProjectionMode.PERSPECTIVE;
|
|
18535
|
+
/**
|
|
18536
|
+
* for culling use
|
|
18537
|
+
*/
|
|
18320
18538
|
this.frustum = new Frustum();
|
|
18539
|
+
/**
|
|
18540
|
+
* ortho matrix for Canvas2D & SVG
|
|
18541
|
+
*/
|
|
18321
18542
|
this.orthoMatrix = create$1();
|
|
18322
18543
|
}
|
|
18323
18544
|
var _proto = Camera.prototype;
|
|
@@ -19138,410 +19359,271 @@
|
|
|
19138
19359
|
this.pickHandler = void 0;
|
|
19139
19360
|
this.tmpMatrix = create$1();
|
|
19140
19361
|
this.tmpVec3 = create$2();
|
|
19141
|
-
this.onPointerDown =
|
|
19142
|
-
|
|
19143
|
-
|
|
19144
|
-
|
|
19145
|
-
|
|
19146
|
-
|
|
19147
|
-
|
|
19148
|
-
|
|
19149
|
-
|
|
19150
|
-
|
|
19151
|
-
|
|
19152
|
-
|
|
19153
|
-
|
|
19154
|
-
|
|
19155
|
-
|
|
19156
|
-
|
|
19157
|
-
|
|
19158
|
-
|
|
19159
|
-
|
|
19160
|
-
|
|
19161
|
-
|
|
19162
|
-
|
|
19163
|
-
|
|
19164
|
-
|
|
19165
|
-
|
|
19362
|
+
this.onPointerDown = function (from) {
|
|
19363
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19364
|
+
// return;
|
|
19365
|
+
// }
|
|
19366
|
+
var e = _this.createPointerEvent(from);
|
|
19367
|
+
_this.dispatchEvent(e, 'pointerdown');
|
|
19368
|
+
if (e.pointerType === 'touch') {
|
|
19369
|
+
_this.dispatchEvent(e, 'touchstart');
|
|
19370
|
+
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
19371
|
+
var isRightButton = e.button === 2;
|
|
19372
|
+
_this.dispatchEvent(e, isRightButton ? 'rightdown' : 'mousedown');
|
|
19373
|
+
}
|
|
19374
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
19375
|
+
trackingData.pressTargetsByButton[from.button] = e.composedPath();
|
|
19376
|
+
_this.freeEvent(e);
|
|
19377
|
+
};
|
|
19378
|
+
this.onPointerUp = function (from) {
|
|
19379
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19380
|
+
// return;
|
|
19381
|
+
// }
|
|
19382
|
+
var now = performance.now();
|
|
19383
|
+
var e = _this.createPointerEvent(from);
|
|
19384
|
+
_this.dispatchEvent(e, 'pointerup');
|
|
19385
|
+
if (e.pointerType === 'touch') {
|
|
19386
|
+
_this.dispatchEvent(e, 'touchend');
|
|
19387
|
+
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
19388
|
+
var isRightButton = e.button === 2;
|
|
19389
|
+
_this.dispatchEvent(e, isRightButton ? 'rightup' : 'mouseup');
|
|
19390
|
+
}
|
|
19391
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
19392
|
+
var pressTarget = _this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);
|
|
19393
|
+
var clickTarget = pressTarget;
|
|
19394
|
+
// pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
|
|
19395
|
+
// the pointerup location.
|
|
19396
|
+
if (pressTarget && !e.composedPath().includes(pressTarget)) {
|
|
19397
|
+
var currentTarget = pressTarget;
|
|
19398
|
+
while (currentTarget && !e.composedPath().includes(currentTarget)) {
|
|
19399
|
+
e.currentTarget = currentTarget;
|
|
19400
|
+
_this.notifyTarget(e, 'pointerupoutside');
|
|
19401
|
+
if (e.pointerType === 'touch') {
|
|
19402
|
+
_this.notifyTarget(e, 'touchendoutside');
|
|
19403
|
+
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
19404
|
+
var _isRightButton = e.button === 2;
|
|
19405
|
+
_this.notifyTarget(e, _isRightButton ? 'rightupoutside' : 'mouseupoutside');
|
|
19166
19406
|
}
|
|
19167
|
-
|
|
19168
|
-
|
|
19169
|
-
return function (_x) {
|
|
19170
|
-
return _ref.apply(this, arguments);
|
|
19171
|
-
};
|
|
19172
|
-
}();
|
|
19173
|
-
this.onPointerUp = /*#__PURE__*/function () {
|
|
19174
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(from) {
|
|
19175
|
-
var now, e, isRightButton, trackingData, pressTarget, clickTarget, currentTarget, _isRightButton, _e$detail, clickEvent, clickHistory;
|
|
19176
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
19177
|
-
while (1) {
|
|
19178
|
-
switch (_context2.prev = _context2.next) {
|
|
19179
|
-
case 0:
|
|
19180
|
-
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19181
|
-
// return;
|
|
19182
|
-
// }
|
|
19183
|
-
now = performance.now();
|
|
19184
|
-
_context2.next = 3;
|
|
19185
|
-
return _this.createPointerEvent(from);
|
|
19186
|
-
case 3:
|
|
19187
|
-
e = _context2.sent;
|
|
19188
|
-
_this.dispatchEvent(e, 'pointerup');
|
|
19189
|
-
if (e.pointerType === 'touch') {
|
|
19190
|
-
_this.dispatchEvent(e, 'touchend');
|
|
19191
|
-
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
19192
|
-
isRightButton = e.button === 2;
|
|
19193
|
-
_this.dispatchEvent(e, isRightButton ? 'rightup' : 'mouseup');
|
|
19194
|
-
}
|
|
19195
|
-
trackingData = _this.trackingData(from.pointerId);
|
|
19196
|
-
pressTarget = _this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);
|
|
19197
|
-
clickTarget = pressTarget; // pointerupoutside only bubbles. It only bubbles upto the parent that doesn't contain
|
|
19198
|
-
// the pointerup location.
|
|
19199
|
-
if (pressTarget && !e.composedPath().includes(pressTarget)) {
|
|
19200
|
-
currentTarget = pressTarget;
|
|
19201
|
-
while (currentTarget && !e.composedPath().includes(currentTarget)) {
|
|
19202
|
-
e.currentTarget = currentTarget;
|
|
19203
|
-
_this.notifyTarget(e, 'pointerupoutside');
|
|
19204
|
-
if (e.pointerType === 'touch') {
|
|
19205
|
-
_this.notifyTarget(e, 'touchendoutside');
|
|
19206
|
-
} else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
19207
|
-
_isRightButton = e.button === 2;
|
|
19208
|
-
_this.notifyTarget(e, _isRightButton ? 'rightupoutside' : 'mouseupoutside');
|
|
19209
|
-
}
|
|
19210
|
-
if (Node.isNode(currentTarget)) {
|
|
19211
|
-
currentTarget = currentTarget.parentNode;
|
|
19212
|
-
}
|
|
19213
|
-
}
|
|
19214
|
-
delete trackingData.pressTargetsByButton[from.button];
|
|
19215
|
-
// currentTarget is the most specific ancestor holding both the pointerdown and pointerup
|
|
19216
|
-
// targets. That is - it's our click target!
|
|
19217
|
-
clickTarget = currentTarget;
|
|
19218
|
-
}
|
|
19219
|
-
if (clickTarget) {
|
|
19220
|
-
clickEvent = _this.clonePointerEvent(e, 'click');
|
|
19221
|
-
clickEvent.target = clickTarget;
|
|
19222
|
-
clickEvent.path = [];
|
|
19223
|
-
if (!trackingData.clicksByButton[from.button]) {
|
|
19224
|
-
trackingData.clicksByButton[from.button] = {
|
|
19225
|
-
clickCount: 0,
|
|
19226
|
-
target: clickEvent.target,
|
|
19227
|
-
timeStamp: now
|
|
19228
|
-
};
|
|
19229
|
-
}
|
|
19230
|
-
clickHistory = trackingData.clicksByButton[from.button];
|
|
19231
|
-
if (clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < 200) {
|
|
19232
|
-
++clickHistory.clickCount;
|
|
19233
|
-
} else {
|
|
19234
|
-
clickHistory.clickCount = 1;
|
|
19235
|
-
}
|
|
19236
|
-
clickHistory.target = clickEvent.target;
|
|
19237
|
-
clickHistory.timeStamp = now;
|
|
19238
|
-
clickEvent.detail = clickHistory.clickCount;
|
|
19239
|
-
// @see https://github.com/antvis/G/issues/1091
|
|
19240
|
-
if (!((_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.preventClick)) {
|
|
19241
|
-
if (clickEvent.pointerType === 'mouse' || clickEvent.pointerType === 'touch') {
|
|
19242
|
-
_this.dispatchEvent(clickEvent, 'click');
|
|
19243
|
-
}
|
|
19244
|
-
_this.dispatchEvent(clickEvent, 'pointertap');
|
|
19245
|
-
}
|
|
19246
|
-
_this.freeEvent(clickEvent);
|
|
19247
|
-
}
|
|
19248
|
-
_this.freeEvent(e);
|
|
19249
|
-
case 12:
|
|
19250
|
-
case "end":
|
|
19251
|
-
return _context2.stop();
|
|
19252
|
-
}
|
|
19407
|
+
if (Node.isNode(currentTarget)) {
|
|
19408
|
+
currentTarget = currentTarget.parentNode;
|
|
19253
19409
|
}
|
|
19254
|
-
}
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
var
|
|
19263
|
-
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
|
|
19267
|
-
|
|
19268
|
-
|
|
19269
|
-
|
|
19270
|
-
|
|
19271
|
-
|
|
19272
|
-
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
|
|
19280
|
-
|
|
19281
|
-
|
|
19282
|
-
|
|
19283
|
-
|
|
19284
|
-
|
|
19285
|
-
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
19286
|
-
// If the pointer exits overTarget and its descendants, then a pointerleave event is also fired. This event
|
|
19287
|
-
// is dispatched to all ancestors that no longer capture the pointer.
|
|
19288
|
-
if (e.composedPath().includes(outTarget)) {
|
|
19289
|
-
_context3.next = 20;
|
|
19290
|
-
break;
|
|
19291
|
-
}
|
|
19292
|
-
_context3.next = 16;
|
|
19293
|
-
return _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
19294
|
-
case 16:
|
|
19295
|
-
leaveEvent = _context3.sent;
|
|
19296
|
-
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
19297
|
-
while (leaveEvent.target && !e.composedPath().includes(leaveEvent.target)) {
|
|
19298
|
-
leaveEvent.currentTarget = leaveEvent.target;
|
|
19299
|
-
_this.notifyTarget(leaveEvent);
|
|
19300
|
-
if (isMouse) {
|
|
19301
|
-
_this.notifyTarget(leaveEvent, 'mouseleave');
|
|
19302
|
-
}
|
|
19303
|
-
if (Node.isNode(leaveEvent.target)) {
|
|
19304
|
-
leaveEvent.target = leaveEvent.target.parentNode;
|
|
19305
|
-
}
|
|
19306
|
-
}
|
|
19307
|
-
_this.freeEvent(leaveEvent);
|
|
19308
|
-
case 20:
|
|
19309
|
-
_this.freeEvent(outEvent);
|
|
19310
|
-
case 21:
|
|
19311
|
-
if (!(outTarget !== e.target)) {
|
|
19312
|
-
_context3.next = 36;
|
|
19313
|
-
break;
|
|
19314
|
-
}
|
|
19315
|
-
// pointerover always occurs on the new overTarget
|
|
19316
|
-
overType = from.type === 'mousemove' ? 'mouseover' : 'pointerover';
|
|
19317
|
-
overEvent = _this.clonePointerEvent(e, overType); // clone faster
|
|
19318
|
-
_this.dispatchEvent(overEvent, 'pointerover');
|
|
19319
|
-
if (isMouse) _this.dispatchEvent(overEvent, 'mouseover');
|
|
19320
|
-
// Probe whether the newly hovered Node is an ancestor of the original overTarget.
|
|
19321
|
-
overTargetAncestor = outTarget && Node.isNode(outTarget) && outTarget.parentNode;
|
|
19322
|
-
case 27:
|
|
19323
|
-
if (!(overTargetAncestor && overTargetAncestor !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode))) {
|
|
19324
|
-
_context3.next = 33;
|
|
19325
|
-
break;
|
|
19326
|
-
}
|
|
19327
|
-
if (!(overTargetAncestor === e.target)) {
|
|
19328
|
-
_context3.next = 30;
|
|
19329
|
-
break;
|
|
19330
|
-
}
|
|
19331
|
-
return _context3.abrupt("break", 33);
|
|
19332
|
-
case 30:
|
|
19333
|
-
overTargetAncestor = overTargetAncestor.parentNode;
|
|
19334
|
-
_context3.next = 27;
|
|
19335
|
-
break;
|
|
19336
|
-
case 33:
|
|
19337
|
-
// The pointer has entered a non-ancestor of the original overTarget. This means we need a pointerentered
|
|
19338
|
-
// event.
|
|
19339
|
-
didPointerEnter = !overTargetAncestor || overTargetAncestor === (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode);
|
|
19340
|
-
if (didPointerEnter) {
|
|
19341
|
-
enterEvent = _this.clonePointerEvent(e, 'pointerenter');
|
|
19342
|
-
enterEvent.eventPhase = enterEvent.AT_TARGET;
|
|
19343
|
-
while (enterEvent.target && enterEvent.target !== outTarget && enterEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
19344
|
-
enterEvent.currentTarget = enterEvent.target;
|
|
19345
|
-
_this.notifyTarget(enterEvent);
|
|
19346
|
-
if (isMouse) _this.notifyTarget(enterEvent, 'mouseenter');
|
|
19347
|
-
if (Node.isNode(enterEvent.target)) {
|
|
19348
|
-
enterEvent.target = enterEvent.target.parentNode;
|
|
19349
|
-
}
|
|
19350
|
-
}
|
|
19351
|
-
_this.freeEvent(enterEvent);
|
|
19352
|
-
}
|
|
19353
|
-
_this.freeEvent(overEvent);
|
|
19354
|
-
case 36:
|
|
19355
|
-
// Then pointermove
|
|
19356
|
-
_this.dispatchEvent(e, 'pointermove');
|
|
19357
|
-
if (e.pointerType === 'touch') _this.dispatchEvent(e, 'touchmove');
|
|
19358
|
-
if (isMouse) {
|
|
19359
|
-
_this.dispatchEvent(e, 'mousemove');
|
|
19360
|
-
_this.cursor = _this.getCursor(e.target);
|
|
19361
|
-
}
|
|
19362
|
-
trackingData.overTargets = e.composedPath();
|
|
19363
|
-
_this.freeEvent(e);
|
|
19364
|
-
case 41:
|
|
19365
|
-
case "end":
|
|
19366
|
-
return _context3.stop();
|
|
19367
|
-
}
|
|
19410
|
+
}
|
|
19411
|
+
delete trackingData.pressTargetsByButton[from.button];
|
|
19412
|
+
// currentTarget is the most specific ancestor holding both the pointerdown and pointerup
|
|
19413
|
+
// targets. That is - it's our click target!
|
|
19414
|
+
clickTarget = currentTarget;
|
|
19415
|
+
}
|
|
19416
|
+
if (clickTarget) {
|
|
19417
|
+
var _e$detail;
|
|
19418
|
+
var clickEvent = _this.clonePointerEvent(e, 'click');
|
|
19419
|
+
clickEvent.target = clickTarget;
|
|
19420
|
+
clickEvent.path = [];
|
|
19421
|
+
if (!trackingData.clicksByButton[from.button]) {
|
|
19422
|
+
trackingData.clicksByButton[from.button] = {
|
|
19423
|
+
clickCount: 0,
|
|
19424
|
+
target: clickEvent.target,
|
|
19425
|
+
timeStamp: now
|
|
19426
|
+
};
|
|
19427
|
+
}
|
|
19428
|
+
var clickHistory = trackingData.clicksByButton[from.button];
|
|
19429
|
+
if (clickHistory.target === clickEvent.target && now - clickHistory.timeStamp < 200) {
|
|
19430
|
+
++clickHistory.clickCount;
|
|
19431
|
+
} else {
|
|
19432
|
+
clickHistory.clickCount = 1;
|
|
19433
|
+
}
|
|
19434
|
+
clickHistory.target = clickEvent.target;
|
|
19435
|
+
clickHistory.timeStamp = now;
|
|
19436
|
+
clickEvent.detail = clickHistory.clickCount;
|
|
19437
|
+
// @see https://github.com/antvis/G/issues/1091
|
|
19438
|
+
if (!((_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.preventClick)) {
|
|
19439
|
+
if (!_this.context.config.useNativeClickEvent && (clickEvent.pointerType === 'mouse' || clickEvent.pointerType === 'touch')) {
|
|
19440
|
+
_this.dispatchEvent(clickEvent, 'click');
|
|
19368
19441
|
}
|
|
19369
|
-
|
|
19370
|
-
|
|
19371
|
-
|
|
19372
|
-
|
|
19373
|
-
|
|
19374
|
-
}
|
|
19375
|
-
this.
|
|
19376
|
-
|
|
19377
|
-
|
|
19378
|
-
|
|
19379
|
-
|
|
19380
|
-
|
|
19381
|
-
|
|
19382
|
-
|
|
19383
|
-
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
|
|
19389
|
-
|
|
19390
|
-
|
|
19391
|
-
|
|
19392
|
-
|
|
19393
|
-
|
|
19394
|
-
|
|
19395
|
-
|
|
19396
|
-
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
|
|
19400
|
-
_context4.next = 11;
|
|
19401
|
-
return _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
19402
|
-
case 11:
|
|
19403
|
-
leaveEvent = _context4.sent;
|
|
19404
|
-
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
19405
|
-
while (leaveEvent.target && leaveEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
19406
|
-
leaveEvent.currentTarget = leaveEvent.target;
|
|
19407
|
-
_this.notifyTarget(leaveEvent);
|
|
19408
|
-
if (isMouse) {
|
|
19409
|
-
_this.notifyTarget(leaveEvent, 'mouseleave');
|
|
19410
|
-
}
|
|
19411
|
-
if (Node.isNode(leaveEvent.target)) {
|
|
19412
|
-
leaveEvent.target = leaveEvent.target.parentNode;
|
|
19413
|
-
}
|
|
19414
|
-
}
|
|
19415
|
-
trackingData.overTargets = null;
|
|
19416
|
-
_this.freeEvent(outEvent);
|
|
19417
|
-
_this.freeEvent(leaveEvent);
|
|
19418
|
-
case 17:
|
|
19419
|
-
_this.cursor = null;
|
|
19420
|
-
case 18:
|
|
19421
|
-
case "end":
|
|
19422
|
-
return _context4.stop();
|
|
19442
|
+
_this.dispatchEvent(clickEvent, 'pointertap');
|
|
19443
|
+
}
|
|
19444
|
+
_this.freeEvent(clickEvent);
|
|
19445
|
+
}
|
|
19446
|
+
_this.freeEvent(e);
|
|
19447
|
+
};
|
|
19448
|
+
this.onPointerMove = function (from) {
|
|
19449
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19450
|
+
// return;
|
|
19451
|
+
// }
|
|
19452
|
+
var e = _this.createPointerEvent(from);
|
|
19453
|
+
var isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
19454
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
19455
|
+
var outTarget = _this.findMountedTarget(trackingData.overTargets);
|
|
19456
|
+
// First pointerout/pointerleave
|
|
19457
|
+
if (trackingData.overTargets && outTarget !== e.target) {
|
|
19458
|
+
// pointerout always occurs on the overTarget when the pointer hovers over another element.
|
|
19459
|
+
var outType = from.type === 'mousemove' ? 'mouseout' : 'pointerout';
|
|
19460
|
+
var outEvent = _this.createPointerEvent(from, outType, outTarget || undefined);
|
|
19461
|
+
_this.dispatchEvent(outEvent, 'pointerout');
|
|
19462
|
+
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
19463
|
+
// If the pointer exits overTarget and its descendants, then a pointerleave event is also fired. This event
|
|
19464
|
+
// is dispatched to all ancestors that no longer capture the pointer.
|
|
19465
|
+
if (!e.composedPath().includes(outTarget)) {
|
|
19466
|
+
var leaveEvent = _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
19467
|
+
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
19468
|
+
while (leaveEvent.target && !e.composedPath().includes(leaveEvent.target)) {
|
|
19469
|
+
leaveEvent.currentTarget = leaveEvent.target;
|
|
19470
|
+
_this.notifyTarget(leaveEvent);
|
|
19471
|
+
if (isMouse) {
|
|
19472
|
+
_this.notifyTarget(leaveEvent, 'mouseleave');
|
|
19423
19473
|
}
|
|
19424
|
-
|
|
19425
|
-
|
|
19426
|
-
}));
|
|
19427
|
-
return function (_x4) {
|
|
19428
|
-
return _ref4.apply(this, arguments);
|
|
19429
|
-
};
|
|
19430
|
-
}();
|
|
19431
|
-
this.onPointerOver = /*#__PURE__*/function () {
|
|
19432
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(from) {
|
|
19433
|
-
var trackingData, e, isMouse, enterEvent;
|
|
19434
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
19435
|
-
while (1) {
|
|
19436
|
-
switch (_context5.prev = _context5.next) {
|
|
19437
|
-
case 0:
|
|
19438
|
-
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19439
|
-
// return;
|
|
19440
|
-
// }
|
|
19441
|
-
trackingData = _this.trackingData(from.pointerId);
|
|
19442
|
-
_context5.next = 3;
|
|
19443
|
-
return _this.createPointerEvent(from);
|
|
19444
|
-
case 3:
|
|
19445
|
-
e = _context5.sent;
|
|
19446
|
-
isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
19447
|
-
_this.dispatchEvent(e, 'pointerover');
|
|
19448
|
-
if (isMouse) _this.dispatchEvent(e, 'mouseover');
|
|
19449
|
-
if (e.pointerType === 'mouse') _this.cursor = _this.getCursor(e.target);
|
|
19450
|
-
// pointerenter events must be fired since the pointer entered from upstream.
|
|
19451
|
-
enterEvent = _this.clonePointerEvent(e, 'pointerenter');
|
|
19452
|
-
enterEvent.eventPhase = enterEvent.AT_TARGET;
|
|
19453
|
-
while (enterEvent.target && enterEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
19454
|
-
enterEvent.currentTarget = enterEvent.target;
|
|
19455
|
-
_this.notifyTarget(enterEvent);
|
|
19456
|
-
if (isMouse) {
|
|
19457
|
-
// mouseenter should not bubble
|
|
19458
|
-
// @see https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseenter_event#usage_notes
|
|
19459
|
-
_this.notifyTarget(enterEvent, 'mouseenter');
|
|
19460
|
-
}
|
|
19461
|
-
if (Node.isNode(enterEvent.target)) {
|
|
19462
|
-
enterEvent.target = enterEvent.target.parentNode;
|
|
19463
|
-
}
|
|
19464
|
-
}
|
|
19465
|
-
trackingData.overTargets = e.composedPath();
|
|
19466
|
-
_this.freeEvent(e);
|
|
19467
|
-
_this.freeEvent(enterEvent);
|
|
19468
|
-
case 14:
|
|
19469
|
-
case "end":
|
|
19470
|
-
return _context5.stop();
|
|
19474
|
+
if (Node.isNode(leaveEvent.target)) {
|
|
19475
|
+
leaveEvent.target = leaveEvent.target.parentNode;
|
|
19471
19476
|
}
|
|
19472
19477
|
}
|
|
19473
|
-
|
|
19474
|
-
|
|
19475
|
-
|
|
19476
|
-
|
|
19477
|
-
|
|
19478
|
-
|
|
19479
|
-
|
|
19480
|
-
|
|
19481
|
-
var
|
|
19482
|
-
|
|
19483
|
-
|
|
19484
|
-
|
|
19485
|
-
|
|
19486
|
-
|
|
19487
|
-
|
|
19488
|
-
|
|
19489
|
-
|
|
19490
|
-
|
|
19491
|
-
|
|
19492
|
-
|
|
19493
|
-
|
|
19494
|
-
|
|
19495
|
-
|
|
19496
|
-
|
|
19497
|
-
|
|
19498
|
-
|
|
19499
|
-
|
|
19500
|
-
|
|
19501
|
-
|
|
19502
|
-
}
|
|
19503
|
-
if (Node.isNode(currentTarget)) {
|
|
19504
|
-
currentTarget = currentTarget.parentNode;
|
|
19505
|
-
}
|
|
19506
|
-
}
|
|
19507
|
-
delete trackingData.pressTargetsByButton[from.button];
|
|
19508
|
-
}
|
|
19509
|
-
_this.freeEvent(e);
|
|
19510
|
-
case 7:
|
|
19511
|
-
case "end":
|
|
19512
|
-
return _context6.stop();
|
|
19478
|
+
_this.freeEvent(leaveEvent);
|
|
19479
|
+
}
|
|
19480
|
+
_this.freeEvent(outEvent);
|
|
19481
|
+
}
|
|
19482
|
+
// Then pointerover
|
|
19483
|
+
if (outTarget !== e.target) {
|
|
19484
|
+
// pointerover always occurs on the new overTarget
|
|
19485
|
+
var overType = from.type === 'mousemove' ? 'mouseover' : 'pointerover';
|
|
19486
|
+
var overEvent = _this.clonePointerEvent(e, overType); // clone faster
|
|
19487
|
+
_this.dispatchEvent(overEvent, 'pointerover');
|
|
19488
|
+
if (isMouse) _this.dispatchEvent(overEvent, 'mouseover');
|
|
19489
|
+
// Probe whether the newly hovered Node is an ancestor of the original overTarget.
|
|
19490
|
+
var overTargetAncestor = outTarget && Node.isNode(outTarget) && outTarget.parentNode;
|
|
19491
|
+
while (overTargetAncestor && overTargetAncestor !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
19492
|
+
if (overTargetAncestor === e.target) break;
|
|
19493
|
+
overTargetAncestor = overTargetAncestor.parentNode;
|
|
19494
|
+
}
|
|
19495
|
+
// The pointer has entered a non-ancestor of the original overTarget. This means we need a pointerentered
|
|
19496
|
+
// event.
|
|
19497
|
+
var didPointerEnter = !overTargetAncestor || overTargetAncestor === (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode);
|
|
19498
|
+
if (didPointerEnter) {
|
|
19499
|
+
var enterEvent = _this.clonePointerEvent(e, 'pointerenter');
|
|
19500
|
+
enterEvent.eventPhase = enterEvent.AT_TARGET;
|
|
19501
|
+
while (enterEvent.target && enterEvent.target !== outTarget && enterEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
19502
|
+
enterEvent.currentTarget = enterEvent.target;
|
|
19503
|
+
_this.notifyTarget(enterEvent);
|
|
19504
|
+
if (isMouse) _this.notifyTarget(enterEvent, 'mouseenter');
|
|
19505
|
+
if (Node.isNode(enterEvent.target)) {
|
|
19506
|
+
enterEvent.target = enterEvent.target.parentNode;
|
|
19513
19507
|
}
|
|
19514
19508
|
}
|
|
19515
|
-
|
|
19516
|
-
|
|
19517
|
-
|
|
19518
|
-
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
|
|
19522
|
-
|
|
19523
|
-
|
|
19524
|
-
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
|
|
19528
|
-
|
|
19529
|
-
|
|
19530
|
-
|
|
19531
|
-
|
|
19532
|
-
|
|
19533
|
-
|
|
19534
|
-
|
|
19535
|
-
|
|
19536
|
-
|
|
19537
|
-
|
|
19509
|
+
_this.freeEvent(enterEvent);
|
|
19510
|
+
}
|
|
19511
|
+
_this.freeEvent(overEvent);
|
|
19512
|
+
}
|
|
19513
|
+
// Then pointermove
|
|
19514
|
+
_this.dispatchEvent(e, 'pointermove');
|
|
19515
|
+
if (e.pointerType === 'touch') _this.dispatchEvent(e, 'touchmove');
|
|
19516
|
+
if (isMouse) {
|
|
19517
|
+
_this.dispatchEvent(e, 'mousemove');
|
|
19518
|
+
_this.cursor = _this.getCursor(e.target);
|
|
19519
|
+
}
|
|
19520
|
+
trackingData.overTargets = e.composedPath();
|
|
19521
|
+
_this.freeEvent(e);
|
|
19522
|
+
};
|
|
19523
|
+
this.onPointerOut = function (from) {
|
|
19524
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19525
|
+
// return;
|
|
19526
|
+
// }
|
|
19527
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
19528
|
+
if (trackingData.overTargets) {
|
|
19529
|
+
var isMouse = from.pointerType === 'mouse' || from.pointerType === 'pen';
|
|
19530
|
+
var outTarget = _this.findMountedTarget(trackingData.overTargets);
|
|
19531
|
+
// pointerout first
|
|
19532
|
+
var outEvent = _this.createPointerEvent(from, 'pointerout', outTarget || undefined);
|
|
19533
|
+
_this.dispatchEvent(outEvent);
|
|
19534
|
+
if (isMouse) _this.dispatchEvent(outEvent, 'mouseout');
|
|
19535
|
+
// pointerleave(s) are also dispatched b/c the pointer must've left rootTarget and its descendants to
|
|
19536
|
+
// get an upstream pointerout event (upstream events do not know rootTarget has descendants).
|
|
19537
|
+
var leaveEvent = _this.createPointerEvent(from, 'pointerleave', outTarget || undefined);
|
|
19538
|
+
leaveEvent.eventPhase = leaveEvent.AT_TARGET;
|
|
19539
|
+
while (leaveEvent.target && leaveEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
19540
|
+
leaveEvent.currentTarget = leaveEvent.target;
|
|
19541
|
+
_this.notifyTarget(leaveEvent);
|
|
19542
|
+
if (isMouse) {
|
|
19543
|
+
_this.notifyTarget(leaveEvent, 'mouseleave');
|
|
19538
19544
|
}
|
|
19539
|
-
|
|
19540
|
-
|
|
19541
|
-
|
|
19542
|
-
|
|
19543
|
-
|
|
19544
|
-
|
|
19545
|
+
if (Node.isNode(leaveEvent.target)) {
|
|
19546
|
+
leaveEvent.target = leaveEvent.target.parentNode;
|
|
19547
|
+
}
|
|
19548
|
+
}
|
|
19549
|
+
trackingData.overTargets = null;
|
|
19550
|
+
_this.freeEvent(outEvent);
|
|
19551
|
+
_this.freeEvent(leaveEvent);
|
|
19552
|
+
}
|
|
19553
|
+
_this.cursor = null;
|
|
19554
|
+
};
|
|
19555
|
+
this.onPointerOver = function (from) {
|
|
19556
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19557
|
+
// return;
|
|
19558
|
+
// }
|
|
19559
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
19560
|
+
var e = _this.createPointerEvent(from);
|
|
19561
|
+
var isMouse = e.pointerType === 'mouse' || e.pointerType === 'pen';
|
|
19562
|
+
_this.dispatchEvent(e, 'pointerover');
|
|
19563
|
+
if (isMouse) _this.dispatchEvent(e, 'mouseover');
|
|
19564
|
+
if (e.pointerType === 'mouse') _this.cursor = _this.getCursor(e.target);
|
|
19565
|
+
// pointerenter events must be fired since the pointer entered from upstream.
|
|
19566
|
+
var enterEvent = _this.clonePointerEvent(e, 'pointerenter');
|
|
19567
|
+
enterEvent.eventPhase = enterEvent.AT_TARGET;
|
|
19568
|
+
while (enterEvent.target && enterEvent.target !== (Node.isNode(_this.rootTarget) && _this.rootTarget.parentNode)) {
|
|
19569
|
+
enterEvent.currentTarget = enterEvent.target;
|
|
19570
|
+
_this.notifyTarget(enterEvent);
|
|
19571
|
+
if (isMouse) {
|
|
19572
|
+
// mouseenter should not bubble
|
|
19573
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/Element/mouseenter_event#usage_notes
|
|
19574
|
+
_this.notifyTarget(enterEvent, 'mouseenter');
|
|
19575
|
+
}
|
|
19576
|
+
if (Node.isNode(enterEvent.target)) {
|
|
19577
|
+
enterEvent.target = enterEvent.target.parentNode;
|
|
19578
|
+
}
|
|
19579
|
+
}
|
|
19580
|
+
trackingData.overTargets = e.composedPath();
|
|
19581
|
+
_this.freeEvent(e);
|
|
19582
|
+
_this.freeEvent(enterEvent);
|
|
19583
|
+
};
|
|
19584
|
+
this.onPointerUpOutside = function (from) {
|
|
19585
|
+
// if (!(from instanceof FederatedPointerEvent)) {
|
|
19586
|
+
// return;
|
|
19587
|
+
// }
|
|
19588
|
+
var trackingData = _this.trackingData(from.pointerId);
|
|
19589
|
+
var pressTarget = _this.findMountedTarget(trackingData.pressTargetsByButton[from.button]);
|
|
19590
|
+
var e = _this.createPointerEvent(from);
|
|
19591
|
+
if (pressTarget) {
|
|
19592
|
+
var currentTarget = pressTarget;
|
|
19593
|
+
while (currentTarget) {
|
|
19594
|
+
e.currentTarget = currentTarget;
|
|
19595
|
+
_this.notifyTarget(e, 'pointerupoutside');
|
|
19596
|
+
if (e.pointerType === 'touch') ; else if (e.pointerType === 'mouse' || e.pointerType === 'pen') {
|
|
19597
|
+
_this.notifyTarget(e, e.button === 2 ? 'rightupoutside' : 'mouseupoutside');
|
|
19598
|
+
}
|
|
19599
|
+
if (Node.isNode(currentTarget)) {
|
|
19600
|
+
currentTarget = currentTarget.parentNode;
|
|
19601
|
+
}
|
|
19602
|
+
}
|
|
19603
|
+
delete trackingData.pressTargetsByButton[from.button];
|
|
19604
|
+
}
|
|
19605
|
+
_this.freeEvent(e);
|
|
19606
|
+
};
|
|
19607
|
+
this.onWheel = function (from) {
|
|
19608
|
+
// if (!(from instanceof FederatedWheelEvent)) {
|
|
19609
|
+
// return;
|
|
19610
|
+
// }
|
|
19611
|
+
var wheelEvent = _this.createWheelEvent(from);
|
|
19612
|
+
_this.dispatchEvent(wheelEvent);
|
|
19613
|
+
_this.freeEvent(wheelEvent);
|
|
19614
|
+
};
|
|
19615
|
+
this.onClick = function (from) {
|
|
19616
|
+
if (_this.context.config.useNativeClickEvent) {
|
|
19617
|
+
var e = _this.createPointerEvent(from);
|
|
19618
|
+
_this.dispatchEvent(e);
|
|
19619
|
+
_this.freeEvent(e);
|
|
19620
|
+
}
|
|
19621
|
+
};
|
|
19622
|
+
this.onPointerCancel = function (from) {
|
|
19623
|
+
var e = _this.createPointerEvent(from);
|
|
19624
|
+
_this.dispatchEvent(e);
|
|
19625
|
+
_this.freeEvent(e);
|
|
19626
|
+
};
|
|
19545
19627
|
this.globalRuntime = globalRuntime;
|
|
19546
19628
|
this.context = context;
|
|
19547
19629
|
}
|
|
@@ -19553,9 +19635,11 @@
|
|
|
19553
19635
|
this.addEventMapping('pointermove', this.onPointerMove);
|
|
19554
19636
|
this.addEventMapping('pointerout', this.onPointerOut);
|
|
19555
19637
|
this.addEventMapping('pointerleave', this.onPointerOut);
|
|
19638
|
+
this.addEventMapping('pointercancel', this.onPointerCancel);
|
|
19556
19639
|
this.addEventMapping('pointerover', this.onPointerOver);
|
|
19557
19640
|
this.addEventMapping('pointerupoutside', this.onPointerUpOutside);
|
|
19558
19641
|
this.addEventMapping('wheel', this.onWheel);
|
|
19642
|
+
this.addEventMapping('click', this.onClick);
|
|
19559
19643
|
};
|
|
19560
19644
|
_proto.destroy = function destroy() {
|
|
19561
19645
|
this.emitter.removeAllListeners();
|
|
@@ -19571,9 +19655,9 @@
|
|
|
19571
19655
|
var bbox = this.context.contextService.getBoundingClientRect();
|
|
19572
19656
|
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));
|
|
19573
19657
|
};
|
|
19574
|
-
_proto.viewport2Canvas = function viewport2Canvas(
|
|
19575
|
-
var x =
|
|
19576
|
-
y =
|
|
19658
|
+
_proto.viewport2Canvas = function viewport2Canvas(_ref) {
|
|
19659
|
+
var x = _ref.x,
|
|
19660
|
+
y = _ref.y;
|
|
19577
19661
|
var canvas = this.rootTarget.defaultView;
|
|
19578
19662
|
var camera = canvas.getCamera();
|
|
19579
19663
|
var _this$context$config = this.context.config,
|
|
@@ -19696,58 +19780,24 @@
|
|
|
19696
19780
|
}
|
|
19697
19781
|
return propagationPath;
|
|
19698
19782
|
};
|
|
19699
|
-
_proto.hitTest =
|
|
19700
|
-
var
|
|
19701
|
-
|
|
19702
|
-
|
|
19703
|
-
|
|
19704
|
-
|
|
19705
|
-
|
|
19706
|
-
|
|
19707
|
-
|
|
19708
|
-
if (!(viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height)) {
|
|
19709
|
-
_context8.next = 4;
|
|
19710
|
-
break;
|
|
19711
|
-
}
|
|
19712
|
-
return _context8.abrupt("return", null);
|
|
19713
|
-
case 4:
|
|
19714
|
-
_context8.next = 6;
|
|
19715
|
-
return this.pickHandler(position);
|
|
19716
|
-
case 6:
|
|
19717
|
-
_context8.t1 = _context8.sent;
|
|
19718
|
-
if (_context8.t1) {
|
|
19719
|
-
_context8.next = 9;
|
|
19720
|
-
break;
|
|
19721
|
-
}
|
|
19722
|
-
_context8.t1 = this.rootTarget;
|
|
19723
|
-
case 9:
|
|
19724
|
-
_context8.t0 = _context8.t1;
|
|
19725
|
-
if (_context8.t0) {
|
|
19726
|
-
_context8.next = 12;
|
|
19727
|
-
break;
|
|
19728
|
-
}
|
|
19729
|
-
_context8.t0 =
|
|
19730
|
-
// return Document
|
|
19731
|
-
null;
|
|
19732
|
-
case 12:
|
|
19733
|
-
return _context8.abrupt("return", _context8.t0);
|
|
19734
|
-
case 13:
|
|
19735
|
-
case "end":
|
|
19736
|
-
return _context8.stop();
|
|
19737
|
-
}
|
|
19738
|
-
}
|
|
19739
|
-
}, _callee8, this);
|
|
19740
|
-
}));
|
|
19741
|
-
function hitTest(_x8) {
|
|
19742
|
-
return _hitTest.apply(this, arguments);
|
|
19783
|
+
_proto.hitTest = function hitTest(position) {
|
|
19784
|
+
var viewportX = position.viewportX,
|
|
19785
|
+
viewportY = position.viewportY;
|
|
19786
|
+
var _this$context$config3 = this.context.config,
|
|
19787
|
+
width = _this$context$config3.width,
|
|
19788
|
+
height = _this$context$config3.height;
|
|
19789
|
+
// outside canvas
|
|
19790
|
+
if (viewportX < 0 || viewportY < 0 || viewportX > width || viewportY > height) {
|
|
19791
|
+
return null;
|
|
19743
19792
|
}
|
|
19744
|
-
return
|
|
19745
|
-
|
|
19793
|
+
return this.pickHandler(position) || this.rootTarget ||
|
|
19794
|
+
// return Document
|
|
19795
|
+
null;
|
|
19796
|
+
}
|
|
19746
19797
|
/**
|
|
19747
19798
|
* whether the native event trigger came from Canvas,
|
|
19748
19799
|
* should account for HTML shape
|
|
19749
|
-
|
|
19750
|
-
;
|
|
19800
|
+
*/;
|
|
19751
19801
|
_proto.isNativeEventFromCanvas = function isNativeEventFromCanvas(event) {
|
|
19752
19802
|
var _event$nativeEvent;
|
|
19753
19803
|
var $el = this.context.contextService.getDomElement();
|
|
@@ -19780,135 +19830,41 @@
|
|
|
19780
19830
|
}
|
|
19781
19831
|
return null;
|
|
19782
19832
|
};
|
|
19783
|
-
_proto.pickTarget =
|
|
19784
|
-
|
|
19785
|
-
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
|
|
19789
|
-
|
|
19790
|
-
|
|
19791
|
-
|
|
19792
|
-
|
|
19793
|
-
|
|
19794
|
-
|
|
19795
|
-
|
|
19796
|
-
|
|
19797
|
-
|
|
19798
|
-
|
|
19799
|
-
|
|
19800
|
-
|
|
19801
|
-
|
|
19802
|
-
|
|
19803
|
-
|
|
19804
|
-
function pickTarget(_x9) {
|
|
19805
|
-
return _pickTarget.apply(this, arguments);
|
|
19806
|
-
}
|
|
19807
|
-
return pickTarget;
|
|
19808
|
-
}();
|
|
19809
|
-
_proto.createPointerEvent = /*#__PURE__*/function () {
|
|
19810
|
-
var _createPointerEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(from, type, target) {
|
|
19811
|
-
var event, existedHTML;
|
|
19812
|
-
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
19813
|
-
while (1) {
|
|
19814
|
-
switch (_context10.prev = _context10.next) {
|
|
19815
|
-
case 0:
|
|
19816
|
-
event = this.allocateEvent(FederatedPointerEvent);
|
|
19817
|
-
this.copyPointerData(from, event);
|
|
19818
|
-
this.copyMouseData(from, event);
|
|
19819
|
-
this.copyData(from, event);
|
|
19820
|
-
event.nativeEvent = from.nativeEvent;
|
|
19821
|
-
event.originalEvent = from;
|
|
19822
|
-
existedHTML = this.getExistedHTML(event);
|
|
19823
|
-
if (!(target !== null && target !== void 0)) {
|
|
19824
|
-
_context10.next = 11;
|
|
19825
|
-
break;
|
|
19826
|
-
}
|
|
19827
|
-
_context10.t0 = target;
|
|
19828
|
-
_context10.next = 20;
|
|
19829
|
-
break;
|
|
19830
|
-
case 11:
|
|
19831
|
-
_context10.t1 = existedHTML;
|
|
19832
|
-
if (_context10.t1) {
|
|
19833
|
-
_context10.next = 19;
|
|
19834
|
-
break;
|
|
19835
|
-
}
|
|
19836
|
-
_context10.t2 = this.isNativeEventFromCanvas(event);
|
|
19837
|
-
if (!_context10.t2) {
|
|
19838
|
-
_context10.next = 18;
|
|
19839
|
-
break;
|
|
19840
|
-
}
|
|
19841
|
-
_context10.next = 17;
|
|
19842
|
-
return this.pickTarget(event);
|
|
19843
|
-
case 17:
|
|
19844
|
-
_context10.t2 = _context10.sent;
|
|
19845
|
-
case 18:
|
|
19846
|
-
_context10.t1 = _context10.t2;
|
|
19847
|
-
case 19:
|
|
19848
|
-
_context10.t0 = _context10.t1;
|
|
19849
|
-
case 20:
|
|
19850
|
-
event.target = _context10.t0;
|
|
19851
|
-
if (typeof type === 'string') {
|
|
19852
|
-
event.type = type;
|
|
19853
|
-
}
|
|
19854
|
-
return _context10.abrupt("return", event);
|
|
19855
|
-
case 23:
|
|
19856
|
-
case "end":
|
|
19857
|
-
return _context10.stop();
|
|
19858
|
-
}
|
|
19859
|
-
}
|
|
19860
|
-
}, _callee10, this);
|
|
19861
|
-
}));
|
|
19862
|
-
function createPointerEvent(_x10, _x11, _x12) {
|
|
19863
|
-
return _createPointerEvent.apply(this, arguments);
|
|
19864
|
-
}
|
|
19865
|
-
return createPointerEvent;
|
|
19866
|
-
}();
|
|
19867
|
-
_proto.createWheelEvent = /*#__PURE__*/function () {
|
|
19868
|
-
var _createWheelEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(from) {
|
|
19869
|
-
var event, existedHTML;
|
|
19870
|
-
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
19871
|
-
while (1) {
|
|
19872
|
-
switch (_context11.prev = _context11.next) {
|
|
19873
|
-
case 0:
|
|
19874
|
-
event = this.allocateEvent(FederatedWheelEvent);
|
|
19875
|
-
this.copyWheelData(from, event);
|
|
19876
|
-
this.copyMouseData(from, event);
|
|
19877
|
-
this.copyData(from, event);
|
|
19878
|
-
event.nativeEvent = from.nativeEvent;
|
|
19879
|
-
event.originalEvent = from;
|
|
19880
|
-
existedHTML = this.getExistedHTML(event);
|
|
19881
|
-
_context11.t0 = existedHTML;
|
|
19882
|
-
if (_context11.t0) {
|
|
19883
|
-
_context11.next = 15;
|
|
19884
|
-
break;
|
|
19885
|
-
}
|
|
19886
|
-
_context11.t1 = this.isNativeEventFromCanvas(event);
|
|
19887
|
-
if (!_context11.t1) {
|
|
19888
|
-
_context11.next = 14;
|
|
19889
|
-
break;
|
|
19890
|
-
}
|
|
19891
|
-
_context11.next = 13;
|
|
19892
|
-
return this.pickTarget(event);
|
|
19893
|
-
case 13:
|
|
19894
|
-
_context11.t1 = _context11.sent;
|
|
19895
|
-
case 14:
|
|
19896
|
-
_context11.t0 = _context11.t1;
|
|
19897
|
-
case 15:
|
|
19898
|
-
event.target = _context11.t0;
|
|
19899
|
-
return _context11.abrupt("return", event);
|
|
19900
|
-
case 17:
|
|
19901
|
-
case "end":
|
|
19902
|
-
return _context11.stop();
|
|
19903
|
-
}
|
|
19904
|
-
}
|
|
19905
|
-
}, _callee11, this);
|
|
19906
|
-
}));
|
|
19907
|
-
function createWheelEvent(_x13) {
|
|
19908
|
-
return _createWheelEvent.apply(this, arguments);
|
|
19833
|
+
_proto.pickTarget = function pickTarget(event) {
|
|
19834
|
+
return this.hitTest({
|
|
19835
|
+
clientX: event.clientX,
|
|
19836
|
+
clientY: event.clientY,
|
|
19837
|
+
viewportX: event.viewportX,
|
|
19838
|
+
viewportY: event.viewportY,
|
|
19839
|
+
x: event.canvasX,
|
|
19840
|
+
y: event.canvasY
|
|
19841
|
+
});
|
|
19842
|
+
};
|
|
19843
|
+
_proto.createPointerEvent = function createPointerEvent(from, type, target) {
|
|
19844
|
+
var event = this.allocateEvent(FederatedPointerEvent);
|
|
19845
|
+
this.copyPointerData(from, event);
|
|
19846
|
+
this.copyMouseData(from, event);
|
|
19847
|
+
this.copyData(from, event);
|
|
19848
|
+
event.nativeEvent = from.nativeEvent;
|
|
19849
|
+
event.originalEvent = from;
|
|
19850
|
+
var existedHTML = this.getExistedHTML(event);
|
|
19851
|
+
event.target = target !== null && target !== void 0 ? target : existedHTML || this.isNativeEventFromCanvas(event) && this.pickTarget(event);
|
|
19852
|
+
if (typeof type === 'string') {
|
|
19853
|
+
event.type = type;
|
|
19909
19854
|
}
|
|
19910
|
-
return
|
|
19911
|
-
}
|
|
19855
|
+
return event;
|
|
19856
|
+
};
|
|
19857
|
+
_proto.createWheelEvent = function createWheelEvent(from) {
|
|
19858
|
+
var event = this.allocateEvent(FederatedWheelEvent);
|
|
19859
|
+
this.copyWheelData(from, event);
|
|
19860
|
+
this.copyMouseData(from, event);
|
|
19861
|
+
this.copyData(from, event);
|
|
19862
|
+
event.nativeEvent = from.nativeEvent;
|
|
19863
|
+
event.originalEvent = from;
|
|
19864
|
+
var existedHTML = this.getExistedHTML(event);
|
|
19865
|
+
event.target = existedHTML || this.isNativeEventFromCanvas(event) && this.pickTarget(event);
|
|
19866
|
+
return event;
|
|
19867
|
+
};
|
|
19912
19868
|
_proto.trackingData = function trackingData(id) {
|
|
19913
19869
|
if (!this.mappingState.trackingData[id]) {
|
|
19914
19870
|
this.mappingState.trackingData[id] = {
|
|
@@ -20165,6 +20121,9 @@
|
|
|
20165
20121
|
rendered: 0
|
|
20166
20122
|
};
|
|
20167
20123
|
this.zIndexCounter = 0;
|
|
20124
|
+
/**
|
|
20125
|
+
* avoid re-creating too many custom events
|
|
20126
|
+
*/
|
|
20168
20127
|
this.renderOrderChangedEvent = new CustomEvent(exports.ElementEvent.RENDER_ORDER_CHANGED);
|
|
20169
20128
|
this.hooks = {
|
|
20170
20129
|
/**
|
|
@@ -20214,7 +20173,8 @@
|
|
|
20214
20173
|
pointerOut: new SyncHook(['event']),
|
|
20215
20174
|
pointerOver: new SyncHook(['event']),
|
|
20216
20175
|
pointerWheel: new SyncHook(['event']),
|
|
20217
|
-
pointerCancel: new SyncHook(['event'])
|
|
20176
|
+
pointerCancel: new SyncHook(['event']),
|
|
20177
|
+
click: new SyncHook(['event'])
|
|
20218
20178
|
};
|
|
20219
20179
|
this.globalRuntime = globalRuntime;
|
|
20220
20180
|
this.context = context;
|
|
@@ -20224,22 +20184,20 @@
|
|
|
20224
20184
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
20225
20185
|
var context;
|
|
20226
20186
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
20227
|
-
while (1) {
|
|
20228
|
-
|
|
20229
|
-
|
|
20230
|
-
|
|
20231
|
-
|
|
20232
|
-
|
|
20233
|
-
|
|
20234
|
-
|
|
20235
|
-
|
|
20236
|
-
|
|
20237
|
-
|
|
20238
|
-
|
|
20239
|
-
|
|
20240
|
-
|
|
20241
|
-
return _context.stop();
|
|
20242
|
-
}
|
|
20187
|
+
while (1) switch (_context.prev = _context.next) {
|
|
20188
|
+
case 0:
|
|
20189
|
+
context = _extends({}, this.globalRuntime, this.context); // register rendering plugins
|
|
20190
|
+
this.context.renderingPlugins.forEach(function (plugin) {
|
|
20191
|
+
plugin.apply(context, runtime);
|
|
20192
|
+
});
|
|
20193
|
+
// await this.hooks.init.callPromise();
|
|
20194
|
+
_context.next = 4;
|
|
20195
|
+
return this.hooks.init.promise();
|
|
20196
|
+
case 4:
|
|
20197
|
+
this.inited = true;
|
|
20198
|
+
case 5:
|
|
20199
|
+
case "end":
|
|
20200
|
+
return _context.stop();
|
|
20243
20201
|
}
|
|
20244
20202
|
}, _callee, this);
|
|
20245
20203
|
}));
|
|
@@ -20484,6 +20442,9 @@
|
|
|
20484
20442
|
this.runtime = void 0;
|
|
20485
20443
|
this.pendingEvents = [];
|
|
20486
20444
|
this.boundsChangedEvent = new CustomEvent(exports.ElementEvent.BOUNDS_CHANGED);
|
|
20445
|
+
/**
|
|
20446
|
+
* rotate in world space
|
|
20447
|
+
*/
|
|
20487
20448
|
this.rotate = function () {
|
|
20488
20449
|
var parentInvertRotation = create$4();
|
|
20489
20450
|
return function (element, degrees, y, z) {
|
|
@@ -20513,6 +20474,10 @@
|
|
|
20513
20474
|
}
|
|
20514
20475
|
};
|
|
20515
20476
|
}();
|
|
20477
|
+
/**
|
|
20478
|
+
* rotate in local space
|
|
20479
|
+
* @see @see https://docs.microsoft.com/en-us/windows/win32/api/directxmath/nf-directxmath-xmquaternionrotationrollpitchyaw
|
|
20480
|
+
*/
|
|
20516
20481
|
this.rotateLocal = function () {
|
|
20517
20482
|
var rotation = create$4();
|
|
20518
20483
|
return function (element, degrees, y, z) {
|
|
@@ -20531,6 +20496,9 @@
|
|
|
20531
20496
|
_this.dirtifyLocal(element, transform);
|
|
20532
20497
|
};
|
|
20533
20498
|
}();
|
|
20499
|
+
/**
|
|
20500
|
+
* set euler angles(degrees) in world space
|
|
20501
|
+
*/
|
|
20534
20502
|
this.setEulerAngles = function () {
|
|
20535
20503
|
var invParentRot = create$4();
|
|
20536
20504
|
return function (element, degrees, y, z) {
|
|
@@ -20555,6 +20523,15 @@
|
|
|
20555
20523
|
}
|
|
20556
20524
|
};
|
|
20557
20525
|
}();
|
|
20526
|
+
/**
|
|
20527
|
+
* translate in local space
|
|
20528
|
+
*
|
|
20529
|
+
* @example
|
|
20530
|
+
* ```
|
|
20531
|
+
* translateLocal(x, y, z)
|
|
20532
|
+
* translateLocal(vec3(x, y, z))
|
|
20533
|
+
* ```
|
|
20534
|
+
*/
|
|
20558
20535
|
this.translateLocal = function () {
|
|
20559
20536
|
return function (element, translation, y, z) {
|
|
20560
20537
|
if (y === void 0) {
|
|
@@ -20575,6 +20552,12 @@
|
|
|
20575
20552
|
_this.dirtifyLocal(element, transform);
|
|
20576
20553
|
};
|
|
20577
20554
|
}();
|
|
20555
|
+
/**
|
|
20556
|
+
* move to position in world space
|
|
20557
|
+
*
|
|
20558
|
+
* 对应 g 原版的 move/moveTo
|
|
20559
|
+
* @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L684-L689
|
|
20560
|
+
*/
|
|
20578
20561
|
this.setPosition = function () {
|
|
20579
20562
|
var parentInvertMatrix = create$1();
|
|
20580
20563
|
var tmpPosition = create$2();
|
|
@@ -20598,6 +20581,9 @@
|
|
|
20598
20581
|
_this.dirtifyLocal(element, transform);
|
|
20599
20582
|
};
|
|
20600
20583
|
}();
|
|
20584
|
+
/**
|
|
20585
|
+
* move to position in local space
|
|
20586
|
+
*/
|
|
20601
20587
|
this.setLocalPosition = function () {
|
|
20602
20588
|
var tmpPosition = create$2();
|
|
20603
20589
|
return function (element, position) {
|
|
@@ -20612,6 +20598,18 @@
|
|
|
20612
20598
|
_this.dirtifyLocal(element, transform);
|
|
20613
20599
|
};
|
|
20614
20600
|
}();
|
|
20601
|
+
/**
|
|
20602
|
+
* translate in world space
|
|
20603
|
+
*
|
|
20604
|
+
* @example
|
|
20605
|
+
* ```
|
|
20606
|
+
* translate(x, y, z)
|
|
20607
|
+
* translate(vec3(x, y, z))
|
|
20608
|
+
* ```
|
|
20609
|
+
*
|
|
20610
|
+
* 对应 g 原版的 translate 2D
|
|
20611
|
+
* @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L665-L676
|
|
20612
|
+
*/
|
|
20615
20613
|
this.translate = function () {
|
|
20616
20614
|
var zeroVec3 = create$2();
|
|
20617
20615
|
var tmpVec3 = create$2();
|
|
@@ -20778,10 +20776,7 @@
|
|
|
20778
20776
|
originVec[1] = origin[1];
|
|
20779
20777
|
originVec[2] = origin[2] || 0;
|
|
20780
20778
|
this.dirtifyLocal(element, transform);
|
|
20781
|
-
}
|
|
20782
|
-
/**
|
|
20783
|
-
* rotate in world space
|
|
20784
|
-
*/;
|
|
20779
|
+
};
|
|
20785
20780
|
/**
|
|
20786
20781
|
* set euler angles(degrees) in local space
|
|
20787
20782
|
*/
|
|
@@ -20798,16 +20793,7 @@
|
|
|
20798
20793
|
var transform = element.transformable;
|
|
20799
20794
|
fromEuler(transform.localRotation, degrees[0], degrees[1], degrees[2]);
|
|
20800
20795
|
this.dirtifyLocal(element, transform);
|
|
20801
|
-
}
|
|
20802
|
-
/**
|
|
20803
|
-
* translate in local space
|
|
20804
|
-
*
|
|
20805
|
-
* @example
|
|
20806
|
-
* ```
|
|
20807
|
-
* translateLocal(x, y, z)
|
|
20808
|
-
* translateLocal(vec3(x, y, z))
|
|
20809
|
-
* ```
|
|
20810
|
-
*/;
|
|
20796
|
+
};
|
|
20811
20797
|
/**
|
|
20812
20798
|
* scale in local space
|
|
20813
20799
|
*/
|
|
@@ -20824,19 +20810,7 @@
|
|
|
20824
20810
|
}
|
|
20825
20811
|
copy$1(transform.localScale, updatedScaling);
|
|
20826
20812
|
this.dirtifyLocal(element, transform);
|
|
20827
|
-
}
|
|
20828
|
-
/**
|
|
20829
|
-
* translate in world space
|
|
20830
|
-
*
|
|
20831
|
-
* @example
|
|
20832
|
-
* ```
|
|
20833
|
-
* translate(x, y, z)
|
|
20834
|
-
* translate(vec3(x, y, z))
|
|
20835
|
-
* ```
|
|
20836
|
-
*
|
|
20837
|
-
* 对应 g 原版的 translate 2D
|
|
20838
|
-
* @see https://github.com/antvis/g/blob/master/packages/g-base/src/abstract/element.ts#L665-L676
|
|
20839
|
-
*/;
|
|
20813
|
+
};
|
|
20840
20814
|
_proto.setLocalRotation = function setLocalRotation(element, rotation, y, z, w) {
|
|
20841
20815
|
if (typeof rotation === 'number') {
|
|
20842
20816
|
rotation = fromValues$4(rotation, y, z, w);
|
|
@@ -21245,6 +21219,9 @@
|
|
|
21245
21219
|
function TextService(runtime) {
|
|
21246
21220
|
var _this = this;
|
|
21247
21221
|
this.runtime = void 0;
|
|
21222
|
+
/**
|
|
21223
|
+
* font metrics cache
|
|
21224
|
+
*/
|
|
21248
21225
|
this.fontMetricsCache = {};
|
|
21249
21226
|
this.shouldBreakByKinsokuShorui = function (char, nextChar) {
|
|
21250
21227
|
if (_this.isBreakingSpace(nextChar)) return false;
|
|
@@ -21269,9 +21246,6 @@
|
|
|
21269
21246
|
};
|
|
21270
21247
|
this.runtime = runtime;
|
|
21271
21248
|
}
|
|
21272
|
-
/**
|
|
21273
|
-
* font metrics cache
|
|
21274
|
-
*/
|
|
21275
21249
|
var _proto = TextService.prototype;
|
|
21276
21250
|
/**
|
|
21277
21251
|
* Calculates the ascent, descent and fontSize of a given font-style.
|
|
@@ -21360,9 +21334,8 @@
|
|
|
21360
21334
|
_parsedStyle$leading = parsedStyle.leading,
|
|
21361
21335
|
leading = _parsedStyle$leading === void 0 ? 0 : _parsedStyle$leading;
|
|
21362
21336
|
var font = toFontString(parsedStyle);
|
|
21363
|
-
var fontProperties;
|
|
21364
21337
|
// if (runtime.enableCSSParsing) {
|
|
21365
|
-
fontProperties = this.measureFont(font, offscreenCanvas);
|
|
21338
|
+
var fontProperties = this.measureFont(font, offscreenCanvas);
|
|
21366
21339
|
// fallback in case UA disallow canvas data extraction
|
|
21367
21340
|
// (toDataURI, getImageData functions)
|
|
21368
21341
|
if (fontProperties.fontSize === 0) {
|
|
@@ -21834,34 +21807,15 @@
|
|
|
21834
21807
|
this.context = context;
|
|
21835
21808
|
var renderingService = context.renderingService;
|
|
21836
21809
|
var canvas = this.context.renderingContext.root.ownerDocument.defaultView;
|
|
21837
|
-
this.context.eventService.setPickHandler(
|
|
21838
|
-
var
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
|
|
21846
|
-
position: position,
|
|
21847
|
-
picked: [],
|
|
21848
|
-
topmost: true // we only concern the topmost element
|
|
21849
|
-
});
|
|
21850
|
-
case 2:
|
|
21851
|
-
_yield$_this2$context = _context.sent;
|
|
21852
|
-
picked = _yield$_this2$context.picked;
|
|
21853
|
-
return _context.abrupt("return", picked[0] || null);
|
|
21854
|
-
case 5:
|
|
21855
|
-
case "end":
|
|
21856
|
-
return _context.stop();
|
|
21857
|
-
}
|
|
21858
|
-
}
|
|
21859
|
-
}, _callee);
|
|
21860
|
-
}));
|
|
21861
|
-
return function (_x) {
|
|
21862
|
-
return _ref.apply(this, arguments);
|
|
21863
|
-
};
|
|
21864
|
-
}());
|
|
21810
|
+
this.context.eventService.setPickHandler(function (position) {
|
|
21811
|
+
var _this2$context$render = _this2.context.renderingService.hooks.pickSync.call({
|
|
21812
|
+
position: position,
|
|
21813
|
+
picked: [],
|
|
21814
|
+
topmost: true // we only concern the topmost element
|
|
21815
|
+
}),
|
|
21816
|
+
picked = _this2$context$render.picked;
|
|
21817
|
+
return picked[0] || null;
|
|
21818
|
+
});
|
|
21865
21819
|
renderingService.hooks.pointerWheel.tap(EventPlugin.tag, function (nativeEvent) {
|
|
21866
21820
|
var wheelEvent = _this2.normalizeWheelEvent(nativeEvent);
|
|
21867
21821
|
_this2.context.eventService.mapEvent(wheelEvent);
|
|
@@ -21905,6 +21859,16 @@
|
|
|
21905
21859
|
renderingService.hooks.pointerMove.tap(EventPlugin.tag, this.onPointerMove);
|
|
21906
21860
|
renderingService.hooks.pointerOver.tap(EventPlugin.tag, this.onPointerMove);
|
|
21907
21861
|
renderingService.hooks.pointerOut.tap(EventPlugin.tag, this.onPointerMove);
|
|
21862
|
+
renderingService.hooks.click.tap(EventPlugin.tag, this.onPointerMove);
|
|
21863
|
+
renderingService.hooks.pointerCancel.tap(EventPlugin.tag, function (nativeEvent) {
|
|
21864
|
+
var normalizedEvents = _this2.normalizeToPointerEvent(nativeEvent, canvas);
|
|
21865
|
+
for (var _iterator4 = _createForOfIteratorHelperLoose(normalizedEvents), _step4; !(_step4 = _iterator4()).done;) {
|
|
21866
|
+
var normalizedEvent = _step4.value;
|
|
21867
|
+
var event = _this2.bootstrapEvent(_this2.rootPointerEvent, normalizedEvent, canvas, nativeEvent);
|
|
21868
|
+
_this2.context.eventService.mapEvent(event);
|
|
21869
|
+
}
|
|
21870
|
+
_this2.setCursor(_this2.context.eventService.cursor);
|
|
21871
|
+
});
|
|
21908
21872
|
};
|
|
21909
21873
|
_proto.getViewportXY = function getViewportXY(nativeEvent) {
|
|
21910
21874
|
var x;
|
|
@@ -22149,6 +22113,9 @@
|
|
|
22149
22113
|
var PrepareRendererPlugin = /*#__PURE__*/function () {
|
|
22150
22114
|
function PrepareRendererPlugin() {
|
|
22151
22115
|
this.rBush = void 0;
|
|
22116
|
+
/**
|
|
22117
|
+
* sync to RBush later
|
|
22118
|
+
*/
|
|
22152
22119
|
this.toSync = new Set();
|
|
22153
22120
|
}
|
|
22154
22121
|
var _proto = PrepareRendererPlugin.prototype;
|
|
@@ -22205,17 +22172,15 @@
|
|
|
22205
22172
|
};
|
|
22206
22173
|
renderingService.hooks.init.tapPromise(PrepareRendererPlugin.tag, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
22207
22174
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22208
|
-
while (1) {
|
|
22209
|
-
|
|
22210
|
-
|
|
22211
|
-
|
|
22212
|
-
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
return _context.stop();
|
|
22218
|
-
}
|
|
22175
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22176
|
+
case 0:
|
|
22177
|
+
canvas.addEventListener(exports.ElementEvent.MOUNTED, handleMounted);
|
|
22178
|
+
canvas.addEventListener(exports.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
22179
|
+
canvas.addEventListener(exports.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
22180
|
+
canvas.addEventListener(exports.ElementEvent.BOUNDS_CHANGED, handleBoundsChanged);
|
|
22181
|
+
case 4:
|
|
22182
|
+
case "end":
|
|
22183
|
+
return _context.stop();
|
|
22219
22184
|
}
|
|
22220
22185
|
}, _callee);
|
|
22221
22186
|
})));
|
|
@@ -22413,6 +22378,7 @@
|
|
|
22413
22378
|
supportsPointerEvents = config.supportsPointerEvents,
|
|
22414
22379
|
supportsTouchEvents = config.supportsTouchEvents,
|
|
22415
22380
|
supportsCSSTransform = config.supportsCSSTransform,
|
|
22381
|
+
useNativeClickEvent = config.useNativeClickEvent,
|
|
22416
22382
|
isTouchEvent = config.isTouchEvent,
|
|
22417
22383
|
isMouseEvent = config.isMouseEvent;
|
|
22418
22384
|
cleanExistedCanvas(container, _assertThisInitialized(_this));
|
|
@@ -22458,25 +22424,24 @@
|
|
|
22458
22424
|
background: background || 'transparent',
|
|
22459
22425
|
createImage: createImage,
|
|
22460
22426
|
document: document,
|
|
22461
|
-
supportsCSSTransform: supportsCSSTransform
|
|
22427
|
+
supportsCSSTransform: supportsCSSTransform,
|
|
22428
|
+
useNativeClickEvent: useNativeClickEvent
|
|
22462
22429
|
});
|
|
22463
22430
|
_this.initDefaultCamera(canvasWidth, canvasHeight);
|
|
22464
22431
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
22465
22432
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22466
|
-
while (1) {
|
|
22467
|
-
|
|
22468
|
-
|
|
22469
|
-
|
|
22470
|
-
|
|
22471
|
-
|
|
22472
|
-
|
|
22473
|
-
|
|
22474
|
-
|
|
22475
|
-
|
|
22476
|
-
|
|
22477
|
-
|
|
22478
|
-
return _context.stop();
|
|
22479
|
-
}
|
|
22433
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22434
|
+
case 0:
|
|
22435
|
+
_context.next = 2;
|
|
22436
|
+
return _this.initRenderer(renderer);
|
|
22437
|
+
case 2:
|
|
22438
|
+
_this.dispatchEvent(new CustomEvent(exports.CanvasEvent.READY));
|
|
22439
|
+
if (_this.readyPromise) {
|
|
22440
|
+
_this.resolveReadyPromise();
|
|
22441
|
+
}
|
|
22442
|
+
case 4:
|
|
22443
|
+
case "end":
|
|
22444
|
+
return _context.stop();
|
|
22480
22445
|
}
|
|
22481
22446
|
}, _callee);
|
|
22482
22447
|
}))();
|
|
@@ -22664,56 +22629,54 @@
|
|
|
22664
22629
|
_proto.initRenderer = /*#__PURE__*/function () {
|
|
22665
22630
|
var _initRenderer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(renderer) {
|
|
22666
22631
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
22667
|
-
while (1) {
|
|
22668
|
-
|
|
22669
|
-
|
|
22670
|
-
|
|
22671
|
-
|
|
22672
|
-
|
|
22673
|
-
|
|
22674
|
-
|
|
22675
|
-
|
|
22676
|
-
|
|
22677
|
-
|
|
22678
|
-
|
|
22679
|
-
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
|
|
22694
|
-
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
|
|
22698
|
-
|
|
22699
|
-
|
|
22700
|
-
|
|
22701
|
-
|
|
22702
|
-
|
|
22703
|
-
|
|
22704
|
-
|
|
22705
|
-
renderable.dirty = true;
|
|
22706
|
-
}
|
|
22707
|
-
});
|
|
22708
|
-
// keep current scenegraph unchanged, just trigger mounted event
|
|
22709
|
-
this.mountChildren(this.getRoot());
|
|
22710
|
-
if (renderer.getConfig().enableAutoRendering) {
|
|
22711
|
-
this.run();
|
|
22632
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
22633
|
+
case 0:
|
|
22634
|
+
if (renderer) {
|
|
22635
|
+
_context2.next = 2;
|
|
22636
|
+
break;
|
|
22637
|
+
}
|
|
22638
|
+
throw new Error('Renderer is required.');
|
|
22639
|
+
case 2:
|
|
22640
|
+
// reset
|
|
22641
|
+
this.inited = false;
|
|
22642
|
+
this.readyPromise = undefined;
|
|
22643
|
+
// FIXME: should re-create here?
|
|
22644
|
+
this.context.rBushRoot = new rbush();
|
|
22645
|
+
// reset rendering plugins
|
|
22646
|
+
this.context.renderingPlugins = [];
|
|
22647
|
+
this.context.renderingPlugins.push(new EventPlugin(), new PrepareRendererPlugin(), new DirtyCheckPlugin(), new CullingPlugin([new FrustumCullingStrategy()]));
|
|
22648
|
+
//
|
|
22649
|
+
this.loadRendererContainerModule(renderer);
|
|
22650
|
+
// init context service
|
|
22651
|
+
this.context.contextService = new this.context.ContextService(_extends({}, runtime, this.context));
|
|
22652
|
+
// init rendering service
|
|
22653
|
+
this.context.renderingService = new RenderingService(runtime, this.context);
|
|
22654
|
+
// init event service
|
|
22655
|
+
this.context.eventService = new EventService(runtime, this.context);
|
|
22656
|
+
this.context.eventService.init();
|
|
22657
|
+
_context2.next = 14;
|
|
22658
|
+
return this.context.contextService.init();
|
|
22659
|
+
case 14:
|
|
22660
|
+
_context2.next = 16;
|
|
22661
|
+
return this.context.renderingService.init();
|
|
22662
|
+
case 16:
|
|
22663
|
+
this.inited = true;
|
|
22664
|
+
this.getRoot().forEach(function (node) {
|
|
22665
|
+
var renderable = node.renderable;
|
|
22666
|
+
if (renderable) {
|
|
22667
|
+
renderable.renderBoundsDirty = true;
|
|
22668
|
+
renderable.boundsDirty = true;
|
|
22669
|
+
renderable.dirty = true;
|
|
22712
22670
|
}
|
|
22713
|
-
|
|
22714
|
-
|
|
22715
|
-
|
|
22716
|
-
|
|
22671
|
+
});
|
|
22672
|
+
// keep current scenegraph unchanged, just trigger mounted event
|
|
22673
|
+
this.mountChildren(this.getRoot());
|
|
22674
|
+
if (renderer.getConfig().enableAutoRendering) {
|
|
22675
|
+
this.run();
|
|
22676
|
+
}
|
|
22677
|
+
case 20:
|
|
22678
|
+
case "end":
|
|
22679
|
+
return _context2.stop();
|
|
22717
22680
|
}
|
|
22718
22681
|
}, _callee2, this);
|
|
22719
22682
|
}));
|
|
@@ -22735,31 +22698,29 @@
|
|
|
22735
22698
|
var _setRenderer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(renderer) {
|
|
22736
22699
|
var canvasConfig, oldRenderer;
|
|
22737
22700
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
22738
|
-
while (1) {
|
|
22739
|
-
|
|
22740
|
-
|
|
22741
|
-
|
|
22742
|
-
|
|
22743
|
-
|
|
22744
|
-
|
|
22745
|
-
|
|
22746
|
-
|
|
22747
|
-
|
|
22748
|
-
|
|
22749
|
-
|
|
22750
|
-
|
|
22751
|
-
|
|
22752
|
-
|
|
22753
|
-
|
|
22754
|
-
|
|
22755
|
-
|
|
22756
|
-
|
|
22757
|
-
|
|
22758
|
-
|
|
22759
|
-
|
|
22760
|
-
|
|
22761
|
-
return _context3.stop();
|
|
22762
|
-
}
|
|
22701
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
22702
|
+
case 0:
|
|
22703
|
+
// update canvas' config
|
|
22704
|
+
canvasConfig = this.getConfig();
|
|
22705
|
+
if (!(canvasConfig.renderer === renderer)) {
|
|
22706
|
+
_context3.next = 3;
|
|
22707
|
+
break;
|
|
22708
|
+
}
|
|
22709
|
+
return _context3.abrupt("return");
|
|
22710
|
+
case 3:
|
|
22711
|
+
oldRenderer = canvasConfig.renderer;
|
|
22712
|
+
canvasConfig.renderer = renderer;
|
|
22713
|
+
// keep all children undestroyed
|
|
22714
|
+
this.destroy(false, true);
|
|
22715
|
+
// destroy all plugins, reverse will mutate origin array
|
|
22716
|
+
[].concat(oldRenderer === null || oldRenderer === void 0 ? void 0 : oldRenderer.getPlugins()).reverse().forEach(function (plugin) {
|
|
22717
|
+
plugin.destroy(runtime);
|
|
22718
|
+
});
|
|
22719
|
+
_context3.next = 9;
|
|
22720
|
+
return this.initRenderer(renderer);
|
|
22721
|
+
case 9:
|
|
22722
|
+
case "end":
|
|
22723
|
+
return _context3.stop();
|
|
22763
22724
|
}
|
|
22764
22725
|
}, _callee3, this);
|
|
22765
22726
|
}));
|