/** * Text-Generator State Management * Zentrale Zustandsverwaltung für alle Text-Symbol-Einstellungen */ const TextGenState = { // Aktuelle Werte current: { text: 'Text', fontSize: 14, textColor: '#000000', frameColor: '#000000', shape: 'rect', frameScale: 120, paddingTop: 10, paddingRight: 10, paddingBottom: 10, paddingLeft: 10, textAlignX: 'center', textAlignY: 'center', lineStyle: 'solid', lineWeight: 2, arrow: 'none', arrowLength: 40, arrowAngle: 0, arrowBend: 50, arrowSize: 10, arrowTipLength: 15 }, // Standardwerte für Reset defaults: { text: 'Text', fontSize: 14, textColor: '#000000', frameColor: '#000000', shape: 'rect', frameScale: 120, paddingTop: 10, paddingRight: 10, paddingBottom: 10, paddingLeft: 10, textAlignX: 'center', textAlignY: 'center', lineStyle: 'solid', lineWeight: 2, arrow: 'none', arrowLength: 40, arrowAngle: 0, arrowBend: 50, arrowSize: 10, arrowTipLength: 15 }, // State aktualisieren set(key, value) { if (key in this.current) { this.current[key] = value; this.onChange(key, value); } }, // Mehrere Werte setzen setMultiple(updates) { Object.entries(updates).forEach(([key, value]) => { if (key in this.current) { this.current[key] = value; } }); this.onChange('multiple', updates); }, // Auf Defaults zurücksetzen reset() { this.current = { ...this.defaults }; this.onChange('reset', this.current); }, // Getter get(key) { return this.current[key]; }, // Alle Werte getAll() { return { ...this.current }; }, // Change-Callback (wird von außen gesetzt) onChange: function(key, value) { // Wird von ui-bindings überschrieben } }; // Export für ES6 Module und globalen Zugriff if (typeof module !== 'undefined' && module.exports) { module.exports = TextGenState; } window.TextGenState = TextGenState;