mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-11 03:19:42 +02:00
Merge pull request #720 from paulbland/add-activation-class
Add nested activation classes
This commit is contained in:
@@ -340,7 +340,7 @@ export const draw = function (text, id) {
|
|||||||
activationData.starty = verticalPos - 6
|
activationData.starty = verticalPos - 6
|
||||||
verticalPos += 12
|
verticalPos += 12
|
||||||
}
|
}
|
||||||
svgDraw.drawActivation(diagram, activationData, verticalPos, conf)
|
svgDraw.drawActivation(diagram, activationData, verticalPos, conf, actorActivations(msg.from.actor).length)
|
||||||
|
|
||||||
bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos)
|
bounds.insert(activationData.startx, verticalPos - 10, activationData.stopx, verticalPos)
|
||||||
}
|
}
|
||||||
|
@@ -101,12 +101,12 @@ export const anchorElement = function (elem) {
|
|||||||
* @param bounds - activation box bounds
|
* @param bounds - activation box bounds
|
||||||
* @param verticalPos - precise y cooridnate of bottom activation box edge
|
* @param verticalPos - precise y cooridnate of bottom activation box edge
|
||||||
*/
|
*/
|
||||||
export const drawActivation = function (elem, bounds, verticalPos) {
|
export const drawActivation = function (elem, bounds, verticalPos, conf, actorActivations) {
|
||||||
const rect = getNoteRect()
|
const rect = getNoteRect()
|
||||||
const g = bounds.anchored
|
const g = bounds.anchored
|
||||||
rect.x = bounds.startx
|
rect.x = bounds.startx
|
||||||
rect.y = bounds.starty
|
rect.y = bounds.starty
|
||||||
rect.fill = '#f4f4f4'
|
rect.class = 'activation' + (actorActivations % 3) // Will evaluate to 0, 1 or 2
|
||||||
rect.width = bounds.stopx - bounds.startx
|
rect.width = bounds.stopx - bounds.startx
|
||||||
rect.height = verticalPos - bounds.starty
|
rect.height = verticalPos - bounds.starty
|
||||||
drawRect(g, rect)
|
drawRect(g, rect)
|
||||||
|
@@ -30,6 +30,8 @@ $labelBoxBorderColor: $actorBorder;
|
|||||||
$labelTextColor: $mainContrastColor;
|
$labelTextColor: $mainContrastColor;
|
||||||
$noteBorderColor: $border2;
|
$noteBorderColor: $border2;
|
||||||
$noteBkgColor: #fff5ad;
|
$noteBkgColor: #fff5ad;
|
||||||
|
$activationBorderColor: #666;
|
||||||
|
$activationBkgColor: #f4f4f4;
|
||||||
|
|
||||||
/* Gantt chart variables */
|
/* Gantt chart variables */
|
||||||
|
|
||||||
|
@@ -28,6 +28,8 @@ $labelBoxBorderColor: $actorBorder;
|
|||||||
$labelTextColor: $actorTextColor;
|
$labelTextColor: $actorTextColor;
|
||||||
$noteBorderColor: $border2;
|
$noteBorderColor: $border2;
|
||||||
$noteBkgColor: #fff5ad;
|
$noteBkgColor: #fff5ad;
|
||||||
|
$activationBorderColor: #666;
|
||||||
|
$activationBkgColor: #f4f4f4;
|
||||||
|
|
||||||
/* Gantt chart variables */
|
/* Gantt chart variables */
|
||||||
|
|
||||||
|
@@ -29,6 +29,8 @@ $labelBoxBorderColor: #326932;
|
|||||||
$labelTextColor: $actorTextColor;
|
$labelTextColor: $actorTextColor;
|
||||||
$noteBorderColor: $border2;
|
$noteBorderColor: $border2;
|
||||||
$noteBkgColor: #fff5ad;
|
$noteBkgColor: #fff5ad;
|
||||||
|
$activationBorderColor: #666;
|
||||||
|
$activationBkgColor: #f4f4f4;
|
||||||
|
|
||||||
/* Gantt chart variables */
|
/* Gantt chart variables */
|
||||||
|
|
||||||
|
@@ -33,6 +33,8 @@ $labelBoxBorderColor: $actorBorder;
|
|||||||
$labelTextColor: white;
|
$labelTextColor: white;
|
||||||
$noteBorderColor: darken($note, 60%);
|
$noteBorderColor: darken($note, 60%);
|
||||||
$noteBkgColor: $note;
|
$noteBkgColor: $note;
|
||||||
|
$activationBorderColor: #666;
|
||||||
|
$activationBkgColor: #f4f4f4;
|
||||||
|
|
||||||
/* Gantt chart variables */
|
/* Gantt chart variables */
|
||||||
|
|
||||||
|
@@ -73,3 +73,18 @@ text.actor {
|
|||||||
font-family: 'trebuchet ms', verdana, arial;
|
font-family: 'trebuchet ms', verdana, arial;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.activation0 {
|
||||||
|
fill: $activationBkgColor;
|
||||||
|
stroke: $activationBorderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activation1 {
|
||||||
|
fill: $activationBkgColor;
|
||||||
|
stroke: $activationBorderColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activation2 {
|
||||||
|
fill: $activationBkgColor;
|
||||||
|
stroke: $activationBorderColor;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user