bpmn-js 18.32.0 → 18.33.0

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * bpmn-js - bpmn-modeler v18.32.0
2
+ * bpmn-js - bpmn-modeler v18.33.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -27303,12 +27303,17 @@
27303
27303
  /**
27304
27304
  * Move the canvas via mouse.
27305
27305
  *
27306
+ * @param {Object} [config]
27307
+ * @param {boolean} [config.enabled=true] Default enabled state.
27306
27308
  * @param {EventBus} eventBus
27307
27309
  * @param {Canvas} canvas
27308
27310
  */
27309
- function MoveCanvas(eventBus, canvas) {
27311
+ function MoveCanvas(config, eventBus, canvas) {
27312
+
27313
+ config = config || {};
27310
27314
 
27311
27315
  var context;
27316
+ var enabled = config.enabled !== false;
27312
27317
 
27313
27318
  function handleMousedown(event) {
27314
27319
  return handleStart(event.originalEvent);
@@ -27343,7 +27348,7 @@
27343
27348
  context.dragging = true;
27344
27349
 
27345
27350
  if (button === 0) {
27346
- install(eventBus);
27351
+ context.untrap = install(eventBus);
27347
27352
  }
27348
27353
 
27349
27354
  set('grab');
@@ -27355,12 +27360,12 @@
27355
27360
 
27356
27361
  delta$1 = delta(position, lastPosition);
27357
27362
 
27363
+ context.last = position;
27364
+
27358
27365
  canvas.scroll({
27359
27366
  dx: delta$1.x,
27360
27367
  dy: delta$1.y
27361
27368
  });
27362
-
27363
- context.last = position;
27364
27369
  }
27365
27370
 
27366
27371
  // prevent select
@@ -27372,6 +27377,10 @@
27372
27377
  event.unbind(document, 'mousemove', handleMove);
27373
27378
  event.unbind(document, 'mouseup', handleEnd);
27374
27379
 
27380
+ if (!event$1 && context.untrap) {
27381
+ context.untrap();
27382
+ }
27383
+
27375
27384
  context = null;
27376
27385
 
27377
27386
  unset();
@@ -27379,6 +27388,10 @@
27379
27388
 
27380
27389
  function handleStart(event$1) {
27381
27390
 
27391
+ if (!enabled) {
27392
+ return;
27393
+ }
27394
+
27382
27395
  // event is already handled by '.djs-draggable'
27383
27396
  if (closest(event$1.target, '.djs-draggable')) {
27384
27397
  return;
@@ -27407,10 +27420,33 @@
27407
27420
  return !!context;
27408
27421
  };
27409
27422
 
27423
+ /**
27424
+ * Enable or disable canvas movement.
27425
+ *
27426
+ * Disabling movement cancels an ongoing drag.
27427
+ *
27428
+ * @param {boolean} [newEnabled] New enabled state; toggle if omitted.
27429
+ * @return {boolean} The new enabled state.
27430
+ */
27431
+ this.toggle = function(newEnabled) {
27432
+ if (typeof newEnabled === 'undefined') {
27433
+ newEnabled = !enabled;
27434
+ }
27435
+
27436
+ enabled = newEnabled;
27437
+
27438
+ if (!enabled && context) {
27439
+ handleEnd();
27440
+ }
27441
+
27442
+ return enabled;
27443
+ };
27444
+
27410
27445
  }
27411
27446
 
27412
27447
 
27413
27448
  MoveCanvas.$inject = [
27449
+ 'config.moveCanvas',
27414
27450
  'eventBus',
27415
27451
  'canvas'
27416
27452
  ];
@@ -27494,6 +27530,9 @@
27494
27530
  * Mouse wheel zooming / scrolling may be disabled using
27495
27531
  * the {@link toggle(enabled)} method.
27496
27532
  *
27533
+ * Elements marked `.djs-scrollable` and their descendants own wheel events,
27534
+ * including modified wheel events, even at scroll boundaries.
27535
+ *
27497
27536
  * @param {Object} [config]
27498
27537
  * @param {boolean} [config.enabled=true] default enabled state
27499
27538
  * @param {number} [config.scale=.75] scroll sensivity
@@ -27514,16 +27553,7 @@
27514
27553
  this._totalDelta = 0;
27515
27554
  this._scale = config.scale || DEFAULT_SCALE;
27516
27555
 
27517
- var self = this;
27518
-
27519
- eventBus.on('canvas.mouseover', function() {
27520
- self._init(config.enabled !== false);
27521
- });
27522
-
27523
- eventBus.on('canvas.mouseout', function() {
27524
- self._init(false);
27525
- });
27526
-
27556
+ this.toggle(config.enabled !== false);
27527
27557
  }
27528
27558
 
27529
27559
  ZoomScroll.$inject = [
@@ -27569,7 +27599,7 @@
27569
27599
 
27570
27600
  ZoomScroll.prototype._handleWheel = function handleWheel(event) {
27571
27601
 
27572
- if (!this._enabled) {
27602
+ if (!this._enabled || closest(event.target, '.djs-scrollable', true)) {
27573
27603
  return;
27574
27604
  }
27575
27605
 
@@ -27699,11 +27729,6 @@
27699
27729
  return newEnabled;
27700
27730
  };
27701
27731
 
27702
-
27703
- ZoomScroll.prototype._init = function(newEnabled) {
27704
- this.toggle(newEnabled);
27705
- };
27706
-
27707
27732
  /**
27708
27733
  * @type { import('didi').ModuleDeclaration }
27709
27734
  */