@antv/g-plugin-dragndrop 1.6.26 → 1.6.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6,20 +6,19 @@ var gLite = require('@antv/g-lite');
6
6
  var util = require('@antv/util');
7
7
 
8
8
  function _regeneratorRuntime() {
9
- /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
10
-
11
9
  _regeneratorRuntime = function () {
12
10
  return exports;
13
11
  };
14
-
15
12
  var exports = {},
16
- Op = Object.prototype,
17
- hasOwn = Op.hasOwnProperty,
18
- $Symbol = "function" == typeof Symbol ? Symbol : {},
19
- iteratorSymbol = $Symbol.iterator || "@@iterator",
20
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
21
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
22
-
13
+ Op = Object.prototype,
14
+ hasOwn = Op.hasOwnProperty,
15
+ defineProperty = Object.defineProperty || function (obj, key, desc) {
16
+ obj[key] = desc.value;
17
+ },
18
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
19
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
20
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
21
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
23
22
  function define(obj, key, value) {
24
23
  return Object.defineProperty(obj, key, {
25
24
  value: value,
@@ -28,7 +27,6 @@ function _regeneratorRuntime() {
28
27
  writable: !0
29
28
  }), obj[key];
30
29
  }
31
-
32
30
  try {
33
31
  define({}, "");
34
32
  } catch (err) {
@@ -36,54 +34,14 @@ function _regeneratorRuntime() {
36
34
  return obj[key] = value;
37
35
  };
38
36
  }
39
-
40
37
  function wrap(innerFn, outerFn, self, tryLocsList) {
41
38
  var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
42
- generator = Object.create(protoGenerator.prototype),
43
- context = new Context(tryLocsList || []);
44
- return generator._invoke = function (innerFn, self, context) {
45
- var state = "suspendedStart";
46
- return function (method, arg) {
47
- if ("executing" === state) throw new Error("Generator is already running");
48
-
49
- if ("completed" === state) {
50
- if ("throw" === method) throw arg;
51
- return doneResult();
52
- }
53
-
54
- for (context.method = method, context.arg = arg;;) {
55
- var delegate = context.delegate;
56
-
57
- if (delegate) {
58
- var delegateResult = maybeInvokeDelegate(delegate, context);
59
-
60
- if (delegateResult) {
61
- if (delegateResult === ContinueSentinel) continue;
62
- return delegateResult;
63
- }
64
- }
65
-
66
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
67
- if ("suspendedStart" === state) throw state = "completed", context.arg;
68
- context.dispatchException(context.arg);
69
- } else "return" === context.method && context.abrupt("return", context.arg);
70
- state = "executing";
71
- var record = tryCatch(innerFn, self, context);
72
-
73
- if ("normal" === record.type) {
74
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
75
- return {
76
- value: record.arg,
77
- done: context.done
78
- };
79
- }
80
-
81
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
82
- }
83
- };
84
- }(innerFn, self, context), generator;
39
+ generator = Object.create(protoGenerator.prototype),
40
+ context = new Context(tryLocsList || []);
41
+ return defineProperty(generator, "_invoke", {
42
+ value: makeInvokeMethod(innerFn, self, context)
43
+ }), generator;
85
44
  }
86
-
87
45
  function tryCatch(fn, obj, arg) {
88
46
  try {
89
47
  return {
@@ -97,25 +55,19 @@ function _regeneratorRuntime() {
97
55
  };
98
56
  }
99
57
  }
100
-
101
58
  exports.wrap = wrap;
102
59
  var ContinueSentinel = {};
103
-
104
60
  function Generator() {}
105
-
106
61
  function GeneratorFunction() {}
107
-
108
62
  function GeneratorFunctionPrototype() {}
109
-
110
63
  var IteratorPrototype = {};
111
64
  define(IteratorPrototype, iteratorSymbol, function () {
112
65
  return this;
113
66
  });
114
67
  var getProto = Object.getPrototypeOf,
115
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
68
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
116
69
  NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
117
70
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
118
-
119
71
  function defineIteratorMethods(prototype) {
120
72
  ["next", "throw", "return"].forEach(function (method) {
121
73
  define(prototype, method, function (arg) {
@@ -123,14 +75,12 @@ function _regeneratorRuntime() {
123
75
  });
124
76
  });
125
77
  }
126
-
127
78
  function AsyncIterator(generator, PromiseImpl) {
128
79
  function invoke(method, arg, resolve, reject) {
129
80
  var record = tryCatch(generator[method], generator, arg);
130
-
131
81
  if ("throw" !== record.type) {
132
82
  var result = record.arg,
133
- value = result.value;
83
+ value = result.value;
134
84
  return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
135
85
  invoke("next", value, resolve, reject);
136
86
  }, function (err) {
@@ -141,90 +91,114 @@ function _regeneratorRuntime() {
141
91
  return invoke("throw", error, resolve, reject);
142
92
  });
143
93
  }
144
-
145
94
  reject(record.arg);
146
95
  }
147
-
148
96
  var previousPromise;
149
-
150
- this._invoke = function (method, arg) {
151
- function callInvokeWithMethodAndArg() {
152
- return new PromiseImpl(function (resolve, reject) {
153
- invoke(method, arg, resolve, reject);
154
- });
97
+ defineProperty(this, "_invoke", {
98
+ value: function (method, arg) {
99
+ function callInvokeWithMethodAndArg() {
100
+ return new PromiseImpl(function (resolve, reject) {
101
+ invoke(method, arg, resolve, reject);
102
+ });
103
+ }
104
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
105
+ }
106
+ });
107
+ }
108
+ function makeInvokeMethod(innerFn, self, context) {
109
+ var state = "suspendedStart";
110
+ return function (method, arg) {
111
+ if ("executing" === state) throw new Error("Generator is already running");
112
+ if ("completed" === state) {
113
+ if ("throw" === method) throw arg;
114
+ return doneResult();
115
+ }
116
+ for (context.method = method, context.arg = arg;;) {
117
+ var delegate = context.delegate;
118
+ if (delegate) {
119
+ var delegateResult = maybeInvokeDelegate(delegate, context);
120
+ if (delegateResult) {
121
+ if (delegateResult === ContinueSentinel) continue;
122
+ return delegateResult;
123
+ }
124
+ }
125
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
126
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
127
+ context.dispatchException(context.arg);
128
+ } else "return" === context.method && context.abrupt("return", context.arg);
129
+ state = "executing";
130
+ var record = tryCatch(innerFn, self, context);
131
+ if ("normal" === record.type) {
132
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
133
+ return {
134
+ value: record.arg,
135
+ done: context.done
136
+ };
137
+ }
138
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
155
139
  }
156
-
157
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
158
140
  };
159
141
  }
160
-
161
142
  function maybeInvokeDelegate(delegate, context) {
162
143
  var method = delegate.iterator[context.method];
163
-
164
144
  if (undefined === method) {
165
145
  if (context.delegate = null, "throw" === context.method) {
166
146
  if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
167
147
  context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
168
148
  }
169
-
170
149
  return ContinueSentinel;
171
150
  }
172
-
173
151
  var record = tryCatch(method, delegate.iterator, context.arg);
174
152
  if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
175
153
  var info = record.arg;
176
154
  return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
177
155
  }
178
-
179
156
  function pushTryEntry(locs) {
180
157
  var entry = {
181
158
  tryLoc: locs[0]
182
159
  };
183
160
  1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
184
161
  }
185
-
186
162
  function resetTryEntry(entry) {
187
163
  var record = entry.completion || {};
188
164
  record.type = "normal", delete record.arg, entry.completion = record;
189
165
  }
190
-
191
166
  function Context(tryLocsList) {
192
167
  this.tryEntries = [{
193
168
  tryLoc: "root"
194
169
  }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
195
170
  }
196
-
197
171
  function values(iterable) {
198
172
  if (iterable) {
199
173
  var iteratorMethod = iterable[iteratorSymbol];
200
174
  if (iteratorMethod) return iteratorMethod.call(iterable);
201
175
  if ("function" == typeof iterable.next) return iterable;
202
-
203
176
  if (!isNaN(iterable.length)) {
204
177
  var i = -1,
205
- next = function next() {
206
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
207
-
208
- return next.value = undefined, next.done = !0, next;
209
- };
210
-
178
+ next = function next() {
179
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
180
+ return next.value = undefined, next.done = !0, next;
181
+ };
211
182
  return next.next = next;
212
183
  }
213
184
  }
214
-
215
185
  return {
216
186
  next: doneResult
217
187
  };
218
188
  }
219
-
220
189
  function doneResult() {
221
190
  return {
222
191
  value: undefined,
223
192
  done: !0
224
193
  };
225
194
  }
226
-
227
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
195
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
196
+ value: GeneratorFunctionPrototype,
197
+ configurable: !0
198
+ }), defineProperty(GeneratorFunctionPrototype, "constructor", {
199
+ value: GeneratorFunction,
200
+ configurable: !0
201
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
228
202
  var ctor = "function" == typeof genFun && genFun.constructor;
229
203
  return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
230
204
  }, exports.mark = function (genFun) {
@@ -245,17 +219,15 @@ function _regeneratorRuntime() {
245
219
  return this;
246
220
  }), define(Gp, "toString", function () {
247
221
  return "[object Generator]";
248
- }), exports.keys = function (object) {
249
- var keys = [];
250
-
222
+ }), exports.keys = function (val) {
223
+ var object = Object(val),
224
+ keys = [];
251
225
  for (var key in object) keys.push(key);
252
-
253
226
  return keys.reverse(), function next() {
254
227
  for (; keys.length;) {
255
228
  var key = keys.pop();
256
229
  if (key in object) return next.value = key, next.done = !1, next;
257
230
  }
258
-
259
231
  return next.done = !0, next;
260
232
  };
261
233
  }, exports.values = values, Context.prototype = {
@@ -272,20 +244,16 @@ function _regeneratorRuntime() {
272
244
  dispatchException: function (exception) {
273
245
  if (this.done) throw exception;
274
246
  var context = this;
275
-
276
247
  function handle(loc, caught) {
277
248
  return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
278
249
  }
279
-
280
250
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
281
251
  var entry = this.tryEntries[i],
282
- record = entry.completion;
252
+ record = entry.completion;
283
253
  if ("root" === entry.tryLoc) return handle("end");
284
-
285
254
  if (entry.tryLoc <= this.prev) {
286
255
  var hasCatch = hasOwn.call(entry, "catchLoc"),
287
- hasFinally = hasOwn.call(entry, "finallyLoc");
288
-
256
+ hasFinally = hasOwn.call(entry, "finallyLoc");
289
257
  if (hasCatch && hasFinally) {
290
258
  if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
291
259
  if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
@@ -301,13 +269,11 @@ function _regeneratorRuntime() {
301
269
  abrupt: function (type, arg) {
302
270
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
303
271
  var entry = this.tryEntries[i];
304
-
305
272
  if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
306
273
  var finallyEntry = entry;
307
274
  break;
308
275
  }
309
276
  }
310
-
311
277
  finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
312
278
  var record = finallyEntry ? finallyEntry.completion : {};
313
279
  return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
@@ -325,19 +291,15 @@ function _regeneratorRuntime() {
325
291
  catch: function (tryLoc) {
326
292
  for (var i = this.tryEntries.length - 1; i >= 0; --i) {
327
293
  var entry = this.tryEntries[i];
328
-
329
294
  if (entry.tryLoc === tryLoc) {
330
295
  var record = entry.completion;
331
-
332
296
  if ("throw" === record.type) {
333
297
  var thrown = record.arg;
334
298
  resetTryEntry(entry);
335
299
  }
336
-
337
300
  return thrown;
338
301
  }
339
302
  }
340
-
341
303
  throw new Error("illegal catch attempt");
342
304
  },
343
305
  delegateYield: function (iterable, resultName, nextLoc) {
@@ -349,7 +311,6 @@ function _regeneratorRuntime() {
349
311
  }
350
312
  }, exports;
351
313
  }
352
-
353
314
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
354
315
  try {
355
316
  var info = gen[key](arg);
@@ -358,58 +319,47 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
358
319
  reject(error);
359
320
  return;
360
321
  }
361
-
362
322
  if (info.done) {
363
323
  resolve(value);
364
324
  } else {
365
325
  Promise.resolve(value).then(_next, _throw);
366
326
  }
367
327
  }
368
-
369
328
  function _asyncToGenerator(fn) {
370
329
  return function () {
371
330
  var self = this,
372
- args = arguments;
331
+ args = arguments;
373
332
  return new Promise(function (resolve, reject) {
374
333
  var gen = fn.apply(self, args);
375
-
376
334
  function _next(value) {
377
335
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
378
336
  }
379
-
380
337
  function _throw(err) {
381
338
  asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
382
339
  }
383
-
384
340
  _next(undefined);
385
341
  });
386
342
  };
387
343
  }
388
-
389
344
  function _extends() {
390
345
  _extends = Object.assign ? Object.assign.bind() : function (target) {
391
346
  for (var i = 1; i < arguments.length; i++) {
392
347
  var source = arguments[i];
393
-
394
348
  for (var key in source) {
395
349
  if (Object.prototype.hasOwnProperty.call(source, key)) {
396
350
  target[key] = source[key];
397
351
  }
398
352
  }
399
353
  }
400
-
401
354
  return target;
402
355
  };
403
356
  return _extends.apply(this, arguments);
404
357
  }
405
-
406
358
  function _inheritsLoose(subClass, superClass) {
407
359
  subClass.prototype = Object.create(superClass.prototype);
408
360
  subClass.prototype.constructor = subClass;
409
-
410
361
  _setPrototypeOf(subClass, superClass);
411
362
  }
412
-
413
363
  function _setPrototypeOf(o, p) {
414
364
  _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
415
365
  o.__proto__ = p;
@@ -423,28 +373,25 @@ var DragndropPlugin = /*#__PURE__*/function () {
423
373
  this.dragndropPluginOptions = void 0;
424
374
  this.dragndropPluginOptions = dragndropPluginOptions;
425
375
  }
426
-
427
376
  var _proto = DragndropPlugin.prototype;
428
-
429
377
  _proto.apply = function apply(context) {
430
378
  var renderingService = context.renderingService,
431
- renderingContext = context.renderingContext;
432
- var document = renderingContext.root.ownerDocument; // TODO: should we add an option like `draggable` to Canvas
433
-
379
+ renderingContext = context.renderingContext;
380
+ var document = renderingContext.root.ownerDocument;
381
+ // TODO: should we add an option like `draggable` to Canvas
434
382
  var canvas = document.defaultView;
435
383
  var _this$dragndropPlugin = this.dragndropPluginOptions,
436
- overlap = _this$dragndropPlugin.overlap,
437
- isDocumentDraggable = _this$dragndropPlugin.isDocumentDraggable,
438
- isDocumentDroppable = _this$dragndropPlugin.isDocumentDroppable,
439
- dragstartDistanceThreshold = _this$dragndropPlugin.dragstartDistanceThreshold,
440
- dragstartTimeThreshold = _this$dragndropPlugin.dragstartTimeThreshold;
441
-
384
+ overlap = _this$dragndropPlugin.overlap,
385
+ isDocumentDraggable = _this$dragndropPlugin.isDocumentDraggable,
386
+ isDocumentDroppable = _this$dragndropPlugin.isDocumentDroppable,
387
+ dragstartDistanceThreshold = _this$dragndropPlugin.dragstartDistanceThreshold,
388
+ dragstartTimeThreshold = _this$dragndropPlugin.dragstartTimeThreshold;
442
389
  var handlePointerdown = function handlePointerdown(event) {
443
390
  var target = event.target;
444
391
  var isDocument = target === document;
445
- var draggableEventTarget = isDocument && isDocumentDraggable ? document : target.closest && target.closest('[draggable=true]'); // `draggable` may be set on ancestor nodes:
392
+ var draggableEventTarget = isDocument && isDocumentDraggable ? document : target.closest && target.closest('[draggable=true]');
393
+ // `draggable` may be set on ancestor nodes:
446
394
  // @see https://github.com/antvis/G/issues/1088
447
-
448
395
  if (!!draggableEventTarget) {
449
396
  // @ts-ignore
450
397
  var handlePointermove = /*#__PURE__*/function () {
@@ -458,48 +405,39 @@ var DragndropPlugin = /*#__PURE__*/function () {
458
405
  _context.next = 8;
459
406
  break;
460
407
  }
461
-
462
408
  timeElapsed = event.timeStamp - dragstartTimeStamp;
463
409
  distanceMoved = util.distanceSquareRoot([event.clientX, event.clientY], dragstartClientCoordinates); // check thresholds
464
-
465
410
  if (!(timeElapsed <= dragstartTimeThreshold || distanceMoved <= dragstartDistanceThreshold)) {
466
411
  _context.next = 5;
467
412
  break;
468
413
  }
469
-
470
414
  return _context.abrupt("return");
471
-
472
415
  case 5:
473
416
  // @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragstart_event
474
417
  event.type = 'dragstart';
475
418
  draggableEventTarget.dispatchEvent(event);
476
419
  dragstartTriggered = true;
477
-
478
420
  case 8:
479
421
  // @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/drag_event
480
- event.type = 'drag'; // @ts-ignore
481
-
482
- event.dx = event.clientX - lastDragClientCoordinates[0]; // @ts-ignore
483
-
422
+ event.type = 'drag';
423
+ // @ts-ignore
424
+ event.dx = event.clientX - lastDragClientCoordinates[0];
425
+ // @ts-ignore
484
426
  event.dy = event.clientY - lastDragClientCoordinates[1];
485
427
  draggableEventTarget.dispatchEvent(event);
486
428
  lastDragClientCoordinates = [event.clientX, event.clientY];
487
-
488
429
  if (isDocument) {
489
430
  _context.next = 21;
490
431
  break;
491
432
  }
492
-
493
433
  point = overlap === 'pointer' ? [event.canvasX, event.canvasY] : target.getBounds().center;
494
434
  _context.next = 17;
495
435
  return document.elementsFromPoint(point[0], point[1]);
496
-
497
436
  case 17:
498
437
  elementsBelow = _context.sent;
499
438
  // prevent from picking the dragging element
500
439
  elementBelow = elementsBelow[elementsBelow.indexOf(target) + 1];
501
440
  droppableBelow = (elementBelow === null || elementBelow === void 0 ? void 0 : elementBelow.closest('[droppable=true]')) || (isDocumentDroppable ? document : null);
502
-
503
441
  if (currentDroppable !== droppableBelow) {
504
442
  if (currentDroppable) {
505
443
  // null when we were not over a droppable before this event
@@ -508,16 +446,13 @@ var DragndropPlugin = /*#__PURE__*/function () {
508
446
  event.target = currentDroppable;
509
447
  currentDroppable.dispatchEvent(event);
510
448
  }
511
-
512
449
  if (droppableBelow) {
513
450
  // @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragleave_event
514
451
  event.type = 'dragenter';
515
452
  event.target = droppableBelow;
516
453
  droppableBelow.dispatchEvent(event);
517
454
  }
518
-
519
455
  currentDroppable = droppableBelow;
520
-
521
456
  if (currentDroppable) {
522
457
  // null if we're not coming over a droppable now
523
458
  // @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragover_event
@@ -526,7 +461,6 @@ var DragndropPlugin = /*#__PURE__*/function () {
526
461
  currentDroppable.dispatchEvent(event);
527
462
  }
528
463
  }
529
-
530
464
  case 21:
531
465
  case "end":
532
466
  return _context.stop();
@@ -534,12 +468,10 @@ var DragndropPlugin = /*#__PURE__*/function () {
534
468
  }
535
469
  }, _callee);
536
470
  }));
537
-
538
471
  return function handlePointermove(_x) {
539
472
  return _ref.apply(this, arguments);
540
473
  };
541
474
  }();
542
-
543
475
  // delay triggering dragstart event
544
476
  var dragstartTriggered = false;
545
477
  var dragstartTimeStamp = event.timeStamp;
@@ -547,35 +479,30 @@ var DragndropPlugin = /*#__PURE__*/function () {
547
479
  var currentDroppable = null;
548
480
  var lastDragClientCoordinates = [event.clientX, event.clientY];
549
481
  canvas.addEventListener('pointermove', handlePointermove);
550
-
551
482
  var stopDragging = function stopDragging(originalPointerUpEvent) {
552
483
  if (dragstartTriggered) {
553
484
  // prevent click event being triggerd
554
485
  // @see https://github.com/antvis/G/issues/1091
555
486
  originalPointerUpEvent.detail = {
556
487
  preventClick: true
557
- }; // clone event first
558
-
559
- var _event = originalPointerUpEvent.clone(); // drop should fire before dragend
488
+ };
489
+ // clone event first
490
+ var _event = originalPointerUpEvent.clone();
491
+ // drop should fire before dragend
560
492
  // @see https://javascript.tutorialink.com/is-there-a-defined-ordering-between-dragend-and-drop-events/
561
-
562
-
563
493
  if (currentDroppable) {
564
494
  // @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/drop_event
565
495
  _event.type = 'drop';
566
496
  _event.target = currentDroppable;
567
497
  currentDroppable.dispatchEvent(_event);
568
- } // @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragend_event
569
-
570
-
498
+ }
499
+ // @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragend_event
571
500
  _event.type = 'dragend';
572
501
  draggableEventTarget.dispatchEvent(_event);
573
502
  dragstartTriggered = false;
574
503
  }
575
-
576
504
  canvas.removeEventListener('pointermove', handlePointermove);
577
505
  };
578
-
579
506
  target.addEventListener('pointerup', stopDragging, {
580
507
  once: true
581
508
  });
@@ -584,14 +511,12 @@ var DragndropPlugin = /*#__PURE__*/function () {
584
511
  });
585
512
  }
586
513
  };
587
-
588
514
  renderingService.hooks.init.tapPromise(DragndropPlugin.tag, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
589
515
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
590
516
  while (1) {
591
517
  switch (_context2.prev = _context2.next) {
592
518
  case 0:
593
519
  canvas.addEventListener('pointerdown', handlePointerdown);
594
-
595
520
  case 1:
596
521
  case "end":
597
522
  return _context2.stop();
@@ -603,30 +528,24 @@ var DragndropPlugin = /*#__PURE__*/function () {
603
528
  canvas.removeEventListener('pointerdown', handlePointerdown);
604
529
  });
605
530
  };
606
-
607
531
  return DragndropPlugin;
608
532
  }();
609
533
  DragndropPlugin.tag = 'Dragndrop';
610
534
 
611
535
  var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
612
536
  _inheritsLoose(Plugin, _AbstractRendererPlug);
613
-
614
537
  function Plugin(options) {
615
538
  var _this;
616
-
617
539
  if (options === void 0) {
618
540
  options = {};
619
541
  }
620
-
621
542
  _this = _AbstractRendererPlug.call(this) || this;
622
543
  _this.options = void 0;
623
544
  _this.name = 'dragndrop';
624
545
  _this.options = options;
625
546
  return _this;
626
547
  }
627
-
628
548
  var _proto = Plugin.prototype;
629
-
630
549
  _proto.init = function init() {
631
550
  this.addRenderingPlugin(new DragndropPlugin(_extends({
632
551
  overlap: 'pointer',
@@ -636,11 +555,9 @@ var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
636
555
  dragstartTimeThreshold: 0
637
556
  }, this.options)));
638
557
  };
639
-
640
558
  _proto.destroy = function destroy() {
641
559
  this.removeAllRenderingPlugins();
642
560
  };
643
-
644
561
  return Plugin;
645
562
  }(gLite.AbstractRendererPlugin);
646
563