Files
ComfyUI_frontend/test/__snapshots__/litegraph.test.ts.snap
filtered b29a32c1ae Add CanvasPointer API (#308)
* Add position rounding feature

Replaces previous impls. which only worked on some items, and were triggered when unexpected e.g. clicking a node that hadn't been moved.

Update test expectations

* Narrow TS types - readonly

* nit - Clean up, Doc

* nit - Clean up legacy accessors

Marks as deprecated

* Fix TS type - IContextMenuOptions.scale

* [Refactor] dist2 for use in pointer API

* Add CanvasPointer - API for pointer events

Add TS strict types
Add final click drag distance math
Add option to retain events

* nit - Rename

* nit

* Remove Subgraph - unused & not maintained

* Remove live_mode

Unused, not maintained.

* Update README

Remove live_mode reference

* Update delete selected - include reroutes & groups

* Bypass link menu if alt/shift pressed

* Remove old dragged_node interface

Incomplete impl. - unused.
Superceded by selectedItems

* Fix top/left edge of rectangles not in hitbox

* [Refactor] Match function names to interface names

* Add interface to find widgets by Point

LGraphNode.getWidgetOnPos

* Add widget search param - includeDisabled

* nit - Doc

* Rewrite canvas mouse handling

- Rewrites most pointer handling to use CanvasPointer callbacks
- All callbacks are declared ahead of time during the initial pointerdown event, logically grouped together
- Drastically simplifies the alteration or creation of new click / drag interactions
- Click events are all clicks, rather than some processed on mouse down, others on mouse up

- Functions return instead of setting and repeatedly checking multiple state vars
- Removes all lines that needed THIRTEEN tab indents

* Split middle click out from processMouseDown

* Use pointer API for link menus

* Narrow canvas event interfaces

* Fix canvas event types

Replaces original workarounds with final types

* Refactor - deprecated isInsideRectangle

* Add canvas hovering over state

- Centralises cursor set behaviour
- Provides simple downstream override

* nit

* [Refactor] Use measure functions

* Add double-click API to CanvasPointer

a

* nit - Doc

* Allow larger gap between double click events

* Rewrite double-click into CanvasPointer actions

* Improve double-click UX

Prefer down events over up events

* Add production defaults

* Add middle-click handling

* Remove debug code

* Remove redundant code

* Fix add reroute alt-click adds two undo steps

* Fix click on connected input disconnects

Old behaviour was to disconnect, then recreate a new link on drop.

* Add module export: CanvasPointer
2024-11-16 17:35:30 -05:00

179 lines
4.1 KiB
Plaintext

// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`Litegraph module > has the same structure > minLGraph 1`] = `
LiteGraphGlobal {
"ACTION": -1,
"ALWAYS": 0,
"ARROW_SHAPE": 5,
"AUTOHIDE_TITLE": 3,
"BOX_SHAPE": 1,
"CANVAS_GRID_SIZE": 10,
"CARD_SHAPE": 4,
"CENTER": 5,
"CIRCLE_SHAPE": 3,
"CONNECTING_LINK_COLOR": "#AFA",
"ContextMenu": [Function],
"CurveEditor": [Function],
"DEFAULT_GROUP_FONT": 24,
"DEFAULT_GROUP_FONT_SIZE": undefined,
"DEFAULT_POSITION": [
100,
100,
],
"DEFAULT_SHADOW_COLOR": "rgba(0,0,0,0.5)",
"DOWN": 2,
"DragAndScale": [Function],
"EVENT": -1,
"EVENT_LINK_COLOR": "#A86",
"GRID_SHAPE": 6,
"Globals": {},
"HIDDEN_LINK": -1,
"INPUT": 1,
"LEFT": 3,
"LGraph": [Function],
"LGraphCanvas": [Function],
"LGraphGroup": [Function],
"LGraphNode": [Function],
"LINEAR_LINK": 1,
"LINK_COLOR": "#9A9",
"LINK_RENDER_MODES": [
"Straight",
"Linear",
"Spline",
],
"LLink": [Function],
"LabelPosition": {
"Left": "left",
"Right": "right",
},
"MAX_NUMBER_OF_NODES": 10000,
"NEVER": 2,
"NODE_BOX_OUTLINE_COLOR": "#FFF",
"NODE_COLLAPSED_RADIUS": 10,
"NODE_COLLAPSED_WIDTH": 80,
"NODE_DEFAULT_BGCOLOR": "#353535",
"NODE_DEFAULT_BOXCOLOR": "#666",
"NODE_DEFAULT_COLOR": "#333",
"NODE_DEFAULT_SHAPE": "box",
"NODE_MIN_WIDTH": 50,
"NODE_MODES": [
"Always",
"On Event",
"Never",
"On Trigger",
],
"NODE_MODES_COLORS": [
"#666",
"#422",
"#333",
"#224",
"#626",
],
"NODE_SELECTED_TITLE_COLOR": "#FFF",
"NODE_SLOT_HEIGHT": 20,
"NODE_SUBTEXT_SIZE": 12,
"NODE_TEXT_COLOR": "#AAA",
"NODE_TEXT_HIGHLIGHT_COLOR": "#EEE",
"NODE_TEXT_SIZE": 14,
"NODE_TITLE_COLOR": "#999",
"NODE_TITLE_HEIGHT": 30,
"NODE_TITLE_TEXT_Y": 20,
"NODE_WIDGET_HEIGHT": 20,
"NODE_WIDTH": 140,
"NORMAL_TITLE": 0,
"NO_TITLE": 1,
"Nodes": {},
"ON_EVENT": 1,
"ON_TRIGGER": 3,
"OUTPUT": 2,
"RIGHT": 4,
"ROUND_SHAPE": 2,
"SPLINE_LINK": 2,
"STRAIGHT_LINK": 0,
"SlotDirection": {
"1": "Up",
"2": "Down",
"3": "Left",
"4": "Right",
"Down": 2,
"Left": 3,
"Right": 4,
"Up": 1,
},
"SlotShape": {
"1": "Box",
"3": "Circle",
"5": "Arrow",
"6": "Grid",
"7": "HollowCircle",
"Arrow": 5,
"Box": 1,
"Circle": 3,
"Grid": 6,
"HollowCircle": 7,
},
"SlotType": {
"-1": "Event",
"Array": "array",
"Event": -1,
},
"TRANSPARENT_TITLE": 2,
"UP": 1,
"VALID_SHAPES": [
"default",
"box",
"round",
"card",
],
"VERSION": 0.4,
"VERTICAL_LAYOUT": "vertical",
"WIDGET_BGCOLOR": "#222",
"WIDGET_OUTLINE_COLOR": "#666",
"WIDGET_SECONDARY_TEXT_COLOR": "#999",
"WIDGET_TEXT_COLOR": "#DDD",
"allow_multi_output_for_events": true,
"allow_scripts": false,
"alt_drag_do_clone_nodes": false,
"always_round_positions": false,
"auto_load_slot_types": false,
"auto_sort_node_types": false,
"catch_exceptions": true,
"click_do_break_link_to": false,
"ctrl_alt_click_do_break_link": true,
"ctrl_shift_v_paste_connect_unselected_outputs": true,
"debug": false,
"dialog_close_on_mouse_leave": false,
"dialog_close_on_mouse_leave_delay": 500,
"distance": [Function],
"do_add_triggers_slots": false,
"getTime": [Function],
"highlight_selected_group": true,
"isInsideRectangle": [Function],
"middle_click_slot_add_default_node": false,
"node_box_coloured_by_mode": false,
"node_box_coloured_when_on": false,
"node_images_path": "",
"node_types_by_file_extension": {},
"overlapBounding": [Function],
"pointerevents_method": "pointer",
"proxy": null,
"registered_node_types": {},
"registered_slot_in_types": {},
"registered_slot_out_types": {},
"release_link_on_empty_shows_menu": false,
"search_filter_enabled": false,
"search_hide_on_mouse_leave": true,
"search_show_all_on_open": true,
"searchbox_extras": {},
"shift_click_do_break_link_from": false,
"slot_types_default_in": {},
"slot_types_default_out": {},
"slot_types_in": [],
"slot_types_out": [],
"snap_highlights_node": true,
"snaps_for_comfy": true,
"throw_errors": true,
"use_uuids": false,
}
`;