- Redesigned toolbar with I/O, Gates, and Components sections - Component editor: sub-canvas mode to design reusable chips - Save/Cancel with main circuit state preservation - Components persist in localStorage - Custom components render as purple chips with dynamic I/O ports - Component evaluation simulates internal circuit as black box - Toolbar height increased to 56px for section labels - All height references updated consistently Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
// Gate dimensions and rendering constants
|
|
export const GATE_W = 100;
|
|
export const GATE_H = 60;
|
|
export const COMP_W = 120;
|
|
export const PORT_R = 7;
|
|
|
|
export const GATE_COLORS = {
|
|
AND: '#00e599', OR: '#3388ff', NOT: '#ff6644',
|
|
NAND: '#e5cc00', NOR: '#cc44ff', XOR: '#ff44aa',
|
|
INPUT: '#3388ff', CLOCK: '#ff44aa', OUTPUT: '#ff8833'
|
|
};
|
|
|
|
export const SIGNAL_COLORS = [
|
|
'#00e599', '#3388ff', '#ff6644', '#e5cc00',
|
|
'#cc44ff', '#ff44aa', '#ff8833', '#44ddff',
|
|
'#88ff44', '#ff4488', '#44ffaa', '#ffaa44'
|
|
];
|
|
|
|
export function gateInputCount(type) {
|
|
if (type === 'CLOCK' || type === 'INPUT') return 0;
|
|
if (type === 'NOT' || type === 'OUTPUT') return 1;
|
|
if (type.startsWith('COMPONENT:')) {
|
|
// Component types look up their input count from state
|
|
return 0; // Will be overridden by lookup in gates.js
|
|
}
|
|
return 2;
|
|
}
|
|
|
|
export function gateOutputCount(type) {
|
|
if (type === 'OUTPUT') return 0;
|
|
if (type.startsWith('COMPONENT:')) {
|
|
// Component types look up their output count from state
|
|
return 0; // Will be overridden by lookup in gates.js
|
|
}
|
|
return 1;
|
|
}
|