Files
JaredTherriault-ComfyUI-JNodes/web/js/ctrlShiftToPanFaster.js
T
JaredTherriault f0e9347640 Major video update, ConfigSettings improvements, js async cancellation, load optimizations
-Roll UiSettings into SettingsManager
-Account for ConfigSettings that are objects by loading default values then loading config value son top
-Set ConfigSetting values using JSON.stringify
-Separate flyout generation into generic function
-Add video settings flyout in subfolderexplorer contexts
-Add option to control slider range value label fractional digits
-Update default slider range values to reflect 1-100 values rather than 0-1
-Rename ImageDrawerContext description to tooltip
-Update 'flex' alignment to 'normal' in context toolbars
-Automatically cancel async js operations when switching contexts
-blur or unfocus toolbar buttons on click to avoid accidental clearing or refreshing
-Get setting_ModelCardAspectRatio value as number
-Implement method to avoid lazy loading of images
-Lay some groundwork for unimplemented cancellation requests for python tasks
-Separated image list and search variables and functions to a separate script, ImageListAndSearch
-Update extra networks toolbar buttons to have a bespoke class and use specific cursor styles
-Update ImageElements 'complete' to 'bComplete' to differentiate from the img property
-Add lastSeekTime property initialization to img element
-Don't run onload if image element is already bComplete
-Sort and execute search after image is loaded (if requested). This allows search and sort to work with all of the meta data in the image.
-Click videos to pause/play
-Double click videos to toggle fullscreen
-Mute videos based on video options
-Set video volume from video options flyout
-Use scrollwheel on video to seek forward or back (seek direction depends on video options)
-Update imports
2024-04-17 14:58:59 -07:00

34 lines
1.2 KiB
JavaScript

import { app } from "../../../scripts/app.js";
app.registerExtension({
name: "JNodes.CtrlShiftToPanFaster",
init() {
const panSpeedFactor = 10;
let last_mouse = [0, 0];
function processMouseMove(event) {
var mouse = [event.clientX, event.clientY];
var delta = [
(mouse[0] - last_mouse[0]) * panSpeedFactor,
(mouse[1] - last_mouse[1]) * panSpeedFactor
];
last_mouse = mouse;
if (event.shiftKey && event.ctrlKey) {
var LiteGraphInstance = window?.LiteGraph;
var canvas = LiteGraphInstance?.LGraphCanvas?.active_canvas;
if (canvas && canvas.ds) {
canvas.ds.offset[0] += delta[0] / canvas.ds.scale;
canvas.ds.offset[1] += delta[1] / canvas.ds.scale;
canvas.dirty_canvas = true;
canvas.dirty_bgcanvas = true;
}
}
}
document.addEventListener("mousemove", processMouseMove);
document.addEventListener("mouseup", (event) => {last_mouse = [event.clientX, event.clientY];});
}
});