Skip to content

Commit ffd11eb

Browse files
committed
Hide non-active PCB layers instead of dimming them
1 parent 64c89af commit ffd11eb

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/lib/Drawer.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ export class Drawer {
497497
* Iterate over each canvas and set the z index based on the layer order, but
498498
* always render the foreground layer on top.
499499
*
500-
* Also: Set the opacity of every non-foreground layer to 0.5
500+
* Also: Hide non-active layers while keeping board/drill/edge cuts and
501+
* same-side helper layers visible.
501502
*/
502503
orderAndFadeLayers() {
503504
const { canvasLayerMap, foregroundLayer } = this
@@ -532,7 +533,7 @@ export class Drawer {
532533
? "bottom_courtyard"
533534
: undefined
534535

535-
const opaqueLayers = new Set<string>([
536+
const visibleLayers = new Set<string>([
536537
foregroundLayer,
537538
"drill",
538539
"edge_cuts",
@@ -567,12 +568,18 @@ export class Drawer {
567568
"drill",
568569
]
569570

571+
for (const canvas of Object.values(canvasLayerMap)) {
572+
canvas.style.opacity = "0"
573+
canvas.style.visibility = "hidden"
574+
}
575+
570576
order.forEach((layer, i) => {
571577
const canvas = canvasLayerMap[layer]
572578
if (!canvas) return
573579

574580
canvas.style.zIndex = `${zIndexMap.topLayer - (order.length - i)}`
575-
canvas.style.opacity = opaqueLayers.has(layer) ? "1" : "0.5"
581+
canvas.style.opacity = visibleLayers.has(layer) ? "1" : "0"
582+
canvas.style.visibility = visibleLayers.has(layer) ? "visible" : "hidden"
576583
})
577584
}
578585

0 commit comments

Comments
 (0)