Skip to content

Commit aa5078e

Browse files
authored
Update fast-search-card.js
1 parent b75f093 commit aa5078e

File tree

1 file changed

+60
-36
lines changed

1 file changed

+60
-36
lines changed

dist/fast-search-card.js

Lines changed: 60 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4997,7 +4997,6 @@ class FastSearchCard extends HTMLElement {
49974997
showCategoryButtons() {
49984998
this.collapsePanel();
49994999

5000-
// ✅ DEBUG: Was ist der Zustand VOR der Animation?
50015000
console.log('🔍 BEFORE showCategoryButtons:');
50025001
this.debugCategoryButtons();
50035002

@@ -5010,40 +5009,48 @@ class FastSearchCard extends HTMLElement {
50105009

50115010
const categoryButtons = this.shadowRoot.querySelector('.category-buttons');
50125011

5013-
// ✅ VOLLSTÄNDIGES RESET
5012+
// ✅ ERWEITERTE RESET-FUNKTION verwenden
50145013
this.resetAllCategoryStyles();
50155014

5015+
// ✅ State setzen
50165016
this.isMenuView = true;
50175017
categoryButtons.classList.add('visible');
50185018

5019-
setTimeout(() => {
5020-
console.log('🔍 AFTER reset, BEFORE animation:');
5021-
this.debugCategoryButtons();
5022-
this.animateRippleEffect(categoryButtons);
5023-
}, 50);
5019+
// ✅ Animation sofort starten (kein setTimeout mehr nötig)
5020+
console.log('🔍 AFTER reset, BEFORE animation:');
5021+
this.debugCategoryButtons();
5022+
5023+
this.animateRippleEffect(categoryButtons);
50245024
}
50255025

50265026
resetAllCategoryStyles() {
50275027
const categoryButtons = this.shadowRoot.querySelector('.category-buttons');
50285028
const buttons = categoryButtons?.querySelectorAll('.category-button');
50295029

50305030
if (categoryButtons) {
5031-
categoryButtons.style.opacity = '';
5032-
categoryButtons.style.transform = '';
5033-
categoryButtons.style.display = '';
5031+
// ✅ Stoppe alle laufenden Animationen am Container
5032+
categoryButtons.getAnimations().forEach(anim => anim.cancel());
5033+
5034+
// ✅ Vollständiges Style-Reset
5035+
categoryButtons.style.cssText = '';
5036+
categoryButtons.style.opacity = '1';
5037+
categoryButtons.style.transform = 'none';
5038+
categoryButtons.style.display = 'flex';
50345039
}
50355040

50365041
if (buttons) {
50375042
buttons.forEach(button => {
5038-
button.style.opacity = '';
5039-
button.style.transform = '';
5040-
button.style.filter = '';
5041-
button.style.transition = '';
5042-
button.style.boxShadow = '';
5043-
button.style.background = '';
5043+
// ✅ Stoppe alle laufenden Animationen an jedem Button
5044+
button.getAnimations().forEach(anim => anim.cancel());
5045+
5046+
// ✅ Vollständiges Style-Reset
5047+
button.style.cssText = '';
5048+
button.style.opacity = '1';
5049+
button.style.transform = 'none';
5050+
button.style.filter = 'none';
50445051
});
50455052
}
5046-
}
5053+
}
50475054

50485055
debugCategoryButtons() {
50495056
const categoryButtons = this.shadowRoot.querySelector('.category-buttons');
@@ -5091,31 +5098,48 @@ class FastSearchCard extends HTMLElement {
50915098
animateRippleEffect(categoryButtons) {
50925099
const buttons = categoryButtons.querySelectorAll('.category-button');
50935100

5094-
// ✅ WICHTIG: CSS opacity überschreiben!
5101+
// ✅ KRITISCH: Container und Buttons sichtbar machen BEVOR Animation startet
50955102
categoryButtons.style.opacity = '1';
50965103
categoryButtons.style.transform = 'translateX(0) scale(1)';
5097-
categoryButtons.style.display = 'flex'; // Sicherheitshalber
5104+
categoryButtons.style.display = 'flex';
50985105

5099-
// Rest der Funktion bleibt gleich...
5106+
// ✅ Alle Buttons sofort sichtbar machen
51005107
buttons.forEach(button => {
5101-
button.style.opacity = '';
5102-
button.style.transform = '';
5103-
button.style.filter = '';
5108+
button.style.opacity = '1';
5109+
button.style.transform = 'none';
5110+
button.style.filter = 'none';
51045111
});
51055112

5106-
// Alle Buttons initial unsichtbar setzen
5107-
buttons.forEach((button, index) => {
5108-
button.style.opacity = '0';
5109-
button.style.transform = 'translateY(25px) scale(0.4) rotate(-15deg)';
5110-
button.style.filter = 'blur(6px)';
5111-
});
5112-
5113-
// Gestaffelte Animation
5114-
buttons.forEach((button, index) => {
5115-
setTimeout(() => {
5116-
this.animateButtonRipple(button, index);
5117-
}, index * 80);
5118-
});
5113+
// ✅ Kurze Pause, dann Animation starten
5114+
setTimeout(() => {
5115+
// Jetzt können wir die Animation starten
5116+
buttons.forEach((button, index) => {
5117+
// Animation von sichtbar zu animiert zu final
5118+
button.animate([
5119+
{
5120+
opacity: 1,
5121+
transform: 'translateY(0) scale(1) rotate(0deg)',
5122+
filter: 'blur(0px)'
5123+
},
5124+
{
5125+
opacity: 0.7,
5126+
transform: 'translateY(-8px) scale(1.15) rotate(3deg)',
5127+
filter: 'blur(0px)',
5128+
offset: 0.3
5129+
},
5130+
{
5131+
opacity: 1,
5132+
transform: 'translateY(0) scale(1) rotate(0deg)',
5133+
filter: 'blur(0px)'
5134+
}
5135+
], {
5136+
duration: 450,
5137+
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
5138+
delay: index * 60,
5139+
fill: 'none' // ← WICHTIG: keine permanenten Styles!
5140+
});
5141+
});
5142+
}, 10);
51195143
}
51205144

51215145
animateButtonRipple(button, index) {

0 commit comments

Comments
 (0)