← Commit history

Symbol and footprint viewers cross-highlight on hover (lbr-hover bus)

John Lauer ·e15374ba8e ·18d ago ·parent b2b8af3
2 files changed +8−2
0603B104J500CT-fpview.html+4−1
@@ -682,7 +682,10 @@     tooltip.style.top = ty + 'px';   } +  /* lbr-hover-bus v1 */ window.addEventListener('message',function(e){var d=e.data||{};if(d.type!=='lbr-hover')return;clearHighlight();if(d.pin==null||!svgEl)return;svgEl.querySelectorAll('rect[data-pad]').forEach(function(r){if(r.getAttribute('data-pad')===String(d.pin)){r.setAttribute('stroke','#00b8b1');r.setAttribute('stroke-width','0.12');r.setAttribute('fill','rgba(0,184,177,0.2)');highlightedRects.push(r);}});});   function showPadTooltip(x, y, pad, rect) {+    try{parent.postMessage({type:'lbr-hover',pin:String(pad.number)},'*')}catch(_){}+         if (stickyPad !== null) return; // suppress hover while sticky      clearHighlight();@@ -697,7 +700,7 @@     positionTooltip(x, y);   } -  function hidePadTooltip(rect) {+  function hidePadTooltip(rect) { try{parent.postMessage({type:'lbr-hover',pin:null},'*')}catch(_){}     if (stickyPad !== null) return; // don't hide while sticky     tooltip.classList.remove('visible');     clearHighlight();
0603B104J500CT-symview.html+4−1
@@ -676,7 +676,10 @@ stroke-linecap:round; stroke-linejoin:round;">     }   } +  /* lbr-hover-bus v1 */ window.addEventListener('message',function(e){var d=e.data||{};if(d.type!=='lbr-hover')return;window.__lbrBus=true;try{if(d.pin==null)clearHighlight();else{var p=(typeof pins!=='undefined'?pins:[]).find(function(x){return String(x.number)===String(d.pin)});if(p)highlightPin(p);else clearHighlight();}}finally{window.__lbrBus=false;}});   function highlightPin(pin) {+    if(!window.__lbrBus)try{parent.postMessage({type:'lbr-hover',pin:String(pin.number)},'*')}catch(_){}+         clearHighlight();     // IC symbols: stroked-text groups     [pin.name, pin.number].forEach(label => {@@ -756,7 +759,7 @@ stroke-linecap:round; stroke-linejoin:round;">     positionTooltip(x, y);   } -  function hideTooltip() {+  function hideTooltip() { if(!window.__lbrBus)try{parent.postMessage({type:'lbr-hover',pin:null},'*')}catch(_){}     if (stickyPin) return;     tooltip.classList.remove('visible');     clearHighlight();