mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
feat: burg group editor - apply changes
This commit is contained in:
parent
b6708bf698
commit
b700bf0630
8 changed files with 102 additions and 29 deletions
|
|
@ -71,13 +71,22 @@ async function fetchSystemPreset(preset) {
|
|||
}
|
||||
}
|
||||
|
||||
function applyStyle(style) {
|
||||
for (const selector in style) {
|
||||
function applyStyle(styleJSON) {
|
||||
for (const selector in styleJSON) {
|
||||
if (selector.startsWith("#burgLabels")) {
|
||||
const group = selector.replace("#burgLabels > g#", "");
|
||||
style.burgLabels[group] = styleJSON[selector];
|
||||
}
|
||||
if (selector.startsWith("#burgIcons")) {
|
||||
const group = selector.replace("#burgIcons > g#", "");
|
||||
style.burgIcons[group] = styleJSON[selector];
|
||||
}
|
||||
|
||||
const el = document.querySelector(selector);
|
||||
if (!el) continue;
|
||||
|
||||
for (const attribute in style[selector]) {
|
||||
const value = style[selector][attribute];
|
||||
for (const attribute in styleJSON[selector]) {
|
||||
const value = styleJSON[selector][attribute];
|
||||
|
||||
if (value === "null" || value === null) {
|
||||
el.removeAttribute(attribute);
|
||||
|
|
@ -342,8 +351,18 @@ function addStylePreset() {
|
|||
"stroke-dasharray",
|
||||
"stroke-linecap"
|
||||
];
|
||||
const burgLabelsAttributes = [
|
||||
"opacity",
|
||||
"fill",
|
||||
"text-shadow",
|
||||
"letter-spacing",
|
||||
"data-size",
|
||||
"font-size",
|
||||
"font-family"
|
||||
];
|
||||
options.burgs.groups.forEach(({name}) => {
|
||||
attributes[`#burgIcons > g.${name}`] = burgIconsAttributes;
|
||||
attributes[`#burgLabels > g#${name}`] = burgLabelsAttributes;
|
||||
});
|
||||
|
||||
for (const selector in attributes) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue