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