feat: Klick auf Farbswatch übernimmt Farbe als Ausgangsfarbe
- Sammlung (Verlauf/Favoriten/Schemata): Klick → Farbe setzen → Harmonien-Tab - Harmonien: Klick auf Swatch → als neue Ausgangsfarbe, bleibt auf Harmonien - switchTab() Hilfsfunktion in app.js Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
15
js/app.js
15
js/app.js
@@ -1,7 +1,7 @@
|
||||
import { initEingabe } from './eingabe.js';
|
||||
import { initPicker } from './picker.js';
|
||||
import { initHarmonien } from './harmonien.js';
|
||||
import { addFavorit, addColorToSchema, addToHistory, renderSammlung, exportCollection, importCollection, saveSchema, setEditSchemaHandler } from './collection.js';
|
||||
import { addFavorit, addColorToSchema, addToHistory, renderSammlung, exportCollection, importCollection, saveSchema, setEditSchemaHandler, setSwatchClickHandler } from './collection.js';
|
||||
import { initSchemaModal, openForEdit } from './schema-modal.js';
|
||||
|
||||
// state.color is read-only from outside — always use setColor() to update,
|
||||
@@ -15,6 +15,16 @@ export const state = {
|
||||
}
|
||||
};
|
||||
|
||||
function switchTab(name) {
|
||||
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
|
||||
document.querySelectorAll('.tab-content').forEach(s => s.classList.remove('active'));
|
||||
const btn = document.querySelector(`.tab-btn[data-tab="${name}"]`);
|
||||
if (btn) { btn.classList.add('active'); document.getElementById('menu-active-label').textContent = btn.textContent; }
|
||||
const section = document.getElementById('tab-' + name);
|
||||
if (section) section.classList.add('active');
|
||||
document.getElementById('menu-dropdown').classList.remove('open');
|
||||
}
|
||||
|
||||
// Hamburger-Menü
|
||||
const menuToggle = document.getElementById('menu-toggle');
|
||||
const menuDropdown = document.getElementById('menu-dropdown');
|
||||
@@ -53,7 +63,7 @@ document.addEventListener('colorChanged', (e) => {
|
||||
|
||||
initEingabe(addFavorit, addColorToSchema);
|
||||
initPicker(addFavorit, addColorToSchema);
|
||||
initHarmonien(addFavorit, addColorToSchema);
|
||||
initHarmonien(addFavorit, addColorToSchema, (hsl) => state.setColor(hsl));
|
||||
|
||||
document.getElementById('sammlung-export-btn').addEventListener('click', exportCollection);
|
||||
document.getElementById('sammlung-import-btn').addEventListener('click', importCollection);
|
||||
@@ -61,3 +71,4 @@ document.getElementById('sammlung-import-btn').addEventListener('click', importC
|
||||
renderSammlung();
|
||||
initSchemaModal(saveSchema);
|
||||
setEditSchemaHandler(openForEdit);
|
||||
setSwatchClickHandler((hsl) => { state.setColor(hsl); switchTab('harmonien'); });
|
||||
|
||||
Reference in New Issue
Block a user