bpmn-js 8.8.2 → 8.8.3

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 v8.8.2
2
+ * bpmn-js - bpmn-navigated-viewer v8.8.3
3
3
  *
4
4
  * Copyright (c) 2014-present, camunda Services GmbH
5
5
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Source Code: https://github.com/bpmn-io/bpmn-js
10
10
  *
11
- * Date: 2021-10-20
11
+ * Date: 2021-12-03
12
12
  */
13
13
  (function (global, factory) {
14
14
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -389,13 +389,14 @@
389
389
  eventBus.on([ 'render.shape', 'render.connection' ], renderPriority, function(evt, context) {
390
390
  var type = evt.type,
391
391
  element = context.element,
392
- visuals = context.gfx;
392
+ visuals = context.gfx,
393
+ attrs = context.attrs;
393
394
 
394
395
  if (self.canRender(element)) {
395
396
  if (type === 'render.shape') {
396
- return self.drawShape(visuals, element);
397
+ return self.drawShape(visuals, element, attrs);
397
398
  } else {
398
- return self.drawConnection(visuals, element);
399
+ return self.drawConnection(visuals, element, attrs);
399
400
  }
400
401
  }
401
402
  });
@@ -7058,22 +7059,26 @@
7058
7059
 
7059
7060
  Overlays.prototype._updateOverlayVisibilty = function(overlay, viewbox) {
7060
7061
  var show = overlay.show,
7062
+ plane = overlay.plane,
7061
7063
  minZoom = show && show.minZoom,
7062
7064
  maxZoom = show && show.maxZoom,
7063
7065
  htmlContainer = overlay.htmlContainer,
7066
+ activePlane = this._canvas.getActivePlane(),
7064
7067
  visible = true;
7065
7068
 
7066
- if (show) {
7069
+ if (plane !== activePlane) {
7070
+ visible = false;
7071
+ } else if (show) {
7067
7072
  if (
7068
7073
  (isDefined(minZoom) && minZoom > viewbox.scale) ||
7069
7074
  (isDefined(maxZoom) && maxZoom < viewbox.scale)
7070
7075
  ) {
7071
7076
  visible = false;
7072
7077
  }
7073
-
7074
- setVisible(htmlContainer, visible);
7075
7078
  }
7076
7079
 
7080
+ setVisible(htmlContainer, visible);
7081
+
7077
7082
  this._updateOverlayScale(overlay, viewbox);
7078
7083
  };
7079
7084
 
@@ -7606,7 +7611,7 @@
7606
7611
  return true;
7607
7612
  };
7608
7613
 
7609
- DefaultRenderer.prototype.drawShape = function drawShape(visuals, element) {
7614
+ DefaultRenderer.prototype.drawShape = function drawShape(visuals, element, attrs) {
7610
7615
  var rect = create$1('rect');
7611
7616
 
7612
7617
  attr$1(rect, {
@@ -7617,9 +7622,9 @@
7617
7622
  });
7618
7623
 
7619
7624
  if (isFrameElement(element)) {
7620
- attr$1(rect, this.FRAME_STYLE);
7625
+ attr$1(rect, assign({}, this.FRAME_STYLE, attrs || {}));
7621
7626
  } else {
7622
- attr$1(rect, this.SHAPE_STYLE);
7627
+ attr$1(rect, assign({}, this.SHAPE_STYLE, attrs || {}));
7623
7628
  }
7624
7629
 
7625
7630
  append(visuals, rect);
@@ -7627,9 +7632,9 @@
7627
7632
  return rect;
7628
7633
  };
7629
7634
 
7630
- DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection) {
7635
+ DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
7631
7636
 
7632
- var line = createLine(connection.waypoints, this.CONNECTION_STYLE);
7637
+ var line = createLine(connection.waypoints, assign({}, this.CONNECTION_STYLE, attrs || {}));
7633
7638
  append(visuals, line);
7634
7639
 
7635
7640
  return line;
@@ -7883,6 +7888,10 @@
7883
7888
  var BASE_LAYER = 'base';
7884
7889
  var HIDDEN_MARKER = 'djs-element-hidden';
7885
7890
 
7891
+ // render plane contents behind utility layers
7892
+ var PLANE_LAYER_INDEX = 0;
7893
+ var UTILITY_LAYER_INDEX = 1;
7894
+
7886
7895
 
7887
7896
  var REQUIRED_MODEL_ATTRS = {
7888
7897
  shape: [ 'x', 'y', 'width', 'height' ],
@@ -7981,7 +7990,8 @@
7981
7990
  'connection.added',
7982
7991
  'shape.removed',
7983
7992
  'connection.removed',
7984
- 'elements.changed'
7993
+ 'elements.changed',
7994
+ 'plane.set'
7985
7995
  ], function() {
7986
7996
  delete this._cachedViewbox;
7987
7997
  }, this);
@@ -8042,7 +8052,7 @@
8042
8052
  * @returns {SVGElement}
8043
8053
  */
8044
8054
  Canvas.prototype.getDefaultLayer = function() {
8045
- return this.getLayer(BASE_LAYER);
8055
+ return this.getLayer(BASE_LAYER, PLANE_LAYER_INDEX);
8046
8056
  };
8047
8057
 
8048
8058
  /**
@@ -8091,8 +8101,8 @@
8091
8101
  */
8092
8102
  Canvas.prototype._createLayer = function(name, index) {
8093
8103
 
8094
- if (!index) {
8095
- index = 0;
8104
+ if (typeof index === 'undefined') {
8105
+ index = UTILITY_LAYER_INDEX;
8096
8106
  }
8097
8107
 
8098
8108
  var childIndex = reduce(this._layers, function(childIndex, layer) {
@@ -8122,9 +8132,7 @@
8122
8132
  throw new Error('must specify a name');
8123
8133
  }
8124
8134
 
8125
- var plane = this._planes[name];
8126
-
8127
- return plane;
8135
+ return this._planes[name];
8128
8136
  };
8129
8137
 
8130
8138
  /**
@@ -8153,7 +8161,7 @@
8153
8161
  };
8154
8162
  }
8155
8163
 
8156
- var svgLayer = this.getLayer(name);
8164
+ var svgLayer = this.getLayer(name, PLANE_LAYER_INDEX);
8157
8165
  classes$1(svgLayer).add(HIDDEN_MARKER);
8158
8166
 
8159
8167
  var plane = this._planes[name] = {
@@ -8762,9 +8770,10 @@
8762
8770
  if (!box) {
8763
8771
 
8764
8772
  // compute the inner box based on the
8765
- // diagrams default layer. This allows us to exclude
8773
+ // diagrams active plane. This allows us to exclude
8766
8774
  // external components, such as overlays
8767
- innerBox = this.getDefaultLayer().getBBox();
8775
+
8776
+ innerBox = (this._activePlane && this._activePlane.layer.getBBox()) || {};
8768
8777
 
8769
8778
  transform = transform$1(viewport);
8770
8779
  matrix = transform ? transform.matrix : createMatrix();
@@ -8780,10 +8789,10 @@
8780
8789
  height: outerBox.height / scale,
8781
8790
  scale: scale,
8782
8791
  inner: {
8783
- width: innerBox.width,
8784
- height: innerBox.height,
8785
- x: innerBox.x,
8786
- y: innerBox.y
8792
+ width: innerBox.width || 0,
8793
+ height: innerBox.height || 0,
8794
+ x: innerBox.x || 0,
8795
+ y: innerBox.y || 0
8787
8796
  },
8788
8797
  outer: outerBox
8789
8798
  };