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-viewer v8.8.2
2
+ * bpmn-js - bpmn-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
  });
@@ -7041,22 +7042,26 @@
7041
7042
 
7042
7043
  Overlays.prototype._updateOverlayVisibilty = function(overlay, viewbox) {
7043
7044
  var show = overlay.show,
7045
+ plane = overlay.plane,
7044
7046
  minZoom = show && show.minZoom,
7045
7047
  maxZoom = show && show.maxZoom,
7046
7048
  htmlContainer = overlay.htmlContainer,
7049
+ activePlane = this._canvas.getActivePlane(),
7047
7050
  visible = true;
7048
7051
 
7049
- if (show) {
7052
+ if (plane !== activePlane) {
7053
+ visible = false;
7054
+ } else if (show) {
7050
7055
  if (
7051
7056
  (isDefined(minZoom) && minZoom > viewbox.scale) ||
7052
7057
  (isDefined(maxZoom) && maxZoom < viewbox.scale)
7053
7058
  ) {
7054
7059
  visible = false;
7055
7060
  }
7056
-
7057
- setVisible(htmlContainer, visible);
7058
7061
  }
7059
7062
 
7063
+ setVisible(htmlContainer, visible);
7064
+
7060
7065
  this._updateOverlayScale(overlay, viewbox);
7061
7066
  };
7062
7067
 
@@ -7589,7 +7594,7 @@
7589
7594
  return true;
7590
7595
  };
7591
7596
 
7592
- DefaultRenderer.prototype.drawShape = function drawShape(visuals, element) {
7597
+ DefaultRenderer.prototype.drawShape = function drawShape(visuals, element, attrs) {
7593
7598
  var rect = create$1('rect');
7594
7599
 
7595
7600
  attr$1(rect, {
@@ -7600,9 +7605,9 @@
7600
7605
  });
7601
7606
 
7602
7607
  if (isFrameElement(element)) {
7603
- attr$1(rect, this.FRAME_STYLE);
7608
+ attr$1(rect, assign({}, this.FRAME_STYLE, attrs || {}));
7604
7609
  } else {
7605
- attr$1(rect, this.SHAPE_STYLE);
7610
+ attr$1(rect, assign({}, this.SHAPE_STYLE, attrs || {}));
7606
7611
  }
7607
7612
 
7608
7613
  append(visuals, rect);
@@ -7610,9 +7615,9 @@
7610
7615
  return rect;
7611
7616
  };
7612
7617
 
7613
- DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection) {
7618
+ DefaultRenderer.prototype.drawConnection = function drawConnection(visuals, connection, attrs) {
7614
7619
 
7615
- var line = createLine(connection.waypoints, this.CONNECTION_STYLE);
7620
+ var line = createLine(connection.waypoints, assign({}, this.CONNECTION_STYLE, attrs || {}));
7616
7621
  append(visuals, line);
7617
7622
 
7618
7623
  return line;
@@ -7866,6 +7871,10 @@
7866
7871
  var BASE_LAYER = 'base';
7867
7872
  var HIDDEN_MARKER = 'djs-element-hidden';
7868
7873
 
7874
+ // render plane contents behind utility layers
7875
+ var PLANE_LAYER_INDEX = 0;
7876
+ var UTILITY_LAYER_INDEX = 1;
7877
+
7869
7878
 
7870
7879
  var REQUIRED_MODEL_ATTRS = {
7871
7880
  shape: [ 'x', 'y', 'width', 'height' ],
@@ -7964,7 +7973,8 @@
7964
7973
  'connection.added',
7965
7974
  'shape.removed',
7966
7975
  'connection.removed',
7967
- 'elements.changed'
7976
+ 'elements.changed',
7977
+ 'plane.set'
7968
7978
  ], function() {
7969
7979
  delete this._cachedViewbox;
7970
7980
  }, this);
@@ -8025,7 +8035,7 @@
8025
8035
  * @returns {SVGElement}
8026
8036
  */
8027
8037
  Canvas.prototype.getDefaultLayer = function() {
8028
- return this.getLayer(BASE_LAYER);
8038
+ return this.getLayer(BASE_LAYER, PLANE_LAYER_INDEX);
8029
8039
  };
8030
8040
 
8031
8041
  /**
@@ -8074,8 +8084,8 @@
8074
8084
  */
8075
8085
  Canvas.prototype._createLayer = function(name, index) {
8076
8086
 
8077
- if (!index) {
8078
- index = 0;
8087
+ if (typeof index === 'undefined') {
8088
+ index = UTILITY_LAYER_INDEX;
8079
8089
  }
8080
8090
 
8081
8091
  var childIndex = reduce(this._layers, function(childIndex, layer) {
@@ -8105,9 +8115,7 @@
8105
8115
  throw new Error('must specify a name');
8106
8116
  }
8107
8117
 
8108
- var plane = this._planes[name];
8109
-
8110
- return plane;
8118
+ return this._planes[name];
8111
8119
  };
8112
8120
 
8113
8121
  /**
@@ -8136,7 +8144,7 @@
8136
8144
  };
8137
8145
  }
8138
8146
 
8139
- var svgLayer = this.getLayer(name);
8147
+ var svgLayer = this.getLayer(name, PLANE_LAYER_INDEX);
8140
8148
  classes$1(svgLayer).add(HIDDEN_MARKER);
8141
8149
 
8142
8150
  var plane = this._planes[name] = {
@@ -8745,9 +8753,10 @@
8745
8753
  if (!box) {
8746
8754
 
8747
8755
  // compute the inner box based on the
8748
- // diagrams default layer. This allows us to exclude
8756
+ // diagrams active plane. This allows us to exclude
8749
8757
  // external components, such as overlays
8750
- innerBox = this.getDefaultLayer().getBBox();
8758
+
8759
+ innerBox = (this._activePlane && this._activePlane.layer.getBBox()) || {};
8751
8760
 
8752
8761
  transform = transform$1(viewport);
8753
8762
  matrix = transform ? transform.matrix : createMatrix();
@@ -8763,10 +8772,10 @@
8763
8772
  height: outerBox.height / scale,
8764
8773
  scale: scale,
8765
8774
  inner: {
8766
- width: innerBox.width,
8767
- height: innerBox.height,
8768
- x: innerBox.x,
8769
- y: innerBox.y
8775
+ width: innerBox.width || 0,
8776
+ height: innerBox.height || 0,
8777
+ x: innerBox.x || 0,
8778
+ y: innerBox.y || 0
8770
8779
  },
8771
8780
  outer: outerBox
8772
8781
  };