Add lock canvas checkbox

This commit is contained in:
space-nuko 2023-02-12 01:59:54 -08:00
parent e9363ebe29
commit c58ec3a66d
2 changed files with 5 additions and 2 deletions

View File

@ -556,6 +556,10 @@ function clearQueue() {
.catch(error => console.error(error));
}
function lockCanvas(cb) {
canvas.allow_dragnodes = !cb.checked;
}
</script>
@ -594,6 +598,7 @@ function clearQueue() {
<br>
<button style="font-size: 20px;" onclick="clearGraph()">Clear</button><br>
<button style="font-size: 20px;" onclick="loadTxt2Img()">Load Default</button><br>
<input type="checkbox" id="lockcanvas" name="lockcanvas" value="false" onclick="lockCanvas(this)">Lock Canvas</input>
</span>
</body>
</html>

View File

@ -6744,7 +6744,6 @@ LGraphNode.prototype.executeAction = function(action)
this.node_dragged.pos[0] = Math.round(this.node_dragged.pos[0]);
this.node_dragged.pos[1] = Math.round(this.node_dragged.pos[1]);
if (this.graph.config.align_to_grid || this.align_to_grid ) {
console.warn("AAA")
this.node_dragged.alignToGrid();
}
if( this.onNodeMoved )
@ -9955,7 +9954,6 @@ LGraphNode.prototype.executeAction = function(action)
var delta = x < 40 ? -1 : x > widget_width - 40 ? 1 : 0;
if (w.type == "number") {
console.log(w);
if (w.options.step) {
w.value += w.options.step * Math.sign(delta);
}