Skip to content

Commit 0d759fd

Browse files
add zoom button; update README
1 parent 95c2760 commit 0d759fd

File tree

6 files changed

+16
-5
lines changed

6 files changed

+16
-5
lines changed

README.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# kweb 0.1.1
22

3-
KLayout Web Viewer ![demo](https://i.imgur.com/HPvePvX.png)
3+
KLayout Web Viewer ![demo](docs/_static/kweb.png)
44

55
Based on https://github.com/klayoutmatthias/canvas2canvas
66

@@ -26,11 +26,14 @@ Install the necessary dependecies
2626

2727
`make install`
2828

29+
## Set a folder for kweb to use when looking for gds files
30+
31+
`export KWEB_FILESLOCATION=/path/to/folder/with/file.gds`
2932

3033
## Run
3134

3235
`cd src/kweb`
3336

3437
`make run`
3538

36-
Copy the link http://127.0.0.1:8000/gds/wg to your browser to open the waveguide example
39+
Copy the link http://127.0.0.1:8000/gds/file.gds (or http://localhost:8000/gds/file.gds also works) to your browser to open the waveguide example

docs/_static/kweb.png

82.5 KB
Loading

kweb.png

82.5 KB
Loading

src/kweb/gds_files/wg.gds

-182 Bytes
Binary file not shown.

src/kweb/static/client.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,20 @@ function showMenu(modes, annotations) {
191191

192192
let clearRulers = document.createElement("button");
193193
clearRulers.textContent = "Clear Rulers";
194-
clearRulers.className = "btn btn-primary";
194+
clearRulers.className = "col-auto btn btn-primary me-2";
195195
clearRulers.setAttribute("type", "button");
196196
clearRulers.onclick = function() {
197197
socket.send(JSON.stringify({ msg: "clear-annotations" }));
198198
};
199199
menuElement.appendChild(clearRulers);
200+
let zoomFit= document.createElement("button");
201+
zoomFit.textContent = "Zoom Fit";
202+
zoomFit.className = "col-auto btn btn-primary";
203+
zoomFit.setAttribute("type", "button");
204+
zoomFit.onclick = function() {
205+
socket.send(JSON.stringify({ msg: "zoom-f" }));
206+
};
207+
menuElement.appendChild(zoomFit);
200208

201209
let index = 0;
202210

src/kweb/templates/client.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<canvas class="rounded shadow canvas-container h-100 w-100" id="layout_canvas"></canvas>
1818
<div class="position-absolute top-0 start-1 p-4 d-flex" id="floating-buttons">
1919
<div id="modes" class="me-4"></div>
20-
<div id="menu"></div>
20+
<div id="menu" class = "row"></div>
2121
</div>
2222
</div>
2323
<div id="rightpanel" role="tablist" class="col-2 rounded shadow bg-default py-2">
@@ -34,7 +34,7 @@
3434
<div id="layer-buttons">
3535
<div class="form-check form-switch ps-2">
3636
<input class="form-check-input ms-0 ps-0" type="checkbox" role="switch" id="layerEmptySwitch" checked>
37-
<label class="form-check-label" for="layerEmptySwitch">Hide Empty Layers</label>
37+
<label class="form-check-label ps-2" for="layerEmptySwitch">Hide Empty Layers</label>
3838
</div>
3939
</div>
4040
</div>

0 commit comments

Comments
 (0)