Skip to content

Commit

Permalink
Merge branch 'main' into undo-redo-bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel-Pol authored Feb 8, 2025
2 parents 527027f + 2cf3a99 commit d89fb03
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 175 deletions.
11 changes: 5 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,14 @@ async function loadAssets(otherPromises: Promise<void>[]) {
const triggerPause = () => {
paused = !paused;

pauseButton.classList.toggle("paused");
pauseButton.title = paused ? "Resume" : "Pause";

pauseIcon.src = paused ? PlaySvg : PauseSvg;

if (paused) {
pauseIcon.src = PlaySvg;
pauseButton.style.backgroundColor = "#f44336";
pauseButton.title = "Resume";
Packet.pauseAnimation();
} else {
pauseIcon.src = PauseSvg;
pauseButton.style.backgroundColor = "#228b22";
pauseButton.title = "Pause";
Packet.unpauseAnimation();
}
};
Expand Down
58 changes: 0 additions & 58 deletions src/styles/canvas.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,61 +60,3 @@
background-color: #444444; /* Fondo más claro en hover */
color: #ffffff; /* Mantiene el texto blanco */
}

/* Pause button styles */
.pause-button {
background-color: #228b22; /* Forest green background */
color: #ffffff; /* White text */
border: 2px solid #000000; /* Borde verde oscuro */
padding: 0; /* No internal padding */
cursor: pointer; /* Changes cursor to pointer on hover */
width: 45px; /* Fixed width for the circular button */
height: 45px; /* Fixed height for the circular button */
border-radius: 50%; /* Makes the button circular */
display: flex; /* Uses flexbox for centering */
align-items: center; /* Vertically centers content */
justify-content: center; /* Horizontally centers content */
transition: background-color 0.3s ease; /* Smooth color transition */
position: absolute; /* Permite colocarlo sobre el canvas */
}

.pause-button {
top: 10px; /* Separación desde el borde superior */
left: 15px; /* Separación desde el borde derecho */
}

/* Hover effect for pause button */
.pause-button:hover {
background-color: #006400; /* Darker forest green on hover */
}

.undo-button,
.redo-button {
cursor: pointer; /* Changes cursor to pointer on hover */
width: 45px; /* Fixed width for the circular button */
height: 45px; /* Fixed height for the circular button */
border-radius: 50%; /* Makes the button circular */
display: flex; /* Uses flexbox for centering */
align-items: center; /* Vertically centers content */
justify-content: center; /* Horizontally centers content */
transition: background-color 0.3s ease; /* Smooth color transition */
position: absolute; /* Permite colocarlo sobre el canvas */
}

.undo-button {
top: 10px;
left: 70px;
}

.redo-button {
top: 10px;
left: 110px;
}

/* Icon inside the pause button */
.undo-button img,
.redo-button img,
.pause-button img {
width: 60%; /* Scales the icon to fit the button */
height: 60%; /* Scales the icon to fit the button */
}
3 changes: 2 additions & 1 deletion src/styles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ import "./right-bar-buttons.css";
import "./table.css";
import "./info.css";
import "./buttons.css";
import "./modal.css";
import "./pause.css";
import "./undo-redo.css";
110 changes: 0 additions & 110 deletions src/styles/modal.css

This file was deleted.

48 changes: 48 additions & 0 deletions src/styles/pause.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* pause-button.css */

/* Redesigned Pause button styles */
.pause-button {
background-color: #228b22; /* Default green background */
color: #ffffff; /* White text */
border: 2px solid #000000; /* Black border */
padding: 0; /* No internal padding */
cursor: pointer; /* Pointer on hover */
width: 40px; /* Slightly larger button */
height: 40px; /* Slightly larger button */
border-radius: 12px; /* Rounded but not circular */
display: flex; /* Uses flexbox for centering */
align-items: center; /* Vertically centers content */
justify-content: center; /* Horizontally centers content */
transition: background-color 0.3s ease; /* Smooth transitions */
position: absolute; /* Position over the canvas */
top: 15px; /* Adjusted distance from the top */
left: 20px; /* Adjusted distance from the left */
box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.4); /* Adds a subtle shadow */
outline: none; /* Removes focus outline */
}

/* Hover effect for pause button */
.pause-button:hover {
background-color: #006400; /* Darker green on hover */
}

/* Active effect for pause button */
.pause-button:active {
background-color: #004d00; /* Even darker green when clicked */
}

/* Styles for paused state */
.pause-button.paused {
background-color: #f44336; /* Red background when paused */
}

/* Prevent focus outline when using keyboard */
.pause-button:focus {
outline: none;
}

/* Icon inside the pause button */
.pause-button img {
width: 60%; /* Original icon size */
height: 60%; /* Original icon size */
}
29 changes: 29 additions & 0 deletions src/styles/undo-redo.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.undo-button,
.redo-button {
cursor: pointer; /* Changes cursor to pointer on hover */
width: 45px; /* Fixed width for the circular button */
height: 45px; /* Fixed height for the circular button */
border-radius: 50%; /* Makes the button circular */
display: flex; /* Uses flexbox for centering */
align-items: center; /* Vertically centers content */
justify-content: center; /* Horizontally centers content */
transition: background-color 0.3s ease; /* Smooth color transition */
position: absolute; /* Permite colocarlo sobre el canvas */
}

.undo-button {
top: 10px;
left: 70px;
}

.redo-button {
top: 10px;
left: 110px;
}

/* Icon inside the pause button */
.undo-button img,
.redo-button img {
width: 60%; /* Scales the icon to fit the button */
height: 60%; /* Scales the icon to fit the button */
}

0 comments on commit d89fb03

Please sign in to comment.