camunda-bpmn-js 5.4.0 → 5.4.2

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.
@@ -10314,6 +10314,7 @@
10314
10314
  * deferUpdate?: boolean;
10315
10315
  * width?: number;
10316
10316
  * height?: number;
10317
+ * autoFocus?: boolean;
10317
10318
  * } } CanvasConfig
10318
10319
  * @typedef { {
10319
10320
  * group: SVGElement;
@@ -10500,18 +10501,20 @@
10500
10501
 
10501
10502
  attr(svg, 'tabindex', 0);
10502
10503
 
10503
- eventBus.on('element.hover', () => {
10504
+ config.autoFocus && eventBus.on('element.hover', () => {
10504
10505
  this.restoreFocus();
10505
10506
  });
10506
10507
 
10508
+ eventBus.on('element.mousedown', 500, (event) => {
10509
+ this.focus();
10510
+ });
10511
+
10507
10512
  svg.addEventListener('focusin', () => {
10508
- this._focused = true;
10509
- eventBus.fire('canvas.focus.changed', { focused: true });
10513
+ this._setFocused(true);
10510
10514
  });
10511
10515
 
10512
10516
  svg.addEventListener('focusout', () => {
10513
- this._focused = false;
10514
- eventBus.fire('canvas.focus.changed', { focused: false });
10517
+ this._setFocused(false);
10515
10518
  });
10516
10519
 
10517
10520
  append(container, svg);
@@ -10581,6 +10584,17 @@
10581
10584
  delete this._viewport;
10582
10585
  };
10583
10586
 
10587
+ Canvas.prototype._setFocused = function(focused) {
10588
+
10589
+ if (focused == this._focused) {
10590
+ return;
10591
+ }
10592
+
10593
+ this._focused = focused;
10594
+
10595
+ this._eventBus.fire('canvas.focus.changed', { focused });
10596
+ };
10597
+
10584
10598
  Canvas.prototype._clear = function() {
10585
10599
 
10586
10600
  const allElements = this._elementRegistry.getAll();
@@ -10605,10 +10619,12 @@
10605
10619
  };
10606
10620
 
10607
10621
  /**
10608
- * Sets focus on the canvas SVG element.
10609
- */
10622
+ * Sets focus on the canvas SVG element.
10623
+ */
10610
10624
  Canvas.prototype.focus = function() {
10611
10625
  this._svg.focus({ preventScroll: true });
10626
+
10627
+ this._setFocused(true);
10612
10628
  };
10613
10629
 
10614
10630
  /**