diff --git a/css/style.css b/css/style.css
index 14f9a4f..b1523db 100644
--- a/css/style.css
+++ b/css/style.css
@@ -420,6 +420,10 @@ code {
margin: 4px 0;
}
+#glyph-name-note {
+ display: none;
+}
+
.upload-note {
max-width: 320px;
}
@@ -519,7 +523,7 @@ input[type="radio"] {
}
.glyph-input {
- width: 80px;
+ width: 300px;
margin-left: 10px;
}
@@ -639,6 +643,9 @@ input[type="file"]::file-selector-button {
#image-size-settings li {
margin: 6px 0;
+ border: 1px solid var(--border-subtle);
+ border-radius: var(--radius-lg);
+ padding: 8px 12px;
}
/* ---- Preview canvases ---- */
diff --git a/index.html b/index.html
index 441cab4..0822a2b 100644
--- a/index.html
+++ b/index.html
@@ -95,6 +95,9 @@
Only images file type are allowed
Select one or more images at
step 1 first.
+
+ Glyph name is used to identify the image in the code.
+
@@ -203,7 +206,7 @@
3
Preview
- No files selected
+ No files selected
@@ -221,7 +224,6 @@
-
@@ -271,13 +273,13 @@
@@ -285,7 +287,7 @@
diff --git a/js/script.js b/js/script.js
index 89e408a..de86ee4 100644
--- a/js/script.js
+++ b/js/script.js
@@ -559,8 +559,10 @@ function setTextInputSize(width, height) {
// Show/hide the "no images" error and report whether images are available
function checkImagesAvailable() {
const error = document.getElementById('no-images-error');
+ const glyphNameNote = document.getElementById('glyph-name-note');
const hasImages = images.length() > 0;
error.style.display = hasImages ? 'none' : 'block';
+ glyphNameNote.style.display = hasImages ? 'block' : 'none';
return hasImages;
}
@@ -725,13 +727,14 @@ function handleImageSelection(evt) {
};
const gil = document.createElement('span');
- gil.innerHTML = 'glyph';
+ gil.innerHTML = 'glyph name';
gil.className = 'file-info';
const gi = document.createElement('input');
gi.type = 'text';
gi.name = 'glyph';
gi.className = 'glyph-input';
+ gi.value = file.name.split('.')[0];
gi.onchange = () => {
const image = images.get(img);
image.glyph = gi.value;
@@ -759,6 +762,7 @@ function handleImageSelection(evt) {
});
}
updateAllImages();
+ checkImagesAvailable();
};
const rb = document.createElement('button');
@@ -852,7 +856,7 @@ function generateOutputString() {
const comment = glyphComment(image);
bytesUsed += code.split('\n').length * 16; // 16 bytes per line.
- const varname = getIdentifier() + (image.glyph ? image.glyph.replace(/[^a-zA-Z0-9]/g, '_') : '');
+ const varname = getIdentifier() + (image.glyph ? `_${image.glyph.replace(/[^a-zA-Z0-9]/g, '_')}` : '');
varQuickArray.push(varname);
code = `${comment}const ${getImageType()} ${varname} [] PROGMEM = {\n${code}};\n`;
outputString += code;