← Commit history

2cz4006: viewers

Ray ·ce0416e5a7 · ·parent bb3fd31
2 files changed +5−4
viewers/footprint.html+1−1
@@ -57,7 +57,7 @@ aside .ah{padding:9px 12px;border-bottom:1px solid var(--border);font-size:12px;   <main>     <div class="vpwrap">       <div class="av-vp" id="vp">-        <svg xmlns="http://www.w3.org/2000/svg" viewBox="-3.250 -1.750 6.500 3.500" preserveAspectRatio="xMidYMid meet"><g class="adom-layer-courtyard"><line x1="-2.3500" y1="-1.1500" x2="-2.3500" y2="1.1500" stroke="#FF26E2" stroke-width="0.050" stroke-linecap="round" fill="none"/><line x1="-2.3500" y1="-1.1500" x2="2.3500" y2="-1.1500" stroke="#FF26E2" stroke-width="0.050" stroke-linecap="round" fill="none"/><line x1="2.3500" y1="-1.1500" x2="2.3500" y2="1.1500" stroke="#FF26E2" stroke-width="0.050" stroke-linecap="round" fill="none"/><line x1="2.3500" y1="1.1500" x2="-2.3500" y2="1.1500" stroke="#FF26E2" stroke-width="0.050" stroke-linecap="round" fill="none"/></g><g class="adom-layer-fab"><line x1="-1.4000" y1="-0.9000" x2="1.4000" y2="-0.9000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-1.4000" y1="0.9000" x2="-1.4000" y2="-0.9000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-0.7500" y1="0.0000" x2="-0.3500" y2="0.0000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-0.3500" y1="0.0000" x2="-0.3500" y2="-0.5500" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-0.3500" y1="0.0000" x2="-0.3500" y2="0.5500" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-0.3500" y1="0.0000" x2="0.2500" y2="-0.4000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="0.2500" y1="-0.4000" x2="0.2500" y2="0.4000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="0.2500" y1="0.0000" x2="0.7500" y2="0.0000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="0.2500" y1="0.4000" x2="-0.3500" y2="0.0000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="1.4000" y1="-0.9000" x2="1.4000" y2="0.9000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="1.4000" y1="0.9000" x2="-1.4000" y2="0.9000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/></g><g class="adom-layer-copper"><g data-pad="1" data-shape="roundrect" data-size="0.900x1.200" data-mount="smd"><rect x="-2.100" y="-0.600" width="0.900" height="1.200" rx="0.225" fill="#C83434" stroke="#ef5350" stroke-width="0.04"/></g><g data-pad="2" data-shape="roundrect" data-size="0.900x1.200" data-mount="smd"><rect x="1.200" y="-0.600" width="0.900" height="1.200" rx="0.225" fill="#C83434" stroke="#ef5350" stroke-width="0.04"/></g></g><g class="adom-layer-heatsink"></g><g class="adom-layer-drill"></g><g class="adom-layer-silk"><line x1="-2.3600" y1="-1.0000" x2="-2.3600" y2="1.0000" stroke="#00cccc" stroke-width="0.120" stroke-linecap="round" fill="none"/><line x1="-2.3600" y1="-1.0000" x2="1.6500" y2="-1.0000" stroke="#00cccc" stroke-width="0.120" stroke-linecap="round" fill="none"/><line x1="-2.3600" y1="1.0000" x2="1.6500" y2="1.0000" stroke="#00cccc" stroke-width="0.120" stroke-linecap="round" fill="none"/></g><g class="adom-layer-padnum"><text x="-1.650" y="0.000" text-anchor="middle" dominant-baseline="central" font-size="0.378" fill="#fff" font-family="sans-serif" style="pointer-events:none">1</text><text x="1.650" y="0.000" text-anchor="middle" dominant-baseline="central" font-size="0.378" fill="#fff" font-family="sans-serif" style="pointer-events:none">2</text></g><g class="adom-layer-paste-apertures"><rect x="-2.100" y="-0.600" width="0.900" height="1.200" rx="0.05" transform="rotate(0.00 -1.650 0.000)" fill="none" stroke="#8aa0b8" stroke-width="0.03" stroke-dasharray="0.12 0.08" opacity="0.7"/><rect x="1.200" y="-0.600" width="0.900" height="1.200" rx="0.05" transform="rotate(0.00 1.650 0.000)" fill="none" stroke="#8aa0b8" stroke-width="0.03" stroke-dasharray="0.12 0.08" opacity="0.7"/></g><g class="adom-layer-paste-dots"><circle cx="-1.775" cy="-0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.775" cy="-0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.775" cy="0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.775" cy="0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.525" cy="-0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.525" cy="-0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.525" cy="0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.525" cy="0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.525" cy="-0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.525" cy="-0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.525" cy="0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.525" cy="0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.775" cy="-0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.775" cy="-0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.775" cy="0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.775" cy="0.375" r="0.150" fill="#37c8a6" opacity="0.92"/></g></svg>+        <svg xmlns="http://www.w3.org/2000/svg" viewBox="-3.250 -1.750 6.500 3.500" preserveAspectRatio="xMidYMid meet"><g class="adom-layer-courtyard"><polygon points="-2.3500,-0.8500 -1.6500,-0.8500 -1.6500,-1.1500 1.6500,-1.1500 1.6500,-0.8500 2.3500,-0.8500 2.3500,0.8500 1.6500,0.8500 1.6500,1.1500 -1.6500,1.1500 -1.6500,0.8500 -2.3500,0.8500" stroke="#FF26E2" stroke-width="0.050" fill="none"/></g><g class="adom-layer-fab"><line x1="-1.4000" y1="-0.9000" x2="1.4000" y2="-0.9000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-1.4000" y1="0.9000" x2="-1.4000" y2="-0.9000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-0.7500" y1="0.0000" x2="-0.3500" y2="0.0000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-0.3500" y1="0.0000" x2="-0.3500" y2="-0.5500" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-0.3500" y1="0.0000" x2="-0.3500" y2="0.5500" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="-0.3500" y1="0.0000" x2="0.2500" y2="-0.4000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="0.2500" y1="-0.4000" x2="0.2500" y2="0.4000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="0.2500" y1="0.0000" x2="0.7500" y2="0.0000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="0.2500" y1="0.4000" x2="-0.3500" y2="0.0000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="1.4000" y1="-0.9000" x2="1.4000" y2="0.9000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/><line x1="1.4000" y1="0.9000" x2="-1.4000" y2="0.9000" stroke="#6e7681" stroke-width="0.100" stroke-linecap="round" fill="none"/></g><g class="adom-layer-copper"><g data-pad="1" data-shape="roundrect" data-size="0.900x1.200" data-mount="smd"><rect x="-2.100" y="-0.600" width="0.900" height="1.200" rx="0.225" fill="#C83434" stroke="#ef5350" stroke-width="0.04"/></g><g data-pad="2" data-shape="roundrect" data-size="0.900x1.200" data-mount="smd"><rect x="1.200" y="-0.600" width="0.900" height="1.200" rx="0.225" fill="#C83434" stroke="#ef5350" stroke-width="0.04"/></g></g><g class="adom-layer-heatsink"></g><g class="adom-layer-drill"></g><g class="adom-layer-silk"><line x1="-2.3600" y1="-1.0000" x2="-2.3600" y2="1.0000" stroke="#00cccc" stroke-width="0.120" stroke-linecap="round" fill="none"/><line x1="-2.3600" y1="-1.0000" x2="1.6500" y2="-1.0000" stroke="#00cccc" stroke-width="0.120" stroke-linecap="round" fill="none"/><line x1="-2.3600" y1="1.0000" x2="1.6500" y2="1.0000" stroke="#00cccc" stroke-width="0.120" stroke-linecap="round" fill="none"/></g><g class="adom-layer-padnum"><text x="-1.650" y="0.000" text-anchor="middle" dominant-baseline="central" font-size="0.378" fill="#fff" font-family="sans-serif" style="pointer-events:none">1</text><text x="1.650" y="0.000" text-anchor="middle" dominant-baseline="central" font-size="0.378" fill="#fff" font-family="sans-serif" style="pointer-events:none">2</text></g><g class="adom-layer-paste-apertures"><rect x="-2.100" y="-0.600" width="0.900" height="1.200" rx="0.05" transform="rotate(0.00 -1.650 0.000)" fill="none" stroke="#8aa0b8" stroke-width="0.03" stroke-dasharray="0.12 0.08" opacity="0.7"/><rect x="1.200" y="-0.600" width="0.900" height="1.200" rx="0.05" transform="rotate(0.00 1.650 0.000)" fill="none" stroke="#8aa0b8" stroke-width="0.03" stroke-dasharray="0.12 0.08" opacity="0.7"/></g><g class="adom-layer-paste-dots"><circle cx="-1.775" cy="-0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.775" cy="-0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.775" cy="0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.775" cy="0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.525" cy="-0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.525" cy="-0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.525" cy="0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="-1.525" cy="0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.525" cy="-0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.525" cy="-0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.525" cy="0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.525" cy="0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.775" cy="-0.375" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.775" cy="-0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.775" cy="0.125" r="0.150" fill="#37c8a6" opacity="0.92"/><circle cx="1.775" cy="0.375" r="0.150" fill="#37c8a6" opacity="0.92"/></g></svg>       </div>     </div>     <aside>
viewers/symbol.html+4−3
@@ -23,10 +23,10 @@ rect.pad.hi{stroke:var(--hi);stroke-width:.15;paint-order:stroke} #tip .td{font-size:11px;color:var(--ink);margin-top:5px;line-height:1.4} </style></head><body> <div class=bar><span class=h>Schematic symbol</span><span class=sp></span></div>-<div class=stage id=stage><svg xmlns='http://www.w3.org/2000/svg' viewBox='-750 -150 1500 300' style='width:100%;height:100%'><rect x='-500.0' y='-100.0' width='1000.0' height='200.0' fill='#e35d5d22' stroke='#e35d5d' stroke-width='4'/><g class='pingroup' data-num='1' data-name='Cathode'><line class='pinvis' x1='-700.0' y1='-0.0' x2='-500.0' y2='-0.0' stroke='#dfe4ec' stroke-width='4'/><line x1='-700.0' y1='-0.0' x2='-500.0' y2='-0.0' stroke='transparent' stroke-width='26' pointer-events='stroke'/></g><text x='-600.0' y='45.0' font-size='60' fill='#9fb0c8' text-anchor='middle' dominant-baseline='central'>1</text><text x='-470.0' y='0.0' font-size='60' fill='#e6e9ef' text-anchor='start' dominant-baseline='central'>Cathode</text><g class='pingroup' data-num='2' data-name='Anode'><line class='pinvis' x1='700.0' y1='-0.0' x2='500.0' y2='-0.0' stroke='#dfe4ec' stroke-width='4'/><line x1='700.0' y1='-0.0' x2='500.0' y2='-0.0' stroke='transparent' stroke-width='26' pointer-events='stroke'/></g><text x='600.0' y='-45.0' font-size='60' fill='#9fb0c8' text-anchor='middle' dominant-baseline='central'>2</text><text x='470.0' y='0.0' font-size='60' fill='#e6e9ef' text-anchor='end' dominant-baseline='central'>Anode</text></svg></div>+<div class=stage id=stage><svg xmlns='http://www.w3.org/2000/svg' viewBox='-200 -100 400 200' style='width:100%;height:100%'><polyline points='-50.0,-50.0 -50.0,50.0' fill='none' stroke='#e35d5d' stroke-width='4'/><polyline points='50.0,-50.0 50.0,50.0 -50.0,-0.0 50.0,-50.0' fill='none' stroke='#e35d5d' stroke-width='4'/><polyline points='50.0,-0.0 -50.0,-0.0' fill='none' stroke='#e35d5d' stroke-width='4'/><g class='pingroup' data-num='1' data-name='K'><line class='pinvis' x1='-150.0' y1='-0.0' x2='-50.0' y2='-0.0' stroke='#dfe4ec' stroke-width='4'/><line x1='-150.0' y1='-0.0' x2='-50.0' y2='-0.0' stroke='transparent' stroke-width='26' pointer-events='stroke'/></g><g class='pingroup' data-num='2' data-name='A'><line class='pinvis' x1='150.0' y1='-0.0' x2='50.0' y2='-0.0' stroke='#dfe4ec' stroke-width='4'/><line x1='150.0' y1='-0.0' x2='50.0' y2='-0.0' stroke='transparent' stroke-width='26' pointer-events='stroke'/></g></svg></div> <div id=tip></div> <script>-var KIND="symbol", MPN="ADOM/2CZ4006", PINS=[{"desc":"","name":"Cathode","number":"1","type":""},{"desc":"","name":"Anode","number":"2","type":""}];+var KIND="symbol", MPN="ADOM/2CZ4006", PINS=[{"desc":"","name":"K","number":"1","type":""},{"desc":"","name":"A","number":"2","type":""}]; var byNum={}; PINS.forEach(function(p){byNum[String(p.number)]=p;}); var stage=document.getElementById('stage'), svg=stage.querySelector('svg'), tip=document.getElementById('tip'); // ---- pan/zoom ----@@ -44,7 +44,8 @@ function els(n){return [].slice.call(document.querySelectorAll('[data-num="'+n+' function clearHi(){[].slice.call(document.querySelectorAll('.hi')).forEach(function(e){e.classList.remove('hi');});} function hi(n){els(n).forEach(function(e){e.classList.add('hi');});} function post(n){try{parent.postMessage({type:'lbr-hover',pin:n===null?null:String(n),mpn:MPN},'*');}catch(_){}}-function showTip(n,x,y){var p=byNum[String(n)];if(!p)return;tip.innerHTML='<span class=tn></span><div class=tt></div><div class=td></div>';tip.querySelector('.tn').textContent=n+'  '+(p.name||'');tip.querySelector('.tt').textContent=p.type||'';var d=p.desc||'';if(d)tip.querySelector('.td').textContent=d;else tip.querySelector('.td').style.display='none';tip.style.display='block';tip.style.left=(x+14)+'px';tip.style.top=(y+12)+'px';}+function ovName(el,pre,nm){el.textContent=pre;var r=nm,i;while((i=r.indexOf('~{'))>=0){el.appendChild(document.createTextNode(r.slice(0,i)));var a=r.slice(i+2),j=a.indexOf('}'),s=document.createElement('span');s.style.textDecoration='overline';s.textContent=j<0?a:a.slice(0,j);el.appendChild(s);r=j<0?'':a.slice(j+1);}el.appendChild(document.createTextNode(r));}+function showTip(n,x,y){var p=byNum[String(n)];if(!p)return;tip.innerHTML='<span class=tn></span><div class=tt></div><div class=td></div>';ovName(tip.querySelector('.tn'),n+'  ',p.name||'');tip.querySelector('.tt').textContent=p.type||'';var d=p.desc||'';if(d)tip.querySelector('.td').textContent=d;else tip.querySelector('.td').style.display='none';tip.style.display='block';tip.style.left=(x+14)+'px';tip.style.top=(y+12)+'px';} [].slice.call(document.querySelectorAll('.pingroup,.pad')).forEach(function(g){   var n=g.getAttribute('data-num');   g.addEventListener('mouseenter',function(e){clearHi();hi(n);post(n);showTip(n,e.clientX,e.clientY);});