Skip to content

Commit 48bc420

Browse files
committed
Added basic zoom functionality.
1 parent 48edd27 commit 48bc420

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
<script src = "src/creator.js"></script>
2121
<script src = "src/fileWrite.js"></script>
2222
<script src = "src/menu.js"></script>
23+
<script src = "src/ui.js"></script>
2324
</html>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graph-creator",
3-
"version": "0.3.3",
3+
"version": "0.4.3",
44
"main": "index.html",
55
"window": {
66
"height": 1024,

src/ui.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//Handles parts of the user interface like zoom and keyboard shortcuts
2+
3+
//Change the zoom level upon ctrl + mousewheel
4+
const win = nw.Window.get();
5+
6+
window.addEventListener('wheel', function(e){
7+
if(e.ctrlKey){
8+
if(e.deltaY > 0){
9+
win.zoomLevel -= 0.5;
10+
}
11+
else{
12+
win.zoomLevel += 0.5;
13+
}
14+
}
15+
});

0 commit comments

Comments
 (0)