Skip to content

Commit c715eda

Browse files
committed
Minor Image fixes
1 parent c713c74 commit c715eda

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

favicon.png

2.47 KB
Loading

index.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>JukaGUI Generator</title>
7+
<link data-rh="true" rel="icon" href="/favicon.png">
78
<link rel="stylesheet" href="style.css">
89
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@900&display=swap">
910
</head>
@@ -56,9 +57,9 @@ <h1>JukaGUI Generator</h1>
5657
<option value="custom">Custom</option>
5758
</select>
5859
<div id="customSizeFields" style="display: none; margin-left: 10px;">
59-
<input type="number" id="customWidth" placeholder="Width" min="1" style="width: 70px;">
60+
<input type="number" id="customWidth" placeholder="Width" min="1" style="width: 100px;">
6061
<span>x</span>
61-
<input type="number" id="customHeight" placeholder="Height" min="1" style="width: 70px;">
62+
<input type="number" id="customHeight" placeholder="Height" min="1" style="width: 100px;">
6263
</div>
6364
<label for="backgroundFile">&nbsp;&nbsp;&nbsp;Change Background:</label>
6465
<input type="file" id="backgroundFile" accept="image/*">

script.js

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,13 @@ function addScene() {
115115
sceneSelector.value = newSceneName;
116116
updateSceneChangeSelector();
117117
changeScene();
118+
119+
// Add menu to new scene
120+
const canvasHeight = canvas.offsetHeight;
121+
addElement('menu', 0, canvasHeight - 50);
122+
118123
document.querySelectorAll('.menu').forEach(menuEl => {
119-
updateMenuSceneButtons(menuEl);
124+
updateMenuSceneButtons(menuEl);
120125
});
121126
}
122127

@@ -252,6 +257,12 @@ document.addEventListener('DOMContentLoaded', () => {
252257
option.textContent = 'Scene 1';
253258
sceneSelector.appendChild(option);
254259
sceneSelector.value = 'Scene 1';
260+
261+
// Add menu to initial scene
262+
setTimeout(() => { // Wait for canvas size to update
263+
const canvasHeight = canvas.offsetHeight;
264+
addElement('menu', 0, canvasHeight - 50);
265+
}, 0);
255266
});
256267

257268
function setupToolbar() {
@@ -471,6 +482,9 @@ function setupElementEvents(el) {
471482
if (newX + elRect.width > canvasRect.width) newX = canvasRect.width - elRect.width;
472483
if (newY + elRect.height > canvasRect.height) newY = canvasRect.height - elRect.height;
473484

485+
newX = parseInt(newX)
486+
newY = parseInt(newY)
487+
474488
el.style.left = `${newX}px`;
475489
el.style.top = `${newY}px`;
476490
el.setAttribute('data-x', newX);
@@ -630,11 +644,6 @@ function setupElementEvents(el) {
630644
}
631645
}
632646
} else {
633-
//document.querySelector('.control-label[for="datax"]').style.display = 'none';
634-
//datax.style.display = 'none';
635-
//document.querySelector('.control-label[for="datay"]').style.display = 'none';
636-
//datay.style.display = 'none';
637-
638647
document.querySelector('.control-label[for="colorPicker"]').style.display = 'none';
639648
colorPicker.style.display = 'none';
640649
document.querySelector('.control-label[for="fontSizePicker"]').style.display = 'none';
@@ -724,8 +733,8 @@ function addElement(type, x, y) {
724733
}
725734

726735
el.setAttribute('data-type', type);
727-
el.setAttribute('data-x', x);
728-
el.setAttribute('data-y', y);
736+
el.setAttribute('data-x', x | 0);
737+
el.setAttribute('data-y', y | 0);
729738

730739
if (type !== 'menu') {
731740
el.setAttribute('data-color', '#000000'); // Default text color

style.css

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
.element[data-type="menu"] {
9898
width: 100%;
9999
background: rgba(32, 32, 32, 0.8);
100-
border-top: 1px solid #555;
100+
border-top: 1px solid #555555;
101101
}
102102

103103
.element[data-type="input"] {
@@ -106,12 +106,20 @@
106106
cursor: text;
107107
color: #666;
108108
}
109-
110-
.element[data-type="image"] {
109+
110+
.element[data-type="label"] {
111111
background: linear-gradient(135deg, #e0e0e0 25%, #f5f5f5 25%, #f5f5f5 50%, #e0e0e0 50%, #e0e0e0 75%, #f5f5f5 75%, #f5f5f5 100%);
112112
background-size: 20px 20px;
113113
}
114114

115+
.element[data-type="image"] {
116+
background-image: url("favicon.png");
117+
background-repeat: no-repeat;
118+
background-color: #333447;
119+
min-width:150px;
120+
color:rgb(255, 255, 255);
121+
}
122+
115123
.remove-button {
116124
position: absolute;
117125
top: -12px;
@@ -145,11 +153,11 @@
145153
}
146154

147155
.canvas::before {
148-
content: "Screen";
156+
content: "Screen:";
149157
position: absolute;
150-
top: 10px;
151-
left: 10px;
152-
color: gray;
158+
top: -28px;
159+
left: 5px;
160+
color: rgb(60, 60, 60);
153161
font-size: 1.2rem;
154162
pointer-events: none;
155163
}

0 commit comments

Comments
 (0)