Skip to content

Commit 5cb019d

Browse files
committed
Invert fix
1 parent 44a719b commit 5cb019d

File tree

2 files changed

+41
-47
lines changed

2 files changed

+41
-47
lines changed

examples/led-matrix-painter/assets/app.js

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ const ROWS = 8, COLS = 13;
6767
let BRIGHTNESS_LEVELS = 8;
6868
let cells = [];
6969
let sessionFrames = [];
70-
let selectedFrameId = null;
7170
let loadedFrameId = null; // ID of the frame currently loaded in editor
7271
let loadedFrame = null; // Full frame object currently loaded
7372

@@ -597,12 +596,8 @@ async function loadFrameIntoEditor(id){
597596
setGridFromRows(f.rows || []);
598597

599598
// Populate name input
600-
if(nameInput) nameInput.value = f.name || '';
601599
if(frameTitle) frameTitle.textContent = f.name || `Frame ${f.id}`;
602600

603-
// Populate duration
604-
if(durationInput) durationInput.value = (f.duration_ms !== undefined && f.duration_ms !== null) ? String(f.duration_ms) : '1000';
605-
606601
// Mark as loaded in sidebar
607602
markLoaded(f);
608603

@@ -611,8 +606,6 @@ async function loadFrameIntoEditor(id){
611606
showVectorText(data.vector);
612607
}
613608

614-
selectedFrameId = id;
615-
616609
console.debug('[ui] loaded frame into editor:', id);
617610
}
618611
} catch(err) {
@@ -671,7 +664,6 @@ async function handleNewFrameClick() {
671664
loadedFrame = data.frame;
672665
loadedFrameId = data.frame.id;
673666
// Set name to the backend-assigned name (Frame{id})
674-
if(nameInput) nameInput.value = data.frame.name || `Frame${data.frame.id}`;
675667
if(frameTitle) frameTitle.textContent = data.frame.name || `Frame ${data.frame.id}`;
676668

677669
// Show C vector representation
@@ -707,27 +699,7 @@ if (clearBtn) {
707699
console.warn('[ui] clear button not found');
708700
}
709701

710-
if (saveAnimBtn) {
711-
saveAnimBtn.addEventListener('click', async ()=>{
712-
const container = document.getElementById('frames');
713-
const selected = Array.from(container.children).filter(ch => ch.dataset.selected === '1').map(ch => parseInt(ch.dataset.id));
714-
if(selected.length === 0) { alert('Select some frames first'); return; }
715-
const animName = animNameInput.value && animNameInput.value.trim() ? animNameInput.value.trim() : undefined;
716-
try {
717-
const data = await fetchWithHandling('/save_animation', {method:'POST', headers:{'Content-Type':'application/json'}, body: JSON.stringify({name: animName, frames: selected})}, 'json', 'save animation');
718-
if(data && data.anim){
719-
// clear selection
720-
Array.from(container.children).forEach(ch => { ch.classList.remove('selected'); ch.dataset.selected = '0'; });
721-
animNameInput.value = '';
722-
alert('Animation saved');
723-
}
724-
} catch(e) {
725-
console.warn('[ui] save animation failed', e);
726-
}
727-
});
728-
} else {
729-
console.warn('[ui] save-anim button not found (animation save disabled)');
730-
}
702+
// 'save-anim' button functionality has been removed as it is no longer part of the UI.
731703

732704
document.addEventListener('DOMContentLoaded', () => {
733705
let selectedTool = 'brush';

examples/led-matrix-painter/assets/style.css

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -486,19 +486,21 @@ input:checked + .slider:before {
486486
overflow-y: hidden;
487487
padding-bottom: 10px; /* Add some padding for the scrollbar */
488488
align-items: center; /* Vertically center items */
489-
min-height: 150px; /* Give the container some height */
489+
height: 112px; /* Set fixed height to match buttons */
490490
}
491491
.frame-item {
492492
display: flex;
493493
flex-direction: column; /* Stack image, name, duration vertically */
494494
align-items: center; /* Center content horizontally */
495+
justify-content: space-around; /* Distribute space vertically within the frame item */
495496
gap: 4px;
496497
padding: 4px;
497-
border: 1px solid #f0f0f0;
498-
border-radius: 8px;
499-
background: #fafafa;
498+
border: 1px solid #f0f0f0; /* Default border */
499+
border-radius: 8px; /* Requested border-radius */
500+
background: transparent; /* Remove default background */
500501
max-width: 132px;
501502
flex-shrink: 0; /* Prevent shrinking */
503+
height: 100%; /* Make frame item fill the height of its container */
502504
}
503505
.frame-thumb {
504506
width: 65px;
@@ -590,6 +592,8 @@ input {
590592
font-style: normal;
591593
font-weight: 400;
592594
color: #2C353A;
595+
border-radius: 4px;
596+
border: 1px solid#C9D2D2;
593597
}
594598

595599
/* Cell Slider */
@@ -771,26 +775,29 @@ input {
771775
border-color: rgba(0, 129, 132, 0.4);
772776
}
773777
.add-frame-btn {
774-
display: block;
775-
margin: 12px auto 0; /* Top margin, centered horizontally */
776-
width: 32px; /* Adjusted to match other icon buttons */
777-
height: 32px; /* Adjusted to match other icon buttons */
778-
border-radius: 8px; /* Changed to 8px as requested */
779-
background: rgba(0, 129, 132, 0.2); /* Same as stop button */
780-
border: none; /* Remove default border from buttons */
778+
margin-left: 8px; /* Add 8px to the existing 8px gap for a total of 16px */
779+
width: 32px;
780+
height: 32px;
781+
border-radius: 8px;
782+
background: rgba(0, 129, 132, 0.2);
783+
border: none;
781784
cursor: pointer;
782-
box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* Subtle shadow */
785+
box-shadow: 0 2px 4px rgba(0,0,0,0.2);
783786
transition: background 0.3s ease;
784-
display: flex; /* To center the image */
787+
display: flex;
785788
align-items: center;
786789
justify-content: center;
787790
}
788791
.add-frame-btn:hover {
789792
background: rgba(0, 129, 132, 0.3); /* Slightly darker on hover */
790793
}
791794
.add-frame-btn img {
792-
width: 16px; /* Icon size */
793-
height: 16px; /* Icon size */
795+
width: 16px;
796+
height: 16px;
797+
}
798+
799+
.frame-item:hover {
800+
cursor: pointer;
794801
}
795802

796803
.frame-name, .frame-duration {
@@ -806,9 +813,9 @@ input {
806813
text-overflow: ellipsis;
807814
}
808815
.modal {
809-
display: none;
810-
position: fixed;
811-
z-index: 1001;
816+
display: none;
817+
position: fixed;
818+
z-index: 1001;
812819
left: 0;
813820
top: 0;
814821
width: 100%;
@@ -841,3 +848,18 @@ input {
841848
#global-frame-inputs {
842849
display: none;
843850
}
851+
852+
@media (max-width: 700px) {
853+
.grid {
854+
grid-template-columns: repeat(13, 20px);
855+
grid-auto-rows: 20px;
856+
gap: 3px; /* Half the original gap for smaller cells */
857+
width: calc(13 * 20px + 12 * 3px + 32px); /* 13 cells * 20px + 12 gaps * 3px + 2*16px padding */
858+
padding: 16px; /* Keep padding consistent, or adjust as needed */
859+
}
860+
.cell {
861+
width: 20px;
862+
height: 20px;
863+
}
864+
}
865+

0 commit comments

Comments
 (0)