unify buttons

This commit is contained in:
David Allemang
2026-07-07 11:04:48 -04:00
parent d5d30e9cc0
commit 9cafb23dc2
2 changed files with 151 additions and 154 deletions

View File

@@ -1,4 +1,4 @@
/* --- Component structural styles --- */ /* --- Component Structural Styles --- */
mc-world, mc-timeline, mc-camera, mc-frame { mc-world, mc-timeline, mc-camera, mc-frame {
display: none; display: none;
} }
@@ -8,15 +8,14 @@ mc-diorama {
position: relative; position: relative;
width: 100%; width: 100%;
height: 20em; height: 20em;
}
mc-diorama canvas { & canvas {
display: block; display: block;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
}
/* --- UI Controls styles --- */
.spacetime-overlay { .spacetime-overlay {
position: absolute; position: absolute;
top: 0; top: 0;
@@ -30,35 +29,41 @@ mc-diorama canvas {
box-sizing: border-box; box-sizing: border-box;
padding: 12px; padding: 12px;
z-index: 10; z-index: 10;
font-family: sans-serif;
& .btn {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
color: white;
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
text-align: center;
font-weight: bold;
font-family: inherit;
backdrop-filter: blur(4px);
transition: background 0.1s, border-color 0.1s;
pointer-events: auto; /* Always clickable when visible */
&:hover {
background: rgba(255, 255, 255, 0.2);
}
} }
.reset-wrapper { & .reset-wrapper {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
width: 100%; width: 100%;
& .btn {
visibility: hidden;
}
} }
.reset-btn { /* Bottom: Timeline Panel Context */
pointer-events: auto;
padding: 6px 12px;
background: rgba(0, 0, 0, 0.6);
color: white;
border: 1px solid rgba(255, 255, 255, 0.3);
cursor: pointer;
display: none;
font-family: sans-serif;
border-radius: 4px;
font-weight: bold;
backdrop-filter: blur(4px);
}
.reset-btn:hover { & .visualizer-ui {
background: rgba(0, 0, 0, 0.8); pointer-events: none;
}
.visualizer-ui {
pointer-events: none; /* Let clicks pass through the empty space by default */
font-family: sans-serif;
background: transparent; background: transparent;
padding: 12px; padding: 12px;
border-radius: 8px; border-radius: 8px;
@@ -69,56 +74,32 @@ mc-diorama canvas {
user-select: none; user-select: none;
border: 1px solid transparent; border: 1px solid transparent;
transition: all 0.2s ease; transition: all 0.2s ease;
}
.spacetime-container:hover .visualizer-ui { & .scrubber-row {
background: rgba(20, 20, 20, 0.85);
backdrop-filter: blur(4px);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
pointer-events: auto; /* Catch clicks on the panel background */
}
.scrubber-row {
display: flex; display: flex;
gap: 12px; gap: 12px;
align-items: center; align-items: center;
}
.btn { & .btn {
background: rgba(255, 255, 255, 0.1);
border: 1px solid rgba(255, 255, 255, 0.2);
color: white;
padding: 4px 8px;
border-radius: 4px;
cursor: pointer;
min-width: 4ch; min-width: 4ch;
text-align: center; }
font-weight: bold;
transition: background 0.1s;
} }
.btn:hover { & .track-container {
background: rgba(255, 255, 255, 0.2);
}
.track-container {
flex-grow: 1; flex-grow: 1;
height: 24px; height: 24px;
padding: 0 10px; padding: 0 10px;
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
}
.track-inner { & .track-inner {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
pointer-events: none; pointer-events: none;
}
.track-bg { & .track-bg {
position: absolute; position: absolute;
left: -10px; left: -10px;
right: -10px; right: -10px;
@@ -128,7 +109,7 @@ mc-diorama canvas {
border-radius: 4px; border-radius: 4px;
} }
.track-fill { & .track-fill {
position: absolute; position: absolute;
left: -10px; left: -10px;
top: 8px; top: 8px;
@@ -138,7 +119,7 @@ mc-diorama canvas {
border-radius: 4px; border-radius: 4px;
} }
.track-handle { & .track-handle {
position: absolute; position: absolute;
width: 16px; width: 16px;
height: 16px; height: 16px;
@@ -150,42 +131,35 @@ mc-diorama canvas {
box-shadow: 0 0 4px rgba(0, 0, 0, 0.5); box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
} }
.marker { & .marker {
position: absolute; position: absolute;
top: 8px; top: 8px;
height: 8px; height: 8px;
transform: translateX(-50%); transform: translateX(-50%);
pointer-events: none; pointer-events: none;
z-index: 1; z-index: 1;
}
.marker-event { &.marker-event {
width: 2px; width: 2px;
background: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.5);
} }
.marker-label { &.marker-label {
width: 4px; width: 4px;
background: gold; background: gold;
z-index: 2; z-index: 2;
} }
}
/* --- Hover Visibility Logic --- */ }
.spacetime-hover-reveal { }
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease;
} }
.spacetime-container:hover .spacetime-hover-reveal { /* Spatial Tool Hints */
opacity: 1;
pointer-events: auto;
}
.spacetime-indicator { & .spacetime-indicator {
position: absolute; position: absolute;
right: 33px; left: 33px;
bottom: 29px; top: 29px;
display: flex; display: flex;
gap: 12px; gap: 12px;
color: rgba(255, 255, 255, 0.4); color: rgba(255, 255, 255, 0.4);
@@ -195,7 +169,30 @@ mc-diorama canvas {
opacity: 1; opacity: 1;
transition: opacity 0.2s ease; transition: opacity 0.2s ease;
} }
}
.spacetime-container:hover .spacetime-indicator { /* --- Hover Visibility Logic --- */
.spacetime-hover-reveal {
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease;
}
.spacetime-container:hover {
& .spacetime-hover-reveal {
opacity: 1;
pointer-events: auto;
}
& .spacetime-indicator {
opacity: 0; opacity: 0;
} }
& .visualizer-ui {
background: rgba(20, 20, 20, 0.85);
backdrop-filter: blur(4px);
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
pointer-events: auto;
}
}

View File

@@ -66,13 +66,13 @@ export class SpacetimeController {
if (this.hasSpatial) { if (this.hasSpatial) {
const topWrapper = document.createElement('div'); const topWrapper = document.createElement('div');
topWrapper.className = 'reset-wrapper'; topWrapper.className = 'reset-wrapper';
this.resetBtn = document.createElement('button'); this.resetBtn = document.createElement('div');
this.resetBtn.className = 'reset-btn'; this.resetBtn.className = 'btn';
this.resetBtn.textContent = 'Reset View'; this.resetBtn.textContent = 'Reset View';
this.resetBtn.addEventListener('click', () => { this.resetBtn.addEventListener('click', () => {
this.diorama.loadState(); this.diorama.loadState();
this.resetBtn.style.display = 'none'; this.resetBtn.style.visibility = 'hidden';
}); });
topWrapper.appendChild(this.resetBtn); topWrapper.appendChild(this.resetBtn);
@@ -181,7 +181,7 @@ export class SpacetimeController {
const notifyCameraChange = () => { const notifyCameraChange = () => {
this.hasDragged = true; this.hasDragged = true;
if (this.resetBtn && this.diorama.checkpoint) this.resetBtn.style.display = 'block'; if (this.resetBtn && this.diorama.checkpoint) this.resetBtn.style.visibility = 'visible';
this.diorama.requestRender(); this.diorama.requestRender();
}; };