diagram-js
Advanced tools
Comparing version 14.5.2 to 14.5.3
@@ -23,2 +23,6 @@ import { | ||
var MARKERS_HIDDEN = [ | ||
'djs-element-hidden', | ||
'djs-label-hidden' | ||
]; | ||
@@ -136,7 +140,9 @@ /** | ||
this._eventBus.on('canvas.viewbox.changed', () => { | ||
if (this.isOpen()) { | ||
this._updatePosition(); | ||
} | ||
this._updatePosition(); | ||
}); | ||
this._eventBus.on('element.marker.update', function(event) { | ||
self._updateVisibility(); | ||
}); | ||
this._container = this._createContainer(); | ||
@@ -390,2 +396,4 @@ }; | ||
this._updateVisibility(); | ||
this._eventBus.fire('contextPad.open', { current: this._current }); | ||
@@ -532,2 +540,4 @@ }; | ||
this._updatePosition(); | ||
this._eventBus.fire('contextPad.show', { current: this._current }); | ||
@@ -618,2 +628,30 @@ }; | ||
/** | ||
* Update context pad visibility. Hide if any of the target elements is hidden | ||
* using the `djs-element-hidden` or `djs-label-hidden` markers. | ||
*/ | ||
ContextPad.prototype._updateVisibility = function() { | ||
if (!this.isOpen()) { | ||
return; | ||
} | ||
var self = this; | ||
var target = this._current.target; | ||
var targets = isArray(target) ? target : [ target ]; | ||
var isHidden = targets.some(function(target) { | ||
return MARKERS_HIDDEN.some(function(marker) { | ||
return self._canvas.hasMarker(target, marker); | ||
}); | ||
}); | ||
if (isHidden) { | ||
self.hide(); | ||
} else { | ||
self.show(); | ||
} | ||
}; | ||
/** | ||
* Get bounding client rect of target element(s). | ||
@@ -620,0 +658,0 @@ * |
{ | ||
"name": "diagram-js", | ||
"version": "14.5.2", | ||
"version": "14.5.3", | ||
"description": "A toolbox for displaying and modifying diagrams on the web", | ||
@@ -5,0 +5,0 @@ "main": "lib/Diagram.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1003919
33755