@antv/g-plugin-dragndrop 1.6.47 → 1.6.48
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 +179 -301
- package/dist/index.js +179 -301
- package/dist/index.umd.js +179 -301
- package/dist/index.umd.min.js +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,27 +1,6 @@
|
|
|
1
1
|
import { AbstractRendererPlugin } from '@antv/g-lite';
|
|
2
2
|
import { distanceSquareRoot } from '@antv/util';
|
|
3
3
|
|
|
4
|
-
function ownKeys(object, enumerableOnly) {
|
|
5
|
-
var keys = Object.keys(object);
|
|
6
|
-
if (Object.getOwnPropertySymbols) {
|
|
7
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
8
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
9
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
10
|
-
})), keys.push.apply(keys, symbols);
|
|
11
|
-
}
|
|
12
|
-
return keys;
|
|
13
|
-
}
|
|
14
|
-
function _objectSpread2(target) {
|
|
15
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
17
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
18
|
-
_defineProperty(target, key, source[key]);
|
|
19
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
20
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return target;
|
|
24
|
-
}
|
|
25
4
|
function _regeneratorRuntime() {
|
|
26
5
|
_regeneratorRuntime = function () {
|
|
27
6
|
return exports;
|
|
@@ -353,63 +332,24 @@ function _asyncToGenerator(fn) {
|
|
|
353
332
|
});
|
|
354
333
|
};
|
|
355
334
|
}
|
|
356
|
-
function
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
descriptor.configurable = true;
|
|
366
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
367
|
-
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
371
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
372
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
373
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
374
|
-
writable: false
|
|
375
|
-
});
|
|
376
|
-
return Constructor;
|
|
377
|
-
}
|
|
378
|
-
function _defineProperty(obj, key, value) {
|
|
379
|
-
key = _toPropertyKey(key);
|
|
380
|
-
if (key in obj) {
|
|
381
|
-
Object.defineProperty(obj, key, {
|
|
382
|
-
value: value,
|
|
383
|
-
enumerable: true,
|
|
384
|
-
configurable: true,
|
|
385
|
-
writable: true
|
|
386
|
-
});
|
|
387
|
-
} else {
|
|
388
|
-
obj[key] = value;
|
|
389
|
-
}
|
|
390
|
-
return obj;
|
|
391
|
-
}
|
|
392
|
-
function _inherits(subClass, superClass) {
|
|
393
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
394
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
395
|
-
}
|
|
396
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
397
|
-
constructor: {
|
|
398
|
-
value: subClass,
|
|
399
|
-
writable: true,
|
|
400
|
-
configurable: true
|
|
335
|
+
function _extends() {
|
|
336
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
337
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
338
|
+
var source = arguments[i];
|
|
339
|
+
for (var key in source) {
|
|
340
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
341
|
+
target[key] = source[key];
|
|
342
|
+
}
|
|
343
|
+
}
|
|
401
344
|
}
|
|
402
|
-
|
|
403
|
-
Object.defineProperty(subClass, "prototype", {
|
|
404
|
-
writable: false
|
|
405
|
-
});
|
|
406
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
407
|
-
}
|
|
408
|
-
function _getPrototypeOf(o) {
|
|
409
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
410
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
345
|
+
return target;
|
|
411
346
|
};
|
|
412
|
-
return
|
|
347
|
+
return _extends.apply(this, arguments);
|
|
348
|
+
}
|
|
349
|
+
function _inheritsLoose(subClass, superClass) {
|
|
350
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
351
|
+
subClass.prototype.constructor = subClass;
|
|
352
|
+
_setPrototypeOf(subClass, superClass);
|
|
413
353
|
}
|
|
414
354
|
function _setPrototypeOf(o, p) {
|
|
415
355
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
@@ -418,254 +358,192 @@ function _setPrototypeOf(o, p) {
|
|
|
418
358
|
};
|
|
419
359
|
return _setPrototypeOf(o, p);
|
|
420
360
|
}
|
|
421
|
-
function _isNativeReflectConstruct() {
|
|
422
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
423
|
-
if (Reflect.construct.sham) return false;
|
|
424
|
-
if (typeof Proxy === "function") return true;
|
|
425
|
-
try {
|
|
426
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
427
|
-
return true;
|
|
428
|
-
} catch (e) {
|
|
429
|
-
return false;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
function _assertThisInitialized(self) {
|
|
433
|
-
if (self === void 0) {
|
|
434
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
435
|
-
}
|
|
436
|
-
return self;
|
|
437
|
-
}
|
|
438
|
-
function _possibleConstructorReturn(self, call) {
|
|
439
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
440
|
-
return call;
|
|
441
|
-
} else if (call !== void 0) {
|
|
442
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
443
|
-
}
|
|
444
|
-
return _assertThisInitialized(self);
|
|
445
|
-
}
|
|
446
|
-
function _createSuper(Derived) {
|
|
447
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
448
|
-
return function _createSuperInternal() {
|
|
449
|
-
var Super = _getPrototypeOf(Derived),
|
|
450
|
-
result;
|
|
451
|
-
if (hasNativeReflectConstruct) {
|
|
452
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
453
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
454
|
-
} else {
|
|
455
|
-
result = Super.apply(this, arguments);
|
|
456
|
-
}
|
|
457
|
-
return _possibleConstructorReturn(this, result);
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
function _toPrimitive(input, hint) {
|
|
461
|
-
if (typeof input !== "object" || input === null) return input;
|
|
462
|
-
var prim = input[Symbol.toPrimitive];
|
|
463
|
-
if (prim !== undefined) {
|
|
464
|
-
var res = prim.call(input, hint || "default");
|
|
465
|
-
if (typeof res !== "object") return res;
|
|
466
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
467
|
-
}
|
|
468
|
-
return (hint === "string" ? String : Number)(input);
|
|
469
|
-
}
|
|
470
|
-
function _toPropertyKey(arg) {
|
|
471
|
-
var key = _toPrimitive(arg, "string");
|
|
472
|
-
return typeof key === "symbol" ? key : String(key);
|
|
473
|
-
}
|
|
474
361
|
|
|
475
362
|
var DragndropPlugin = /*#__PURE__*/function () {
|
|
476
363
|
function DragndropPlugin(dragndropPluginOptions) {
|
|
477
|
-
_classCallCheck(this, DragndropPlugin);
|
|
478
364
|
this.dragndropPluginOptions = void 0;
|
|
479
365
|
this.dragndropPluginOptions = dragndropPluginOptions;
|
|
480
366
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
var
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
var
|
|
506
|
-
var
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
367
|
+
var _proto = DragndropPlugin.prototype;
|
|
368
|
+
_proto.apply = function apply(context) {
|
|
369
|
+
var _this = this;
|
|
370
|
+
var renderingService = context.renderingService,
|
|
371
|
+
renderingContext = context.renderingContext;
|
|
372
|
+
var document = renderingContext.root.ownerDocument;
|
|
373
|
+
// TODO: should we add an option like `draggable` to Canvas
|
|
374
|
+
var canvas = document.defaultView;
|
|
375
|
+
var handlePointerdown = function handlePointerdown(event) {
|
|
376
|
+
var target = event.target;
|
|
377
|
+
var isDocument = target === document;
|
|
378
|
+
var draggableEventTarget = isDocument && _this.dragndropPluginOptions.isDocumentDraggable ? document : target.closest && target.closest('[draggable=true]');
|
|
379
|
+
// `draggable` may be set on ancestor nodes:
|
|
380
|
+
// @see https://github.com/antvis/G/issues/1088
|
|
381
|
+
if (draggableEventTarget) {
|
|
382
|
+
// delay triggering dragstart event
|
|
383
|
+
var dragstartTriggered = false;
|
|
384
|
+
var dragstartTimeStamp = event.timeStamp;
|
|
385
|
+
var dragstartClientCoordinates = [event.clientX, event.clientY];
|
|
386
|
+
var currentDroppable = null;
|
|
387
|
+
var lastDragClientCoordinates = [event.clientX, event.clientY];
|
|
388
|
+
// @ts-ignore
|
|
389
|
+
// eslint-disable-next-line no-inner-declarations
|
|
390
|
+
var handlePointermove = /*#__PURE__*/function () {
|
|
391
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
392
|
+
var timeElapsed, distanceMoved, point, elementsBelow, elementBelow, droppableBelow;
|
|
393
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
394
|
+
while (1) switch (_context.prev = _context.next) {
|
|
395
|
+
case 0:
|
|
396
|
+
if (dragstartTriggered) {
|
|
397
|
+
_context.next = 8;
|
|
398
|
+
break;
|
|
399
|
+
}
|
|
400
|
+
timeElapsed = event.timeStamp - dragstartTimeStamp;
|
|
401
|
+
distanceMoved = distanceSquareRoot([event.clientX, event.clientY], dragstartClientCoordinates); // check thresholds
|
|
402
|
+
if (!(timeElapsed <= _this.dragndropPluginOptions.dragstartTimeThreshold || distanceMoved <= _this.dragndropPluginOptions.dragstartDistanceThreshold)) {
|
|
403
|
+
_context.next = 5;
|
|
404
|
+
break;
|
|
405
|
+
}
|
|
406
|
+
return _context.abrupt("return");
|
|
407
|
+
case 5:
|
|
408
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragstart_event
|
|
409
|
+
event.type = 'dragstart';
|
|
410
|
+
draggableEventTarget.dispatchEvent(event);
|
|
411
|
+
dragstartTriggered = true;
|
|
412
|
+
case 8:
|
|
413
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/drag_event
|
|
414
|
+
event.type = 'drag';
|
|
415
|
+
// @ts-ignore
|
|
416
|
+
event.dx = event.clientX - lastDragClientCoordinates[0];
|
|
417
|
+
// @ts-ignore
|
|
418
|
+
event.dy = event.clientY - lastDragClientCoordinates[1];
|
|
419
|
+
draggableEventTarget.dispatchEvent(event);
|
|
420
|
+
lastDragClientCoordinates = [event.clientX, event.clientY];
|
|
421
|
+
if (isDocument) {
|
|
422
|
+
_context.next = 21;
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
point = _this.dragndropPluginOptions.overlap === 'pointer' ? [event.canvasX, event.canvasY] : target.getBounds().center;
|
|
426
|
+
_context.next = 17;
|
|
427
|
+
return document.elementsFromPoint(point[0], point[1]);
|
|
428
|
+
case 17:
|
|
429
|
+
elementsBelow = _context.sent;
|
|
430
|
+
// prevent from picking the dragging element
|
|
431
|
+
elementBelow = elementsBelow[elementsBelow.indexOf(target) + 1];
|
|
432
|
+
droppableBelow = (elementBelow === null || elementBelow === void 0 ? void 0 : elementBelow.closest('[droppable=true]')) || (_this.dragndropPluginOptions.isDocumentDroppable ? document : null);
|
|
433
|
+
if (currentDroppable !== droppableBelow) {
|
|
434
|
+
if (currentDroppable) {
|
|
435
|
+
// null when we were not over a droppable before this event
|
|
436
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragleave_event
|
|
437
|
+
event.type = 'dragleave';
|
|
438
|
+
event.target = currentDroppable;
|
|
439
|
+
currentDroppable.dispatchEvent(event);
|
|
520
440
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
dragstartTriggered = true;
|
|
527
|
-
case 8:
|
|
528
|
-
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/drag_event
|
|
529
|
-
event.type = 'drag';
|
|
530
|
-
// @ts-ignore
|
|
531
|
-
event.dx = event.clientX - lastDragClientCoordinates[0];
|
|
532
|
-
// @ts-ignore
|
|
533
|
-
event.dy = event.clientY - lastDragClientCoordinates[1];
|
|
534
|
-
draggableEventTarget.dispatchEvent(event);
|
|
535
|
-
lastDragClientCoordinates = [event.clientX, event.clientY];
|
|
536
|
-
if (isDocument) {
|
|
537
|
-
_context.next = 21;
|
|
538
|
-
break;
|
|
441
|
+
if (droppableBelow) {
|
|
442
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragleave_event
|
|
443
|
+
event.type = 'dragenter';
|
|
444
|
+
event.target = droppableBelow;
|
|
445
|
+
droppableBelow.dispatchEvent(event);
|
|
539
446
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
droppableBelow = (elementBelow === null || elementBelow === void 0 ? void 0 : elementBelow.closest('[droppable=true]')) || (_this.dragndropPluginOptions.isDocumentDroppable ? document : null);
|
|
548
|
-
if (currentDroppable !== droppableBelow) {
|
|
549
|
-
if (currentDroppable) {
|
|
550
|
-
// null when we were not over a droppable before this event
|
|
551
|
-
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragleave_event
|
|
552
|
-
event.type = 'dragleave';
|
|
553
|
-
event.target = currentDroppable;
|
|
554
|
-
currentDroppable.dispatchEvent(event);
|
|
555
|
-
}
|
|
556
|
-
if (droppableBelow) {
|
|
557
|
-
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragleave_event
|
|
558
|
-
event.type = 'dragenter';
|
|
559
|
-
event.target = droppableBelow;
|
|
560
|
-
droppableBelow.dispatchEvent(event);
|
|
561
|
-
}
|
|
562
|
-
currentDroppable = droppableBelow;
|
|
563
|
-
if (currentDroppable) {
|
|
564
|
-
// null if we're not coming over a droppable now
|
|
565
|
-
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragover_event
|
|
566
|
-
event.type = 'dragover';
|
|
567
|
-
event.target = currentDroppable;
|
|
568
|
-
currentDroppable.dispatchEvent(event);
|
|
569
|
-
}
|
|
447
|
+
currentDroppable = droppableBelow;
|
|
448
|
+
if (currentDroppable) {
|
|
449
|
+
// null if we're not coming over a droppable now
|
|
450
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragover_event
|
|
451
|
+
event.type = 'dragover';
|
|
452
|
+
event.target = currentDroppable;
|
|
453
|
+
currentDroppable.dispatchEvent(event);
|
|
570
454
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}, _callee);
|
|
576
|
-
}));
|
|
577
|
-
return function handlePointermove(_x) {
|
|
578
|
-
return _ref.apply(this, arguments);
|
|
579
|
-
};
|
|
580
|
-
}();
|
|
581
|
-
canvas.addEventListener('pointermove', handlePointermove);
|
|
582
|
-
var stopDragging = function stopDragging(originalPointerUpEvent) {
|
|
583
|
-
if (dragstartTriggered) {
|
|
584
|
-
// prevent click event being triggerd
|
|
585
|
-
// @see https://github.com/antvis/G/issues/1091
|
|
586
|
-
originalPointerUpEvent.detail = {
|
|
587
|
-
preventClick: true
|
|
588
|
-
};
|
|
589
|
-
// clone event first
|
|
590
|
-
var _event = originalPointerUpEvent.clone();
|
|
591
|
-
// drop should fire before dragend
|
|
592
|
-
// @see https://javascript.tutorialink.com/is-there-a-defined-ordering-between-dragend-and-drop-events/
|
|
593
|
-
if (currentDroppable) {
|
|
594
|
-
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/drop_event
|
|
595
|
-
_event.type = 'drop';
|
|
596
|
-
_event.target = currentDroppable;
|
|
597
|
-
currentDroppable.dispatchEvent(_event);
|
|
455
|
+
}
|
|
456
|
+
case 21:
|
|
457
|
+
case "end":
|
|
458
|
+
return _context.stop();
|
|
598
459
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
}
|
|
604
|
-
canvas.removeEventListener('pointermove', handlePointermove);
|
|
460
|
+
}, _callee);
|
|
461
|
+
}));
|
|
462
|
+
return function handlePointermove(_x) {
|
|
463
|
+
return _ref.apply(this, arguments);
|
|
605
464
|
};
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
465
|
+
}();
|
|
466
|
+
canvas.addEventListener('pointermove', handlePointermove);
|
|
467
|
+
var stopDragging = function stopDragging(originalPointerUpEvent) {
|
|
468
|
+
if (dragstartTriggered) {
|
|
469
|
+
// prevent click event being triggerd
|
|
470
|
+
// @see https://github.com/antvis/G/issues/1091
|
|
471
|
+
originalPointerUpEvent.detail = {
|
|
472
|
+
preventClick: true
|
|
473
|
+
};
|
|
474
|
+
// clone event first
|
|
475
|
+
var _event = originalPointerUpEvent.clone();
|
|
476
|
+
// drop should fire before dragend
|
|
477
|
+
// @see https://javascript.tutorialink.com/is-there-a-defined-ordering-between-dragend-and-drop-events/
|
|
478
|
+
if (currentDroppable) {
|
|
479
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/drop_event
|
|
480
|
+
_event.type = 'drop';
|
|
481
|
+
_event.target = currentDroppable;
|
|
482
|
+
currentDroppable.dispatchEvent(_event);
|
|
483
|
+
}
|
|
484
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragend_event
|
|
485
|
+
_event.type = 'dragend';
|
|
486
|
+
draggableEventTarget.dispatchEvent(_event);
|
|
487
|
+
dragstartTriggered = false;
|
|
622
488
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
489
|
+
canvas.removeEventListener('pointermove', handlePointermove);
|
|
490
|
+
};
|
|
491
|
+
target.addEventListener('pointerup', stopDragging, {
|
|
492
|
+
once: true
|
|
493
|
+
});
|
|
494
|
+
target.addEventListener('pointerupoutside', stopDragging, {
|
|
495
|
+
once: true
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
renderingService.hooks.init.tapPromise(DragndropPlugin.tag, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
500
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
501
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
502
|
+
case 0:
|
|
503
|
+
canvas.addEventListener('pointerdown', handlePointerdown);
|
|
504
|
+
case 1:
|
|
505
|
+
case "end":
|
|
506
|
+
return _context2.stop();
|
|
507
|
+
}
|
|
508
|
+
}, _callee2);
|
|
509
|
+
})));
|
|
510
|
+
renderingService.hooks.destroy.tap(DragndropPlugin.tag, function () {
|
|
511
|
+
canvas.removeEventListener('pointerdown', handlePointerdown);
|
|
512
|
+
});
|
|
513
|
+
};
|
|
630
514
|
return DragndropPlugin;
|
|
631
515
|
}();
|
|
632
516
|
DragndropPlugin.tag = 'Dragndrop';
|
|
633
517
|
|
|
634
518
|
var Plugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
function Plugin() {
|
|
519
|
+
_inheritsLoose(Plugin, _AbstractRendererPlug);
|
|
520
|
+
function Plugin(options) {
|
|
638
521
|
var _this;
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
522
|
+
if (options === void 0) {
|
|
523
|
+
options = {};
|
|
524
|
+
}
|
|
525
|
+
_this = _AbstractRendererPlug.call(this) || this;
|
|
642
526
|
_this.options = void 0;
|
|
643
527
|
_this.name = 'dragndrop';
|
|
644
528
|
_this.options = options;
|
|
645
529
|
return _this;
|
|
646
530
|
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}, {
|
|
664
|
-
key: "setOptions",
|
|
665
|
-
value: function setOptions(options) {
|
|
666
|
-
Object.assign(this.plugins[0].dragndropPluginOptions, options);
|
|
667
|
-
}
|
|
668
|
-
}]);
|
|
531
|
+
var _proto = Plugin.prototype;
|
|
532
|
+
_proto.init = function init() {
|
|
533
|
+
this.addRenderingPlugin(new DragndropPlugin(_extends({
|
|
534
|
+
overlap: 'pointer',
|
|
535
|
+
isDocumentDraggable: false,
|
|
536
|
+
isDocumentDroppable: false,
|
|
537
|
+
dragstartDistanceThreshold: 0,
|
|
538
|
+
dragstartTimeThreshold: 0
|
|
539
|
+
}, this.options)));
|
|
540
|
+
};
|
|
541
|
+
_proto.destroy = function destroy() {
|
|
542
|
+
this.removeAllRenderingPlugins();
|
|
543
|
+
};
|
|
544
|
+
_proto.setOptions = function setOptions(options) {
|
|
545
|
+
Object.assign(this.plugins[0].dragndropPluginOptions, options);
|
|
546
|
+
};
|
|
669
547
|
return Plugin;
|
|
670
548
|
}(AbstractRendererPlugin);
|
|
671
549
|
|