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-navigated-viewer v18.32.0
2
+ * bpmn-js - bpmn-navigated-viewer v18.33.0
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -25239,12 +25239,17 @@
25239
25239
  /**
25240
25240
  * Move the canvas via mouse.
25241
25241
  *
25242
+ * @param {Object} [config]
25243
+ * @param {boolean} [config.enabled=true] Default enabled state.
25242
25244
  * @param {EventBus} eventBus
25243
25245
  * @param {Canvas} canvas
25244
25246
  */
25245
- function MoveCanvas(eventBus, canvas) {
25247
+ function MoveCanvas(config, eventBus, canvas) {
25248
+
25249
+ config = config || {};
25246
25250
 
25247
25251
  var context;
25252
+ var enabled = config.enabled !== false;
25248
25253
 
25249
25254
  function handleMousedown(event) {
25250
25255
  return handleStart(event.originalEvent);
@@ -25279,7 +25284,7 @@
25279
25284
  context.dragging = true;
25280
25285
 
25281
25286
  if (button === 0) {
25282
- install(eventBus);
25287
+ context.untrap = install(eventBus);
25283
25288
  }
25284
25289
 
25285
25290
  set('grab');
@@ -25291,12 +25296,12 @@
25291
25296
 
25292
25297
  delta$1 = delta(position, lastPosition);
25293
25298
 
25299
+ context.last = position;
25300
+
25294
25301
  canvas.scroll({
25295
25302
  dx: delta$1.x,
25296
25303
  dy: delta$1.y
25297
25304
  });
25298
-
25299
- context.last = position;
25300
25305
  }
25301
25306
 
25302
25307
  // prevent select
@@ -25308,6 +25313,10 @@
25308
25313
  event.unbind(document, 'mousemove', handleMove);
25309
25314
  event.unbind(document, 'mouseup', handleEnd);
25310
25315
 
25316
+ if (!event$1 && context.untrap) {
25317
+ context.untrap();
25318
+ }
25319
+
25311
25320
  context = null;
25312
25321
 
25313
25322
  unset();
@@ -25315,6 +25324,10 @@
25315
25324
 
25316
25325
  function handleStart(event$1) {
25317
25326
 
25327
+ if (!enabled) {
25328
+ return;
25329
+ }
25330
+
25318
25331
  // event is already handled by '.djs-draggable'
25319
25332
  if (closest(event$1.target, '.djs-draggable')) {
25320
25333
  return;
@@ -25343,10 +25356,33 @@
25343
25356
  return !!context;
25344
25357
  };
25345
25358
 
25359
+ /**
25360
+ * Enable or disable canvas movement.
25361
+ *
25362
+ * Disabling movement cancels an ongoing drag.
25363
+ *
25364
+ * @param {boolean} [newEnabled] New enabled state; toggle if omitted.
25365
+ * @return {boolean} The new enabled state.
25366
+ */
25367
+ this.toggle = function(newEnabled) {
25368
+ if (typeof newEnabled === 'undefined') {
25369
+ newEnabled = !enabled;
25370
+ }
25371
+
25372
+ enabled = newEnabled;
25373
+
25374
+ if (!enabled && context) {
25375
+ handleEnd();
25376
+ }
25377
+
25378
+ return enabled;
25379
+ };
25380
+
25346
25381
  }
25347
25382
 
25348
25383
 
25349
25384
  MoveCanvas.$inject = [
25385
+ 'config.moveCanvas',
25350
25386
  'eventBus',
25351
25387
  'canvas'
25352
25388
  ];
@@ -25430,6 +25466,9 @@
25430
25466
  * Mouse wheel zooming / scrolling may be disabled using
25431
25467
  * the {@link toggle(enabled)} method.
25432
25468
  *
25469
+ * Elements marked `.djs-scrollable` and their descendants own wheel events,
25470
+ * including modified wheel events, even at scroll boundaries.
25471
+ *
25433
25472
  * @param {Object} [config]
25434
25473
  * @param {boolean} [config.enabled=true] default enabled state
25435
25474
  * @param {number} [config.scale=.75] scroll sensivity
@@ -25450,16 +25489,7 @@
25450
25489
  this._totalDelta = 0;
25451
25490
  this._scale = config.scale || DEFAULT_SCALE;
25452
25491
 
25453
- var self = this;
25454
-
25455
- eventBus.on('canvas.mouseover', function() {
25456
- self._init(config.enabled !== false);
25457
- });
25458
-
25459
- eventBus.on('canvas.mouseout', function() {
25460
- self._init(false);
25461
- });
25462
-
25492
+ this.toggle(config.enabled !== false);
25463
25493
  }
25464
25494
 
25465
25495
  ZoomScroll.$inject = [
@@ -25505,7 +25535,7 @@
25505
25535
 
25506
25536
  ZoomScroll.prototype._handleWheel = function handleWheel(event) {
25507
25537
 
25508
- if (!this._enabled) {
25538
+ if (!this._enabled || closest(event.target, '.djs-scrollable', true)) {
25509
25539
  return;
25510
25540
  }
25511
25541
 
@@ -25635,11 +25665,6 @@
25635
25665
  return newEnabled;
25636
25666
  };
25637
25667
 
25638
-
25639
- ZoomScroll.prototype._init = function(newEnabled) {
25640
- this.toggle(newEnabled);
25641
- };
25642
-
25643
25668
  /**
25644
25669
  * @type { import('didi').ModuleDeclaration }
25645
25670
  */