Skip to content

Commit

Permalink
Correct sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAndreiM committed Jan 3, 2025
1 parent 46ff419 commit d4f9bac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
6 changes: 5 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,17 @@ function setupElementEvents(el) {
el.style.fontSize = getFontSize(fontSizePicker.value) + 'px';
};

if (el.getAttribute('data-type') !== 'label') {
document.querySelector('.control-label[for="bgColorPicker"]').style.display = 'block';
bgColorPicker.value = el.getAttribute('data-bg-color') || '#ffffff';
bgColorPicker.style.display = 'block';
bgColorPicker.oninput = function() {
el.style.backgroundColor = bgColorPicker.value;
el.setAttribute('data-bg-color', bgColorPicker.value);
};
}

if (el.getAttribute('data-type') !== 'label') {
document.querySelector('.control-label[for="triggerSelector"]').style.display = 'block';
triggerSelector.value = el.getAttribute('data-trigger') || '';
triggerSelector.style.display = 'block';
Expand Down Expand Up @@ -482,6 +485,7 @@ function setupElementEvents(el) {
variableChangeSelector.value = el.getAttribute('data-trigger-target') || '';
variableChangeValue.value = el.getAttribute('data-trigger-value') || '';
}
}
} else {
document.querySelector('.control-label[for="colorPicker"]').style.display = 'none';
colorPicker.style.display = 'none';
Expand Down Expand Up @@ -535,7 +539,7 @@ function addElement(type, x, y) {
el.setAttribute('data-font', 'medium'); // Default font size
el.setAttribute('data-width', type === 'image' ? '100px' : ''); // Default width for images
el.setAttribute('data-height', type === 'image' ? '100px' : ''); // Default height for images
el.style.fontSize = '16px'; // Setting a default font size for buttons and labels
el.style.fontSize = '24px'; // Setting a default font size for buttons and labels
el.style.padding = '5px'; // Adjusting padding to make elements fit the text size
el.style.width = 'auto'; // Ensure the element fits the text size
if (type === 'label') {
Expand Down
7 changes: 3 additions & 4 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,16 @@ h1 {
}

.element {
padding: 10px;
margin: 5px;
padding: 5px;
background: #f5f5f5;
border: 1px solid #ddd;
border-radius: 4px;
cursor: grab;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 1em;
font-weight: 500;
font-size: 24px;
font-weight: 900;
color: #333;
transition: background 0.3s ease;
}
Expand Down

0 comments on commit d4f9bac

Please sign in to comment.