@@ -244,20 +244,19 @@ function drawEdges(canvas, scalefactor) {
244244 }
245245}
246246
247- function drawModules ( canvas , layer , scalefactor , highlightedModules ) {
247+ function drawModules ( canvas , layer , scalefactor , highlight ) {
248248 var ctx = canvas . getContext ( "2d" ) ;
249249 ctx . lineWidth = 3 / scalefactor ;
250250 var style = getComputedStyle ( topmostdiv ) ;
251251 var padcolor = style . getPropertyValue ( '--pad-color' ) ;
252252 var outlinecolor = style . getPropertyValue ( '--pin1-outline-color' ) ;
253- if ( highlightedModules . length > 0 ) {
253+ if ( highlight > 0 ) {
254254 padcolor = style . getPropertyValue ( '--pad-color-highlight' ) ;
255255 outlinecolor = style . getPropertyValue ( '--pin1-outline-color-highlight' ) ;
256256 }
257257 for ( var i = 0 ; i < pcbdata . modules . length ; i ++ ) {
258258 var mod = pcbdata . modules [ i ] ;
259- var highlight = highlightedModules . includes ( i ) ;
260- if ( highlightedModules . length == 0 || highlight ) {
259+ if ( ! highlight || highlightedModules . includes ( i ) ) {
261260 drawModule ( ctx , layer , scalefactor , mod , padcolor , outlinecolor , highlight ) ;
262261 }
263262 }
@@ -287,7 +286,7 @@ function clearCanvas(canvas) {
287286function drawHighlightsOnLayer ( canvasdict ) {
288287 clearCanvas ( canvasdict . highlight ) ;
289288 drawModules ( canvasdict . highlight , canvasdict . layer ,
290- canvasdict . transform . s * canvasdict . transform . zoom , highlightedModules ) ;
289+ canvasdict . transform . s * canvasdict . transform . zoom , true ) ;
291290}
292291
293292function drawHighlights ( ) {
@@ -300,7 +299,7 @@ function drawBackground(canvasdict) {
300299 clearCanvas ( canvasdict . silk ) ;
301300 drawEdges ( canvasdict . bg , canvasdict . transform . s ) ;
302301 drawModules ( canvasdict . bg , canvasdict . layer ,
303- canvasdict . transform . s * canvasdict . transform . zoom , [ ] ) ;
302+ canvasdict . transform . s * canvasdict . transform . zoom , false ) ;
304303 drawSilkscreen ( canvasdict . silk , canvasdict . layer , canvasdict . transform . s ) ;
305304}
306305
@@ -439,7 +438,6 @@ function handleMouseClick(e, layerdict) {
439438 var modules = bboxScan ( layerdict . layer , v [ 0 ] , v [ 1 ] ) ;
440439 if ( modules . length > 0 ) {
441440 modulesClicked ( modules ) ;
442- drawHighlights ( ) ;
443441 }
444442}
445443
0 commit comments