diff --git a/src/examples/multi-layer/eight-layer-circuit.fixture.tsx b/src/examples/multi-layer/eight-layer-circuit.fixture.tsx
deleted file mode 100644
index bb47500e..00000000
--- a/src/examples/multi-layer/eight-layer-circuit.fixture.tsx
+++ /dev/null
@@ -1,130 +0,0 @@
-import { PCBViewer } from "../../PCBViewer"
-import type { AnyCircuitElement } from "circuit-json"
-
-const EightLayerCircuit = () => {
- const circuitJson: AnyCircuitElement[] = [
- {
- type: "pcb_board",
- pcb_board_id: "pcb_board_0",
- center: { x: 0, y: 0 },
- width: 60,
- height: 25,
- material: "fr4",
- num_layers: 8,
- thickness: 1.6,
- },
- // Single pad on top layer
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_top",
- x: -21,
- y: 0,
- width: 2,
- height: 1,
- layer: "top",
- shape: "rect",
- },
- // Single pad on inner1 layer
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner1",
- x: -15,
- y: 0,
- width: 2,
- height: 1,
- layer: "inner1",
- shape: "rect",
- },
- // Single pad on inner2 layer
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner2",
- x: -9,
- y: 0,
- width: 2,
- height: 1,
- layer: "inner2",
- shape: "rect",
- },
- // Single pad on inner3 layer
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner3",
- x: -3,
- y: 0,
- width: 2,
- height: 1,
- layer: "inner3",
- shape: "rect",
- },
- // Single pad on inner4 layer
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner4",
- x: 3,
- y: 0,
- width: 2,
- height: 1,
- layer: "inner4",
- shape: "rect",
- },
- // Single pad on inner5 layer
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner5",
- x: 9,
- y: 0,
- width: 2,
- height: 1,
- layer: "inner5",
- shape: "rect",
- },
- // Single pad on inner6 layer
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner6",
- x: 15,
- y: 0,
- width: 2,
- height: 1,
- layer: "inner6",
- shape: "rect",
- },
- // Single pad on bottom layer
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_bottom",
- x: 21,
- y: 0,
- width: 2,
- height: 1,
- layer: "bottom",
- shape: "rect",
- },
- ]
-
- return (
-
-
-
8-Layer Circuit - Simple Layout
-
- This circuit has 8 layers with one pad per layer, all side by side
-
-
- Expected layer dropdown: [top, inner1, inner2, inner3, inner4, inner5,
- inner6, bottom]
-
-
- Layout: TOP | I1 | I2 | I3 | I4 | I5 | I6 | BOTTOM
-
-
- This tests the maximum layer count (8 layers) with all hotkeys 1-8
- working
-
-
-
-
- )
-}
-
-export default EightLayerCircuit
diff --git a/src/examples/multi-layer/overlapping-layers-test.fixture.tsx b/src/examples/multi-layer/overlapping-layers-test.fixture.tsx
deleted file mode 100644
index c3d0b1a0..00000000
--- a/src/examples/multi-layer/overlapping-layers-test.fixture.tsx
+++ /dev/null
@@ -1,138 +0,0 @@
-import { PCBViewer } from "../../PCBViewer"
-import type { AnyCircuitElement } from "circuit-json"
-
-const OverlappingLayersTest = () => {
- const circuitJson: AnyCircuitElement[] = [
- {
- type: "pcb_board",
- pcb_board_id: "pcb_board_0",
- center: { x: 0, y: 0 },
- width: 30,
- height: 20,
- material: "fr4",
- num_layers: 8,
- thickness: 1.6,
- },
- // All pads at the SAME position to test z-index stacking
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_top",
- x: 0,
- y: 0,
- width: 5,
- height: 5,
- layer: "top",
- shape: "rect",
- },
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner1",
- x: 0,
- y: 0,
- width: 4.5,
- height: 4.5,
- layer: "inner1",
- shape: "rect",
- },
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner2",
- x: 0,
- y: 0,
- width: 4,
- height: 4,
- layer: "inner2",
- shape: "rect",
- },
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner3",
- x: 0,
- y: 0,
- width: 3.5,
- height: 3.5,
- layer: "inner3",
- shape: "rect",
- },
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner4",
- x: 0,
- y: 0,
- width: 3,
- height: 3,
- layer: "inner4",
- shape: "rect",
- },
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner5",
- x: 0,
- y: 0,
- width: 2.5,
- height: 2.5,
- layer: "inner5",
- shape: "rect",
- },
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_inner6",
- x: 0,
- y: 0,
- width: 2,
- height: 2,
- layer: "inner6",
- shape: "rect",
- },
- {
- type: "pcb_smtpad",
- pcb_smtpad_id: "pcb_smtpad_bottom",
- x: 0,
- y: 0,
- width: 1.5,
- height: 1.5,
- layer: "bottom",
- shape: "rect",
- },
- ]
-
- return (
-
-
-
Overlapping Layers Z-Index Test
-
- All 8 layers have pads at the SAME position (0, 0) with decreasing
- sizes
-
-
- How to verify:
-
-
- -
- Select "top" layer - You should see the RED top pad (largest) fully
- opaque on top
-
- -
- Select "inner1" - You should see the GREEN inner1 pad fully opaque
- on top
-
- -
- Select "inner2" - You should see the ORANGE inner2 pad fully opaque
- on top
-
- -
- Continue testing each layer - the selected layer should ALWAYS be on
- top
-
- - All other layers should be visible at 50% opacity beneath
-
-
- Use hotkeys 1-8 or the layer dropdown to switch between layers
-
-
-
-
- )
-}
-
-export default OverlappingLayersTest
diff --git a/src/lib/Drawer.ts b/src/lib/Drawer.ts
index fd4819c2..2254ff9a 100644
--- a/src/lib/Drawer.ts
+++ b/src/lib/Drawer.ts
@@ -36,7 +36,7 @@ export const LAYER_NAME_TO_COLOR = {
top: colors.board.copper.f,
inner1: colors.board.copper.in1,
inner2: colors.board.copper.in2,
- inner3: colors.board.copper.in3,
+
inner4: colors.board.copper.in4,
inner5: colors.board.copper.in5,
inner6: colors.board.copper.in6,
@@ -64,16 +64,16 @@ export type LayerNameForColor = keyof typeof LAYER_NAME_TO_COLOR
export const DEFAULT_DRAW_ORDER = [
"board",
- "inner6",
- "inner5",
- "inner4",
- "inner3",
- "inner2",
- "inner1",
- "bottom",
- "bottom_silkscreen",
"top",
"top_silkscreen",
+ "bottom_silkscreen",
+ "bottom",
+ "inner1",
+ "inner2",
+ "inner3",
+ "inner4",
+ "inner5",
+ "inner6",
] as const
export const FILL_TYPES = {
@@ -490,29 +490,22 @@ export class Drawer {
? "bottom_silkscreen"
: "",
])
-
- // Build order with foregroundLayer at the end (highest z-index)
const order = [
- "board",
"drill",
- ...DEFAULT_DRAW_ORDER.filter((l) => l !== foregroundLayer),
+ "board",
foregroundLayer,
+ ...DEFAULT_DRAW_ORDER.filter((l) => l !== foregroundLayer),
]
-
order.forEach((layer, i) => {
const canvas = canvasLayerMap[layer]
if (!canvas) return
-
- // Foreground layer and its associated silkscreen get the highest z-index
- if (layer === foregroundLayer) {
- canvas.style.zIndex = `${zIndexMap.topLayer}`
- } else if (
+ if (
(layer === "bottom_silkscreen" && foregroundLayer === "bottom") ||
(layer === "top_silkscreen" && foregroundLayer === "top")
) {
- canvas.style.zIndex = `${zIndexMap.topLayer + 1}`
+ canvas.style.zIndex = `${zIndexMap.topLayer}` // zIndexMap.topLayer
} else {
- canvas.style.zIndex = `${zIndexMap.topLayer - (order.length - i)}`
+ canvas.style.zIndex = `${zIndexMap.topLayer - i}`
}
canvas.style.opacity = opaqueLayers.has(layer) ? "1" : "0.5"
})