diagram-js
Advanced tools
Comparing version 12.7.0 to 12.7.1
@@ -28,4 +28,14 @@ /** | ||
/** | ||
* Updates the outline of a connection respecting the bounding box of | ||
* the connection and an outline offset. | ||
* Register an outline provider with the given priority. | ||
* | ||
* @param outline | ||
* @param connection | ||
**/ | ||
updateConnectionOutline(outline: SVGElement, connection: Element): void; | ||
/** | ||
* Register an outline provider with the given priority. | ||
* | ||
* @param priority | ||
@@ -32,0 +42,0 @@ * @param provider |
@@ -0,1 +1,3 @@ | ||
import { getBBox } from '../../util/Elements'; | ||
var LOW_PRIORITY = 500; | ||
@@ -78,2 +80,15 @@ | ||
eventBus.on([ 'connection.added', 'connection.changed' ], function(event) { | ||
var element = event.element, | ||
gfx = event.gfx; | ||
var outline = domQuery('.djs-outline', gfx); | ||
if (!outline) { | ||
outline = createOutline(gfx, element); | ||
svgAppend(gfx, outline); | ||
} | ||
self.updateConnectionOutline(outline, element); | ||
}); | ||
} | ||
@@ -111,4 +126,23 @@ | ||
/** | ||
* Updates the outline of a connection respecting the bounding box of | ||
* the connection and an outline offset. | ||
* Register an outline provider with the given priority. | ||
* | ||
* @param {SVGElement} outline | ||
* @param {Element} connection | ||
**/ | ||
Outline.prototype.updateConnectionOutline = function(outline, connection) { | ||
var bbox = getBBox(connection); | ||
svgAttr(outline, { | ||
x: bbox.x - this.offset, | ||
y: bbox.y - this.offset, | ||
width: bbox.width + this.offset * 2, | ||
height: bbox.height + this.offset * 2 | ||
}); | ||
}; | ||
/** | ||
* Register an outline provider with the given priority. | ||
* | ||
* @param {number} priority | ||
@@ -115,0 +149,0 @@ * @param {OutlineProvider} provider |
{ | ||
"name": "diagram-js", | ||
"version": "12.7.0", | ||
"version": "12.7.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
958023
33516