Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 0 additions & 130 deletions src/examples/multi-layer/eight-layer-circuit.fixture.tsx

This file was deleted.

138 changes: 0 additions & 138 deletions src/examples/multi-layer/overlapping-layers-test.fixture.tsx

This file was deleted.

35 changes: 14 additions & 21 deletions src/lib/Drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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}`
Comment on lines 493 to +508

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore foreground layer to highest z-index

The revised orderAndFadeLayers now builds the layer list as ["drill", "board", foregroundLayer, …DEFAULT_DRAW_ORDER] and applies canvas.style.zIndex = zIndexMap.topLayer - i for every entry. Because there is no longer special handling for the foregroundLayer, the drill and board canvases always receive larger z-indices than the selected copper layer, so the chosen layer can sit underneath the board or drill canvases and be obscured. The previous implementation appended foregroundLayer last and explicitly promoted it to zIndexMap.topLayer. Consider restoring that behaviour so the selected layer is guaranteed to render above all others.

Useful? React with 👍 / 👎.

}
canvas.style.opacity = opaqueLayers.has(layer) ? "1" : "0.5"
})
Expand Down