You've already forked computing-box
Updates to canvas of logic gate simulator:
All checks were successful
Pre-release on non-main branches / prerelease (push) Successful in 29s
All checks were successful
Pre-release on non-main branches / prerelease (push) Successful in 29s
- Addition of zoom feature Signed-off-by: Alexander Lyall <alex@adcm.uk>
This commit is contained in:
@@ -1,161 +1,109 @@
|
||||
/* === FULL PAGE OVERRIDES FOR LOGIC GATES === */
|
||||
body:has(#logicPage) {
|
||||
overflow: hidden; /* Prevents the entire page from scrolling */
|
||||
}
|
||||
|
||||
body:has(#logicPage) { overflow: hidden; }
|
||||
body:has(#logicPage) .pageWrap {
|
||||
max-width: 100% !important; /* Forces edge-to-edge canvas */
|
||||
max-width: 100% !important;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
height: calc(100vh - var(--nav-h));
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#logicPage {
|
||||
padding: 0 !important; /* CRITICAL: Stops the page/header from shifting when toolbox opens */
|
||||
margin: 0 !important;
|
||||
}
|
||||
#logicPage { padding: 0 !important; margin: 0 !important; }
|
||||
|
||||
/* === MAIN CONTAINER === */
|
||||
.lg-container {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
flex: 1; display: flex; flex-direction: column; position: relative;
|
||||
width: 100%; height: 100%; overflow: hidden;
|
||||
}
|
||||
|
||||
/* === FIXED HEADER (Ultra Compact) === */
|
||||
/* === FIXED HEADER === */
|
||||
.lg-top-header {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
padding: 8px 20px 8px; /* Extremely tight padding to maximize canvas */
|
||||
background: var(--bg);
|
||||
z-index: 10;
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.08); /* Clean separation line */
|
||||
width: 100%; text-align: center; padding: 8px 20px 8px;
|
||||
background: var(--bg); z-index: 10; flex-shrink: 0;
|
||||
display: flex; flex-direction: column; align-items: center; justify-content: center;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
.lg-title {
|
||||
font-family: var(--bit-font);
|
||||
font-size: 32px;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text);
|
||||
margin: 0 0 2px 0; /* Minimal gap between title and subtitle */
|
||||
line-height: 1;
|
||||
font-family: var(--bit-font); font-size: 32px; letter-spacing: 0.12em;
|
||||
text-transform: uppercase; color: var(--text); margin: 0 0 2px 0; line-height: 1;
|
||||
}
|
||||
|
||||
.lg-subtitle {
|
||||
color: var(--muted);
|
||||
font-size: 14px;
|
||||
font-family: var(--ui-font);
|
||||
font-weight: 500;
|
||||
margin: 0;
|
||||
line-height: 1.2;
|
||||
color: var(--muted); font-size: 14px; font-family: var(--ui-font);
|
||||
font-weight: 500; margin: 0; line-height: 1.2;
|
||||
}
|
||||
|
||||
.lg-subtitle kbd {
|
||||
background: rgba(255,255,255,0.1);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: var(--ui-font);
|
||||
color: #e8e8ee;
|
||||
background: rgba(255,255,255,0.1); padding: 2px 6px; border-radius: 4px;
|
||||
font-family: var(--ui-font); color: #e8e8ee;
|
||||
}
|
||||
|
||||
/* === DYNAMIC CANVAS === */
|
||||
/* === DYNAMIC CANVAS & CAMERA VIEWPORT === */
|
||||
.lg-workspace {
|
||||
flex: 1; /* Automatically fills all remaining vertical space */
|
||||
position: relative;
|
||||
width: 100%;
|
||||
flex: 1; position: relative; width: 100%;
|
||||
background-color: transparent;
|
||||
background-image: radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1px);
|
||||
background-size: 24px 24px;
|
||||
overflow: hidden;
|
||||
background-image: radial-gradient(rgba(255,255,255,0.15) 1px, transparent 1px);
|
||||
background-size: 24px 24px; overflow: hidden;
|
||||
cursor: grab; /* Indicates pannable area */
|
||||
}
|
||||
.lg-workspace:active { cursor: grabbing; }
|
||||
|
||||
.lg-svg-layer {
|
||||
.lg-viewport {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
transform-origin: 0 0;
|
||||
pointer-events: none; /* Let events reach workspace, nodes will re-enable it */
|
||||
}
|
||||
|
||||
/* Zoom UI Controls */
|
||||
.lg-zoom-controls {
|
||||
position: absolute; bottom: 20px; left: 20px; z-index: 100;
|
||||
display: flex; gap: 8px;
|
||||
}
|
||||
.lg-zoom-btn {
|
||||
width: 40px; height: 40px; border-radius: 8px; font-family: var(--ui-font);
|
||||
font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center;
|
||||
background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.15);
|
||||
color: #e8e8ee; cursor: pointer; backdrop-filter: blur(8px); transition: all 0.2s;
|
||||
}
|
||||
.lg-zoom-btn:hover { background: rgba(255,255,255,0.1); border-color: #28f07a; color: #28f07a; }
|
||||
|
||||
.lg-svg-layer {
|
||||
position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1;
|
||||
}
|
||||
|
||||
/* Wires */
|
||||
.lg-wire {
|
||||
stroke: rgba(255,255,255,0.25);
|
||||
stroke-width: 6;
|
||||
fill: none;
|
||||
stroke-linecap: round;
|
||||
stroke: rgba(255,255,255,0.25); stroke-width: 6; fill: none; stroke-linecap: round;
|
||||
transition: stroke 0.1s ease, filter 0.1s ease, stroke-width 0.1s ease;
|
||||
pointer-events: stroke;
|
||||
cursor: pointer;
|
||||
}
|
||||
.lg-wire:hover {
|
||||
stroke: rgba(255,255,255,0.6);
|
||||
stroke-width: 10;
|
||||
}
|
||||
.lg-wire.active {
|
||||
stroke: #28f07a;
|
||||
filter: drop-shadow(0 0 6px rgba(40,240,122,0.6));
|
||||
pointer-events: stroke; cursor: pointer;
|
||||
}
|
||||
.lg-wire:hover { stroke: rgba(255,255,255,0.6); stroke-width: 10; }
|
||||
.lg-wire.active { stroke: #28f07a; filter: drop-shadow(0 0 6px rgba(40,240,122,0.6)); }
|
||||
.lg-wire.active:hover { stroke: #5dff9e; }
|
||||
.lg-wire.selected {
|
||||
stroke: #ff5555 !important;
|
||||
stroke-width: 8 !important;
|
||||
stroke-dasharray: 8 8;
|
||||
filter: drop-shadow(0 0 8px rgba(255,85,85,0.8)) !important;
|
||||
animation: wireDash 1s linear infinite;
|
||||
stroke: #ff5555 !important; stroke-width: 8 !important; stroke-dasharray: 8 8;
|
||||
filter: drop-shadow(0 0 8px rgba(255,85,85,0.8)) !important; animation: wireDash 1s linear infinite;
|
||||
}
|
||||
@keyframes wireDash { to { stroke-dashoffset: -16; } }
|
||||
|
||||
.lg-wire-temp {
|
||||
stroke: rgba(255,255,255,0.4);
|
||||
stroke-dasharray: 8 8;
|
||||
pointer-events: none;
|
||||
}
|
||||
.lg-wire-temp { stroke: rgba(255,255,255,0.4); stroke-dasharray: 8 8; pointer-events: none; }
|
||||
|
||||
/* Nodes */
|
||||
.lg-node {
|
||||
position: absolute;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
padding: 4px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
cursor: grab;
|
||||
z-index: 10;
|
||||
user-select: none;
|
||||
transition: filter 0.2s;
|
||||
position: absolute; background: transparent; border: none; border-radius: 0; padding: 4px;
|
||||
display: flex; flex-direction: column; align-items: center; cursor: grab;
|
||||
z-index: 10; user-select: none; transition: filter 0.2s;
|
||||
pointer-events: auto; /* Re-enables interaction inside the viewport */
|
||||
}
|
||||
.lg-node:active { cursor: grabbing; z-index: 20; }
|
||||
.lg-node.selected { filter: drop-shadow(0 0 10px rgba(255,85,85,0.8)); }
|
||||
|
||||
.lg-header {
|
||||
font-size: 24px;
|
||||
color: var(--muted);
|
||||
font-family: var(--bit-font);
|
||||
letter-spacing: 2px;
|
||||
pointer-events: none;
|
||||
margin-bottom: 6px;
|
||||
font-size: 24px; color: var(--muted); font-family: var(--bit-font);
|
||||
letter-spacing: 2px; pointer-events: none; margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.lg-gate-container {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
}
|
||||
.lg-gate-container { position: relative; display: inline-flex; align-items: center; }
|
||||
.lg-gate-svg { width: 100px; height: 50px; display: block; }
|
||||
.lg-line-svg { width: 30px; height: 50px; display: block; }
|
||||
|
||||
@@ -163,18 +111,14 @@ body:has(#logicPage) .pageWrap {
|
||||
.lg-port {
|
||||
width: 16px; height: 16px; background: #a9acb8; border-radius: 50%; cursor: crosshair;
|
||||
border: 3px solid var(--bg); box-shadow: 0 0 0 1px rgba(255,255,255,0.2); transition: all 0.2s;
|
||||
position: absolute; z-index: 5;
|
||||
transform: translate(-50%, -50%);
|
||||
position: absolute; z-index: 5; transform: translate(-50%, -50%);
|
||||
}
|
||||
.lg-port:hover { transform: translate(-50%, -50%) scale(1.3); background: #fff; }
|
||||
.lg-port.active { background: #28f07a; box-shadow: 0 0 12px rgba(40,240,122,0.8); border-color: #1f2027; }
|
||||
|
||||
/* === FLOATING TOOLBOX === */
|
||||
.toolboxToggle {
|
||||
position: absolute;
|
||||
top: 10px; /* Snug inside the thinner header */
|
||||
right: 20px;
|
||||
z-index: 90;
|
||||
position: absolute; top: 10px; right: 20px; z-index: 90;
|
||||
display: flex; align-items: center; gap: 10px; padding: 8px 14px;
|
||||
border-radius: 12px; border: 1px solid rgba(255,255,255,.12); background: rgba(0,0,0,.15);
|
||||
backdrop-filter: blur(8px); color: rgba(232,232,238,.95); font-family: var(--bit-font);
|
||||
@@ -184,53 +128,29 @@ body:has(#logicPage) .pageWrap {
|
||||
.toolboxToggle:hover { border-color: rgba(255,255,255,.22); }
|
||||
|
||||
.lg-toolbox {
|
||||
position: absolute;
|
||||
top: 60px; /* Sits right under the new thin header */
|
||||
right: 20px;
|
||||
bottom: 20px; /* Constrains the height so it scrolls internally */
|
||||
width: var(--toolbox-w, 360px);
|
||||
z-index: 80;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
transform: translateX(0);
|
||||
position: absolute; top: 60px; right: 20px; bottom: 20px; width: var(--toolbox-w, 360px);
|
||||
z-index: 80; display: flex; flex-direction: column; gap: 16px; transform: translateX(0);
|
||||
transition: transform 420ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease;
|
||||
overflow-y: auto;
|
||||
pointer-events: auto;
|
||||
padding-right: 6px;
|
||||
overflow-y: auto; pointer-events: auto; padding-right: 6px;
|
||||
}
|
||||
|
||||
/* Faded Subdued Scrollbars */
|
||||
.lg-toolbox::-webkit-scrollbar { width: 6px; }
|
||||
.lg-toolbox::-webkit-scrollbar-track { background: transparent; }
|
||||
.lg-toolbox::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.05); border-radius: 10px; transition: background 0.3s; }
|
||||
.lg-toolbox:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }
|
||||
.lg-toolbox::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }
|
||||
.lg-container.toolboxCollapsed .lg-toolbox { transform: translateX(calc(100% + 40px)); opacity: 0; pointer-events: none; }
|
||||
|
||||
.lg-container.toolboxCollapsed .lg-toolbox {
|
||||
transform: translateX(calc(100% + 40px));
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Toolbox Grid */
|
||||
.tb-icon-grid {
|
||||
display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
|
||||
}
|
||||
.tb-icon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
|
||||
.tb-icon-box {
|
||||
background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.15);
|
||||
border-radius: 12px; width: 100%; padding: 12px 0;
|
||||
background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.15); border-radius: 12px; width: 100%; padding: 12px 0;
|
||||
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
|
||||
cursor: grab; transition: background 0.2s, border-color 0.2s;
|
||||
}
|
||||
.tb-icon-box:hover { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); }
|
||||
.tb-icon-label { font-family: var(--ui-font); font-size: 11px; font-weight: 800; color: var(--text); letter-spacing: 1px; text-transform: uppercase; }
|
||||
|
||||
/* Truth Table */
|
||||
.tt-summary {
|
||||
font-family: var(--ui-font); font-size: 14px; font-weight: 800;
|
||||
color: var(--accent, #28f07a); cursor: pointer; user-select: none;
|
||||
outline: none; margin-bottom: 10px; text-transform: uppercase;
|
||||
font-family: var(--ui-font); font-size: 14px; font-weight: 800; color: var(--accent, #28f07a);
|
||||
cursor: pointer; user-select: none; outline: none; margin-bottom: 10px; text-transform: uppercase;
|
||||
}
|
||||
.tt-table-wrap {
|
||||
width: 100%; max-height: 250px; overflow-y: auto; overflow-x: auto;
|
||||
@@ -239,8 +159,6 @@ body:has(#logicPage) .pageWrap {
|
||||
.tt-table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
|
||||
.tt-table-wrap::-webkit-scrollbar-track { background: transparent; }
|
||||
.tt-table-wrap::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
|
||||
.tt-table-wrap:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); }
|
||||
|
||||
.tt-table { width: 100%; border-collapse: collapse; text-align: center; font-family: var(--num-font); font-size: 14px; color: #e8e8ee; }
|
||||
.tt-table th { position: sticky; top: 0; background: rgba(31,32,39,0.95); padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.15); color: var(--muted); font-family: var(--bit-font); font-weight: normal; }
|
||||
.tt-table td { padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.05); }
|
||||
|
||||
Reference in New Issue
Block a user