MCPcopy Create free account
hub / github.com/openscopeproject/InteractiveHtmlBom / drawFootprints

Function drawFootprints

InteractiveHtmlBom/web/render.js:377–409  ·  view source on GitHub ↗
(canvas, layer, scalefactor, highlight)

Source from the content-addressed store, hash-verified

375}
376
377function drawFootprints(canvas, layer, scalefactor, highlight) {
378 var ctx = canvas.getContext("2d");
379 ctx.lineWidth = 3 / scalefactor;
380 var style = getComputedStyle(topmostdiv);
381
382 var colors = {
383 pad: style.getPropertyValue('--pad-color'),
384 padHole: style.getPropertyValue('--pad-hole-color'),
385 outline: style.getPropertyValue('--pin1-outline-color'),
386 }
387
388 for (var i = 0; i < pcbdata.footprints.length; i++) {
389 var mod = pcbdata.footprints[i];
390 var outline = settings.renderDnpOutline && pcbdata.bom.skipped.includes(i);
391 var h = highlightedFootprints.includes(i);
392 var d = markedFootprints.has(i);
393 if (highlight) {
394 if(h && d) {
395 colors.pad = style.getPropertyValue('--pad-color-highlight-both');
396 colors.outline = style.getPropertyValue('--pin1-outline-color-highlight-both');
397 } else if (h) {
398 colors.pad = style.getPropertyValue('--pad-color-highlight');
399 colors.outline = style.getPropertyValue('--pin1-outline-color-highlight');
400 } else if (d) {
401 colors.pad = style.getPropertyValue('--pad-color-highlight-marked');
402 colors.outline = style.getPropertyValue('--pin1-outline-color-highlight-marked');
403 }
404 }
405 if( h || d || !highlight) {
406 drawFootprint(ctx, layer, scalefactor, mod, colors, highlight, outline);
407 }
408 }
409}
410
411function drawBgLayer(layername, canvas, layer, scalefactor, edgeColor, polygonColor, textColor) {
412 var ctx = canvas.getContext("2d");

Callers 2

drawHighlightsOnLayerFunction · 0.85
drawBackgroundFunction · 0.85

Calls 1

drawFootprintFunction · 0.85

Tested by

no test coverage detected