mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-21 20:52:12 -03:00
Add documentation for LitegraphService and MaskEditor
Introduced two new documentation files: one detailing the main functions and class structure of LitegraphService, and another describing the classes and methods in MaskEditor. These documents provide an overview of available APIs, internal logic, and UI management for developers.
This commit is contained in:
75
Doc/LitegraphService
Normal file
75
Doc/LitegraphService
Normal file
@@ -0,0 +1,75 @@
|
||||
LitegraphService Documentation
|
||||
|
||||
Main functions of useLitegraphService()
|
||||
|
||||
Node Registration and Creation Functions:
|
||||
|
||||
registerNodeDef(nodeId: string, nodeDefV1: ComfyNodeDefV1)
|
||||
|
||||
- Registers node definition in LiteGraph system
|
||||
- Creates ComfyNode class with inputs, outputs and widgets
|
||||
- Adds context menu, background drawing and keyboard handling
|
||||
- Invokes extensions before registration
|
||||
|
||||
addNodeOnGraph(nodeDef, options)
|
||||
|
||||
- Adds new node to graph at specified position
|
||||
- By default places node at canvas center
|
||||
|
||||
Navigation and View Functions:
|
||||
|
||||
getCanvasCenter(): Vector2
|
||||
|
||||
- Returns canvas center coordinates accounting for DPI
|
||||
|
||||
goToNode(nodeId: NodeId)
|
||||
|
||||
- Animates transition to specified node on canvas
|
||||
|
||||
resetView()
|
||||
|
||||
- Resets canvas view to default settings (scale 1, offset [0,0])
|
||||
|
||||
fitView()
|
||||
|
||||
- Fits canvas view to show all nodes
|
||||
|
||||
Node Handling Functions (internal):
|
||||
|
||||
addNodeContextMenuHandler(node)
|
||||
|
||||
- Adds context menu with options:
|
||||
|
||||
- Open/Copy/Save image (for image nodes)
|
||||
- Bypass node
|
||||
- Copy/Paste to Clipspace
|
||||
- Open in MaskEditor (for image nodes)
|
||||
|
||||
addDrawBackgroundHandler(node)
|
||||
|
||||
- Adds node background drawing logic
|
||||
- Handles image, animation and video previews
|
||||
- Manages thumbnail display
|
||||
|
||||
addNodeKeyHandler(node)
|
||||
|
||||
- Adds keyboard handling:
|
||||
|
||||
- Left/Right arrows: navigate between images
|
||||
- Escape: close image preview
|
||||
|
||||
ComfyNode Class (created by registerNodeDef):
|
||||
|
||||
Main methods:
|
||||
|
||||
- #addInputs() - adds inputs and widgets to node
|
||||
- #addOutputs() - adds outputs to node
|
||||
- configure() - configures node from serialized data
|
||||
- #setupStrokeStyles() - sets border styles (errors, execution, etc.)
|
||||
|
||||
Properties:
|
||||
|
||||
- comfyClass - ComfyUI class name
|
||||
- nodeData - node definition
|
||||
- Automatic yellow coloring for API nodes
|
||||
|
||||
76
Doc/MaskEditor
Normal file
76
Doc/MaskEditor
Normal file
@@ -0,0 +1,76 @@
|
||||
MASKEDITOR.TS FUNCTION DOCUMENTATION
|
||||
|
||||
MaskEditorDialog - Main mask editor class
|
||||
|
||||
- getInstance() - Singleton pattern, returns editor instance
|
||||
- show() - Opens the mask editor
|
||||
- save() - Saves mask to server
|
||||
- destroy() - Closes and cleans up editor
|
||||
- isOpened() - Checks if editor is open
|
||||
|
||||
CanvasHistory - Change history management
|
||||
|
||||
- saveState() - Saves current canvas state
|
||||
- undo() - Undo last operation
|
||||
- redo() - Redo undone operation
|
||||
- clearStates() - Clears history
|
||||
|
||||
BrushTool - Brush tool
|
||||
|
||||
- setBrushSize(size) - Sets brush size
|
||||
- setBrushOpacity(opacity) - Sets brush opacity
|
||||
- setBrushHardness(hardness) - Sets brush hardness
|
||||
- setBrushType(type) - Sets brush shape (circle/square)
|
||||
- startDrawing() - Starts drawing
|
||||
- handleDrawing() - Handles drawing during movement
|
||||
- drawEnd() - Ends drawing
|
||||
|
||||
PaintBucketTool - Fill tool
|
||||
|
||||
- floodFill(point) - Fills area with color from point
|
||||
- setTolerance(tolerance) - Sets color tolerance
|
||||
- setFillOpacity(opacity) - Sets fill opacity
|
||||
- invertMask() - Inverts mask
|
||||
|
||||
ColorSelectTool - Color selection tool
|
||||
|
||||
- fillColorSelection(point) - Selects similar colors
|
||||
- setTolerance(tolerance) - Sets selection tolerance
|
||||
- setLivePreview(enabled) - Enables/disables live preview
|
||||
- setComparisonMethod(method) - Sets color comparison method
|
||||
- setApplyWholeImage(enabled) - Applies to whole image
|
||||
- setSelectOpacity(opacity) - Sets selection opacity
|
||||
|
||||
UIManager - Interface management
|
||||
|
||||
- updateBrushPreview() - Updates brush preview
|
||||
- setBrushVisibility(visible) - Shows/hides brush
|
||||
- screenToCanvas(coords) - Converts screen coordinates to canvas
|
||||
- getMaskColor() - Returns mask color
|
||||
- setSaveButtonEnabled(enabled) - Enables/disables save button
|
||||
|
||||
ToolManager - Tool management
|
||||
|
||||
- setTool(tool) - Sets active tool
|
||||
- getCurrentTool() - Returns active tool
|
||||
- handlePointerDown/Move/Up() - Handles mouse/touch events
|
||||
|
||||
PanAndZoomManager - View management
|
||||
|
||||
- zoom(event) - Zooms in/out canvas
|
||||
- handlePanStart/Move() - Handles canvas panning
|
||||
- initializeCanvasPanZoom() - Initializes canvas view
|
||||
- smoothResetView() - Smoothly resets view
|
||||
|
||||
MessageBroker - Communication system
|
||||
|
||||
- publish(topic, data) - Publishes message
|
||||
- subscribe(topic, callback) - Subscribes to topic
|
||||
- pull(topic, data) - Pulls data from topic
|
||||
- createPullTopic/PushTopic() - Creates communication topics
|
||||
|
||||
KeyboardManager - Keyboard handling
|
||||
|
||||
- addListeners() - Adds keyboard listeners
|
||||
- removeListeners() - Removes listeners
|
||||
- isKeyDown(key) - Checks if key is pressed
|
||||
Reference in New Issue
Block a user