|
|
@ -953,6 +953,12 @@ export class ComfyApp { |
|
|
|
|
|
|
|
|
|
|
|
const origProcessMouseDown = LGraphCanvas.prototype.processMouseDown; |
|
|
|
const origProcessMouseDown = LGraphCanvas.prototype.processMouseDown; |
|
|
|
LGraphCanvas.prototype.processMouseDown = function(e) { |
|
|
|
LGraphCanvas.prototype.processMouseDown = function(e) { |
|
|
|
|
|
|
|
// prepare for ctrl+shift drag: zoom start
|
|
|
|
|
|
|
|
if(e.ctrlKey && e.shiftKey && e.buttons) { |
|
|
|
|
|
|
|
self.zoom_drag_start = [e.x, e.y, this.ds.scale]; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const res = origProcessMouseDown.apply(this, arguments); |
|
|
|
const res = origProcessMouseDown.apply(this, arguments); |
|
|
|
|
|
|
|
|
|
|
|
this.selected_group_moving = false; |
|
|
|
this.selected_group_moving = false; |
|
|
@ -973,6 +979,26 @@ export class ComfyApp { |
|
|
|
|
|
|
|
|
|
|
|
const origProcessMouseMove = LGraphCanvas.prototype.processMouseMove; |
|
|
|
const origProcessMouseMove = LGraphCanvas.prototype.processMouseMove; |
|
|
|
LGraphCanvas.prototype.processMouseMove = function(e) { |
|
|
|
LGraphCanvas.prototype.processMouseMove = function(e) { |
|
|
|
|
|
|
|
// handle ctrl+shift drag
|
|
|
|
|
|
|
|
if(e.ctrlKey && e.shiftKey && self.zoom_drag_start) { |
|
|
|
|
|
|
|
// stop canvas zoom action
|
|
|
|
|
|
|
|
if(!e.buttons) { |
|
|
|
|
|
|
|
self.zoom_drag_start = null; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// calculate delta
|
|
|
|
|
|
|
|
let deltaY = e.y - self.zoom_drag_start[1]; |
|
|
|
|
|
|
|
let startScale = self.zoom_drag_start[2]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let scale = startScale - deltaY/100; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.ds.changeScale(scale, [this.ds.element.width/2, this.ds.element.height/2]); |
|
|
|
|
|
|
|
this.graph.change(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const orig_selected_group = this.selected_group; |
|
|
|
const orig_selected_group = this.selected_group; |
|
|
|
|
|
|
|
|
|
|
|
if (this.selected_group && !this.selected_group_resizing && !this.selected_group_moving) { |
|
|
|
if (this.selected_group && !this.selected_group_resizing && !this.selected_group_moving) { |
|
|
@ -1059,6 +1085,20 @@ export class ComfyApp { |
|
|
|
// Trigger onPaste
|
|
|
|
// Trigger onPaste
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((e.key === '+') && e.altKey) { |
|
|
|
|
|
|
|
block_default = true; |
|
|
|
|
|
|
|
let scale = this.ds.scale * 1.1; |
|
|
|
|
|
|
|
this.ds.changeScale(scale, [this.ds.element.width/2, this.ds.element.height/2]); |
|
|
|
|
|
|
|
this.graph.change(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if((e.key === '-') && e.altKey) { |
|
|
|
|
|
|
|
block_default = true; |
|
|
|
|
|
|
|
let scale = this.ds.scale * 1 / 1.1; |
|
|
|
|
|
|
|
this.ds.changeScale(scale, [this.ds.element.width/2, this.ds.element.height/2]); |
|
|
|
|
|
|
|
this.graph.change(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.graph.change(); |
|
|
|
this.graph.change(); |
|
|
|