Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • quentinbolsee/gerber2img
  • AlanHan/gerber2img
2 results
Select Git revision
Show changes
Commits on Source (7)
body{font-family:Arial,Helvetica,sans-serif}input{max-width:30%}p{color:#000}h3{margin-left:4px;margin-top:20px;margin-bottom:4px}h1{margin-top:4px;margin-bottom:8px}p.lock{cursor:default;margin:0}p#dropText{font-size:100px}.container{display:flex}button{border:none}button.interface{background-color:#c8c8c8;padding:4px;border-radius:6px;margin:4px;width:28%;min-width:80px}button.interface:hover{background-color:#a0a0a0;cursor:pointer}button.lock{background:none;border:none;margin:0;padding:0;cursor:pointer}div,h2{margin:4px}.info{background-color:#ddd;padding:5px;border-radius:8px}.full-flex{flex:1}.panel{display:flex;flex-direction:column;padding:4px}.settings{width:35vh;margin:4px;display:flex;border-radius:6px;border:1px solid rgb(0,0,0);flex-direction:column}#previewSVG{width:100%;height:100%}div.SVGbox{border:1px solid rgb(0,0,0)}div.preview{width:65vh;height:65vh;margin:4px;border-radius:6px;background-size:100% 100%;background-image:url(https://quentinbolsee.pages.cba.mit.edu/gerber2img/assets/background-241caa55.svg);border:1px solid rgb(0,0,0);display:flex;align-items:center;justify-content:center}div#dropZone{background-color:#b4b4b499;position:fixed;top:0;left:0;width:100%;height:100%;z-index:999;visibility:hidden;display:flex;align-items:center;justify-content:center}footer{position:fixed;left:0;bottom:0;height:30px;width:100%;font-size:12px} body{font-family:Arial,Helvetica,sans-serif}input{max-width:30%}p{color:#000}h3{margin-left:4px;margin-top:20px;margin-bottom:4px}h1{margin-top:4px;margin-bottom:8px}p.lock{cursor:default;margin:0}p#dropText{font-size:100px}.container{display:flex}button{border:none}button.interface{background-color:#c8c8c8;padding:4px;border-radius:6px;margin:4px;width:28%;min-width:80px}button.interface:hover{background-color:#a0a0a0;cursor:pointer}button.lock{background:none;border:none;margin:0;padding:0;cursor:pointer}div,h2{margin:4px}.info{background-color:#ddd;padding:5px;border-radius:8px}.full-flex{flex:1}.panel{display:flex;flex-direction:column;padding:4px}.settings{width:35vh;margin:4px;display:flex;border-radius:6px;border:1px solid rgb(0,0,0);flex-direction:column}#previewSVG{width:100%;height:100%}div.SVGbox{border:1px solid rgb(0,0,0)}div.preview{width:65vh;height:65vh;margin:4px;border-radius:6px;background-size:100% 100%;background-image:url(https://quentinbolsee.pages.cba.mit.edu/gerber2img/assets/background-f04e5df7.svg);border:1px solid rgb(0,0,0);display:flex;align-items:center;justify-content:center}div#dropZone{background-color:#b4b4b499;position:fixed;top:0;left:0;width:100%;height:100%;z-index:999;visibility:hidden;display:flex;align-items:center;justify-content:center}footer{position:fixed;left:0;bottom:0;height:30px;width:100%;font-size:12px}
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -8,12 +8,13 @@ ...@@ -8,12 +8,13 @@
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" /> <meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" /> <meta http-equiv="Expires" content="-1" />
<script type="module" crossorigin src="https://quentinbolsee.pages.cba.mit.edu/gerber2img/assets/main-4069f991.js"></script> <script type="module" crossorigin src="https://quentinbolsee.pages.cba.mit.edu/gerber2img/assets/main-128b0f6a.js"></script>
<link rel="stylesheet" href="https://quentinbolsee.pages.cba.mit.edu/gerber2img/assets/index-5d88619d.css"> <link rel="stylesheet" href="https://quentinbolsee.pages.cba.mit.edu/gerber2img/assets/index-591a036e.css">
</head> </head>
<body style="background-color: rgb(255, 255, 255);"> <body style="background-color: rgb(255, 255, 255);">
<h1>gerber2img</h1> <h1>gerber2img</h1>
<p>Drag and drop one or multiple Gerber files; lock origin and dimensions to preserve alignment between successive uploads.</p> <p>Drag and drop one or multiple Gerber files; lock origin and dimensions to preserve alignment between successive uploads.</p>
<p>For through-holes and vias, make sure to export drill file (.drl) as metric.</p>
<div id="dropZone"><p id="dropText"></p></div> <div id="dropZone"><p id="dropText"></p></div>
<input type="file" id="fileInput" multiple hidden></input> <input type="file" id="fileInput" multiple hidden></input>
<canvas id="canvas" hidden></canvas> <canvas id="canvas" hidden></canvas>
...@@ -81,9 +82,9 @@ ...@@ -81,9 +82,9 @@
<h3>Margins [mm]</h3> <h3>Margins [mm]</h3>
<div> <div>
<label for="settingsMarginX">x:</label> <label for="settingsMarginX">x:</label>
<input id="settingsMarginX" step=0.1 min=0 type="number" value=3> <input id="settingsMarginX" step=0.1 min=0 type="number" value=2>
<label for="settingsMarginY">y:</label> <label for="settingsMarginY">y:</label>
<input id="settingsMarginY" step=0.1 min=0 type="number" value=3> <input id="settingsMarginY" step=0.1 min=0 type="number" value=2>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -161,8 +161,9 @@ function updateSVG(fromSettingsChange=false) { ...@@ -161,8 +161,9 @@ function updateSVG(fromSettingsChange=false) {
globalXMLRoot.setAttribute("viewBox", vb.join(' ')); globalXMLRoot.setAttribute("viewBox", vb.join(' '));
globalXMLRoot.setAttribute("width", `${(vb[2]/1000).toFixed(3)}mm`); globalXMLRoot.setAttribute("width", `${(vb[2]/1000).toFixed(3)}mm`);
globalXMLRoot.setAttribute("height", `${(vb[3]/1000).toFixed(3)}mm`); globalXMLRoot.setAttribute("height", `${(vb[3]/1000).toFixed(3)}mm`);
let backgroundElem;
if (!globalSettings.transparent) { if (!globalSettings.transparent) {
let backgroundElem = globalXMLRoot.ownerDocument.createElement("rect"); backgroundElem = globalXMLRoot.ownerDocument.createElement("rect");
if (globalSettings.blackAndWhite) { if (globalSettings.blackAndWhite) {
backgroundElem.setAttribute("fill", "rgb(0,0,0)"); backgroundElem.setAttribute("fill", "rgb(0,0,0)");
} else { } else {
...@@ -175,6 +176,8 @@ function updateSVG(fromSettingsChange=false) { ...@@ -175,6 +176,8 @@ function updateSVG(fromSettingsChange=false) {
globalXMLRoot.appendChild(backgroundElem); globalXMLRoot.appendChild(backgroundElem);
} }
let only_drills = true;
for ([layerName, layerTxt] of layersSorted) { for ([layerName, layerTxt] of layersSorted) {
layerXML = parser.parseFromString(layerTxt, "text/xml"); layerXML = parser.parseFromString(layerTxt, "text/xml");
layerXMLRoot = layerXML.childNodes[0]; layerXMLRoot = layerXML.childNodes[0];
...@@ -196,8 +199,14 @@ function updateSVG(fromSettingsChange=false) { ...@@ -196,8 +199,14 @@ function updateSVG(fromSettingsChange=false) {
// let ty = Number(m[1]) + (layerVB[3]-(yMax-yMin))/2; // let ty = Number(m[1]) + (layerVB[3]-(yMax-yMin))/2;
if (globalSettings.blackAndWhite) { if (globalSettings.blackAndWhite) {
g.setAttribute("opacity", 1.0); g.setAttribute("opacity", 1.0);
if (layerName === "drill") {
g.setAttribute("fill", "rgb(0,0,0)");
g.setAttribute("stroke", "rgb(0,0,0)");
} else {
g.setAttribute("fill", "rgb(255,255,255)"); g.setAttribute("fill", "rgb(255,255,255)");
g.setAttribute("stroke", "rgb(255,255,255)"); g.setAttribute("stroke", "rgb(255,255,255)");
only_drills = false;
}
} else { } else {
g.setAttribute("opacity", layerOpacity); g.setAttribute("opacity", layerOpacity);
g.setAttribute("fill", layerRGB); g.setAttribute("fill", layerRGB);
...@@ -214,7 +223,9 @@ function updateSVG(fromSettingsChange=false) { ...@@ -214,7 +223,9 @@ function updateSVG(fromSettingsChange=false) {
globalXMLRoot.appendChild(g.cloneNode(true)); globalXMLRoot.appendChild(g.cloneNode(true));
} }
} }
if (!globalSettings.transparent && globalSettings.blackAndWhite && only_drills) {
backgroundElem.setAttribute("fill", "rgb(255,255,255)");
}
renderSVG(); renderSVG();
} }
......