Remove scaling of context menus (#431)

* remove scaling of context menus based on graph scale

* deprecate scale in interface

* Add option to restore old context scaling behaviour

Revert "remove scaling of context menus based on graph scale"

This reverts commit d91ecaa86c671aea272844c3900a18da1af7bf01.

* Update test expectations

---------

Co-authored-by: filtered <176114999+webfiltered@users.noreply.github.com>
This commit is contained in:
bymyself
2025-01-27 01:41:08 -07:00
committed by GitHub
parent f48cbb6a82
commit 9a8c3dff89
4 changed files with 8 additions and 1 deletions

View File

@@ -181,7 +181,9 @@ export class ContextMenu {
root.style.left = left + "px"
root.style.top = top + "px"
if (options.scale) root.style.transform = `scale(${Math.round(options.scale * 4) * 0.25})`
if (LiteGraph.context_menu_scaling && options.scale) {
root.style.transform = `scale(${Math.round(options.scale * 4) * 0.25})`
}
}
addItem(

View File

@@ -257,6 +257,9 @@ export class LiteGraphGlobal {
/** If `true`, the old "eye-melting-red" error indicator will be used for nodes */
use_legacy_node_error_indicator = false
/** Whether to scale context with the graph when zooming in. Zooming out never makes context menus smaller. */
context_menu_scaling = false
// TODO: Remove legacy accessors
LGraph = LGraph
LLink = LLink

View File

@@ -273,6 +273,7 @@ export interface IContextMenuOptions extends IContextMenuBase {
scroll_speed?: number
left?: number
top?: number
/** @deprecated Context menus no longer scale using transform */
scale?: number
node?: LGraphNode
autoopen?: boolean

View File

@@ -142,6 +142,7 @@ LiteGraphGlobal {
"auto_sort_node_types": false,
"catch_exceptions": true,
"click_do_break_link_to": false,
"context_menu_scaling": false,
"ctrl_alt_click_do_break_link": true,
"ctrl_shift_v_paste_connect_unselected_outputs": true,
"debug": false,