(canvas, layer, highlight)
| 504 | } |
| 505 | |
| 506 | function drawNets(canvas, layer, highlight) { |
| 507 | var style = getComputedStyle(topmostdiv); |
| 508 | if (settings.renderZones) { |
| 509 | var zoneColor = style.getPropertyValue(highlight ? '--zone-color-highlight' : '--zone-color'); |
| 510 | drawZones(canvas, layer, zoneColor, highlight); |
| 511 | } |
| 512 | if (settings.renderTracks) { |
| 513 | var trackColor = style.getPropertyValue(highlight ? '--track-color-highlight' : '--track-color'); |
| 514 | drawTracks(canvas, layer, trackColor, highlight); |
| 515 | } |
| 516 | if (highlight && settings.renderPads) { |
| 517 | var padColor = style.getPropertyValue('--pad-color-highlight'); |
| 518 | var padHoleColor = style.getPropertyValue('--pad-hole-color'); |
| 519 | var ctx = canvas.getContext("2d"); |
| 520 | for (var footprint of pcbdata.footprints) { |
| 521 | // draw pads |
| 522 | var padDrawn = false; |
| 523 | for (var pad of footprint.pads) { |
| 524 | if (highlightedNet != pad.net) continue; |
| 525 | if (pad.layers.includes(layer)) { |
| 526 | drawPad(ctx, pad, padColor, false); |
| 527 | padDrawn = true; |
| 528 | } |
| 529 | } |
| 530 | if (padDrawn) { |
| 531 | // redraw all pad holes because some pads may overlap |
| 532 | for (var pad of footprint.pads) { |
| 533 | drawPadHole(ctx, pad, padHoleColor); |
| 534 | } |
| 535 | } |
| 536 | } |
| 537 | } |
| 538 | } |
| 539 | |
| 540 | function drawHighlightsOnLayer(canvasdict, clear = true) { |
| 541 | if (clear) { |
no test coverage detected