Integrate symbols/ into main repo
- Added symbols/ folder (previously separate repo) - Removed symbols/ from .gitignore - Updated CLAUDE.md documentation - Deleted separate Symbols repo on Gitea 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
95
symbols/js/text-generator/state.js
Normal file
95
symbols/js/text-generator/state.js
Normal file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* 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,
|
||||
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,
|
||||
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;
|
||||
Reference in New Issue
Block a user