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