diagram-js
Advanced tools
Comparing version 14.5.0 to 14.5.1
@@ -11,5 +11,6 @@ /** | ||
* @param canvas | ||
* @param elementRegistry | ||
* @param eventBus | ||
*/ | ||
constructor(canvas: Canvas, eventBus: EventBus); | ||
constructor(canvas: Canvas, elementRegistry: ElementRegistry, eventBus: EventBus); | ||
@@ -119,2 +120,3 @@ /** | ||
type Canvas = import('../../core/Canvas').default; | ||
type ElementRegistry = import('../../core/ElementRegistry').default; | ||
type EventBus = import('../../core/EventBus').default; | ||
@@ -121,0 +123,0 @@ type ContextPadProvider = import('./ContextPadProvider').default; |
@@ -5,4 +5,3 @@ import { | ||
isArray, | ||
isFunction, | ||
some | ||
isFunction | ||
} from 'min-dash'; | ||
@@ -33,2 +32,3 @@ | ||
* @typedef {import('../../core/Canvas').default} Canvas | ||
* @typedef {import('../../core/ElementRegistry').default} ElementRegistry | ||
* @typedef {import('../../core/EventBus').default} EventBus | ||
@@ -58,7 +58,9 @@ * | ||
* @param {Canvas} canvas | ||
* @param {ElementRegistry} elementRegistry | ||
* @param {EventBus} eventBus | ||
*/ | ||
export default function ContextPad(canvas, eventBus) { | ||
export default function ContextPad(canvas, elementRegistry, eventBus) { | ||
this._canvas = canvas; | ||
this._elementRegistry = elementRegistry; | ||
this._eventBus = eventBus; | ||
@@ -73,2 +75,3 @@ | ||
'canvas', | ||
'elementRegistry', | ||
'eventBus' | ||
@@ -109,14 +112,25 @@ ]; | ||
var currentTarget = current.target; | ||
var { target } = current; | ||
var currentChanged = some( | ||
isArray(currentTarget) ? currentTarget : [ currentTarget ], | ||
function(element) { | ||
return includes(elements, element); | ||
var targets = isArray(target) ? target : [ target ]; | ||
var targetsChanged = targets.filter(function(element) { | ||
return includes(elements, element); | ||
}); | ||
if (targetsChanged.length) { | ||
// (1) close | ||
self.close(); | ||
var targetsNew = targets.filter(function(element) { | ||
return self._elementRegistry.get(element.id); | ||
}); | ||
if (targetsNew.length) { | ||
// (2) re-open with new targets being all previous targets that still | ||
// exist | ||
self._updateAndOpen(targetsNew.length > 1 ? targetsNew : targetsNew[ 0 ]); | ||
} | ||
); | ||
// re-open if elements in current selection changed | ||
if (currentChanged) { | ||
self.open(currentTarget, true); | ||
} | ||
@@ -123,0 +137,0 @@ }); |
{ | ||
"name": "diagram-js", | ||
"version": "14.5.0", | ||
"version": "14.5.1", | ||
"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
1002706
33715