Skip to content

Commit

Permalink
Add basic manual zoom slider
Browse files Browse the repository at this point in the history
  • Loading branch information
FeniXb3 committed Jul 27, 2023
1 parent e452901 commit 0855303
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion public/Alakazam.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class Alakazam {
this.output = document.getElementById('output');
this.outputContainer = document.getElementById("output-container");
this.previewContainer = document.getElementById('flowchart-code-preview');
this.zoomSlider = document.querySelector("#zoom-range");
this.alertContainer = document.getElementById('alert-container');
this.alertElement = document.getElementById('alert');

Expand Down Expand Up @@ -166,7 +167,6 @@ export class Alakazam {
modal.show(titleText, data, '', this.nodeAddingModalCallback);
});


this.centerView();
}

Expand Down Expand Up @@ -488,6 +488,10 @@ export class Alakazam {
this.setMenuStartingPosition(this.nodeMenu, this.currentNodeElement);
});

this.zoomSlider.oninput = function() {
document.querySelector("#theGraph").setAttribute("width", this.value);
}

document.addEventListener('keyup', event => {
if (event.key == "Enter" && event.getModifierState('Control')) {
this.flowchart.alakazam();
Expand Down Expand Up @@ -657,6 +661,8 @@ export class Alakazam {
}
this.ws.send(JSON.stringify(broadcastData));
}

document.querySelector("#theGraph").setAttribute("width", this.zoomSlider.value);
}

// https://stackoverflow.com/questions/4777077/removing-elements-by-class-name
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<button id="reset" class="btn btn-lg btn-danger"><i class="fa-solid fa-window-restore"></i> Reset</button>
<button id="run" class="btn btn-lg btn-success"><i class="fa-solid fa-wand-magic-sparkles"></i>
Alakazam!</button>
<input type="range" min="111" max="10000" value="111" class="slider" id="zoom-range">
</div>
</div>

Expand Down

0 comments on commit 0855303

Please sign in to comment.