Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 37 additions & 27 deletions src/js/structurizr-diagram.js
Original file line number Diff line number Diff line change
Expand Up @@ -5204,8 +5204,12 @@ structurizr.ui.Diagram = function(id, diagramIsEditable, constructionCompleteCal

this.stepBackwardInAnimation = function() {
if (this.currentViewIsDynamic()) {
if (this.animationStarted()) {

if (!this.animationStarted()) {
this.startAnimation(false);
animationIndex = linesToAnimate.length - 1;
}
else
{
if (animationIndex > 0) {
animationIndex--;

Expand All @@ -5223,37 +5227,43 @@ structurizr.ui.Diagram = function(id, diagramIsEditable, constructionCompleteCal
animationIndex++;
}
}
}

if (animationIndex >= 0) {
this.continueAnimation(false);
} else {
this.stopAnimation();
}
if (animationIndex >= 0) {
this.continueAnimation(false);
} else {
this.stopAnimation();
}
} else if (this.currentViewHasAnimation()) {
if (this.animationStarted()) {
if (animationIndex === 1) {
this.stopAnimation();
} else if (animationIndex > 1) {
animationIndex--;
if (!this.animationStarted()) {
this.startAnimation(false);
animationIndex = animationSteps.length;
hideAllElements(1.0);
hideAllLines(1.0);
unfadeAllElements();
}

var animationStep = animationSteps[animationIndex];
if (animationStep) {
if (animationStep.elements) {
animationStep.elements.forEach(function (elementId) {
hideElement(elementId, "0.0");
});
}
if (animationStep.relationships) {
animationStep.relationships.forEach(function(relationshipId) {
hideLine(relationshipId, "0.0");
});
}
if (animationIndex === 1) {
this.stopAnimation();
} else if (animationIndex > 1) {
animationIndex--;

var animationStep = animationSteps[animationIndex];
if (animationStep) {
if (animationStep.elements) {
animationStep.elements.forEach(function (elementId) {
hideElement(elementId, "0.0");
});
}
if (animationStep.relationships) {
animationStep.relationships.forEach(function(relationshipId) {
hideLine(relationshipId, "0.0");
});
}

animationIndex--;
this.continueAnimation(false);
}

animationIndex--;
this.continueAnimation(false);
}
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/jsp/diagrams.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
if (view.type === "Dynamic" || (view.animations && view.animations.length > 1)) {
$('.dynamicDiagramButton').removeClass("hidden");

$('.stepBackwardAnimationButton').attr("disabled", true);
$('.stepBackwardAnimationButton').attr("disabled", false);
$('.startAnimationButton').attr("disabled", false);
$('.stopAnimationButton').attr("disabled", true);
$('.stepForwardAnimationButton').attr("disabled", false);
Expand Down Expand Up @@ -1557,7 +1557,7 @@
}

function animationStopped() {
$('.stepBackwardAnimationButton').prop("disabled", true);
$('.stepBackwardAnimationButton').prop("disabled", false);
$('.startAnimationButton').prop("disabled", false);
$('.stopAnimationButton').attr("disabled", true);
}
Expand Down