Skip to content

Commit b8b381a

Browse files
authored
editor-animations -- re-apply style sheet when speed changes whoops
1 parent af75b8d commit b8b381a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/addons/addons/editor-animations/userscript.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default async function({ addon }) {
1515
let needsInit = true, animateModals = true, animateLibraries = true, animateButtons = true, animationSpeed = 1;
1616
let patchedBody = false, sbPatched = false, sbEverPatched = false, listenerAttached = false;
1717

18-
const styles = `
18+
const genStyles = () => `
1919
/* Top Bar Items */
2020
.${addonKey}top-bar-scaler {
2121
transition: transform ${getAnim(.1)};
@@ -104,7 +104,7 @@ export default async function({ addon }) {
104104

105105
const styleElement = document.createElement("style");
106106
styleElement.classList.add("addon-editorAnimations");
107-
styleElement.textContent = styles;
107+
styleElement.textContent = genStyles();
108108
document.head.appendChild(styleElement);
109109

110110
let animationEnabled = !mediaQuery.matches;
@@ -116,7 +116,10 @@ export default async function({ addon }) {
116116
animateModals = addon.settings.get("animateModals");
117117
animateLibraries = addon.settings.get("animateLibraries");
118118
animateButtons = addon.settings.get("animateButtons");
119+
120+
const oldSpeed = animationSpeed;
119121
animationSpeed = Number(addon.settings.get("animateSpeed")) / 100;
122+
if (oldSpeed !== animationSpeed) styleElement.textContent = genStyles();
120123
}
121124

122125
function getAnim(time) {

0 commit comments

Comments
 (0)