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