Commit Graph

138 Commits

Author SHA1 Message Date
Dariusz L
5b740e5982 Add ShowTimeLayerForge.gif and update README path
Added the ShowTimeLayerForge.gif file to the Media directory and updated the README to reference the new path for the GIF.
2025-06-28 08:24:37 +02:00
Dariusz L
981bf72513 Update video reference and remove old .webm file
Replaced the .webm video reference in README.md with a .gif version and deleted the obsolete ShowTimeLayerForge.webm file.
2025-06-28 08:22:40 +02:00
Dariusz L
e3d959f048 Update README.md 2025-06-28 08:19:17 +02:00
Dariusz L
f6d29de651 Add ShowTimeLayerForge.webm video asset
Introduces a new video file, ShowTimeLayerForge.webm, to the Showtime directory. This asset may be used for media playback or demonstration purposes within the project.
2025-06-28 08:17:55 +02:00
Dariusz L
7c3a6f72c7 Defer canvas rendering with setTimeout for UI updates
Replaces direct calls to canvas.render() and node.onResize() with setTimeout to defer execution, ensuring UI updates occur after DOM changes. This helps prevent rendering issues and improves responsiveness when toggling mask controls and editor view.
2025-06-28 08:07:10 +02:00
Dariusz L
51eaac362a Rename brush softness to hardness in mask tool
Replaces all references to 'softness' with 'hardness' for brush controls in both CanvasView.js and MaskTool.js. Updates UI labels, slider IDs, and internal logic to use 'hardness' terminology, clarifying that a higher value means a harder brush edge.
2025-06-28 07:59:32 +02:00
Dariusz L
a1e00ca06a Add brush preview overlay to MaskTool
Introduces a brush preview overlay using a separate preview canvas in MaskTool. Mouse event handlers in CanvasInteractions and MaskTool are updated to support passing both world and view coordinates, enabling accurate brush preview rendering. The preview is shown or hidden appropriately on mouse enter/leave and while drawing.
2025-06-28 07:37:53 +02:00
Dariusz L
940f027b40 Increase logging level to DEBUG and enhance MaskTool callbacks
Set logging level to DEBUG in both Python and JavaScript loggers for improved debugging. Updated MaskTool to accept an onStateChange callback and trigger it after mask state changes, allowing Canvas to respond to mask updates.
2025-06-28 07:28:58 +02:00
Dariusz L
a7208cb504 Update README.md 2025-06-28 06:50:32 +02:00
Dariusz L
f08214e224 Bump version to 1.2.1 in pyproject.toml
Updated the project version from 1.2.0 to 1.2.1 in preparation for a new release.
2025-06-28 06:11:37 +02:00
Dariusz L
0078faf1fd Set default log level to NONE and improve logger checks
Changed the default log level to LogLevel.NONE in both Python and JavaScript logger utilities. Updated LayerForgeLogger to fully disable logging when the effective level is NONE, ensuring no logs are emitted for disabled modules.
2025-06-28 06:11:12 +02:00
Dariusz L
b114d9b198 Update repository clone URL in README
Replaced the placeholder GitHub URL with the actual repository URL in the clone instructions to improve setup clarity.
2025-06-28 05:56:38 +02:00
Dariusz L
e05cc3bffc Revert "Refactor publish workflow to composite action"
This reverts commit acf625e1d1.
2025-06-28 05:54:08 +02:00
Dariusz L
acf625e1d1 Refactor publish workflow to composite action
Converted the publish workflow from a job-based GitHub Actions workflow to a reusable composite action. Added inputs for personal access token and skip_checkout, included Python setup and comfy-cli installation steps, and updated the publish command to use the new structure.
2025-06-28 05:53:15 +02:00
Dariusz L
306f860417 Add pyproject.toml for LayerForge project
Introduces the pyproject.toml file with project metadata, dependencies, and ComfyUI-specific configuration for the LayerForge canvas node.
2025-06-28 05:44:25 +02:00
Dariusz L
d783709287 Improve tooltip styling and positioning in CanvasView
Refactors the .painter-tooltip CSS for better appearance, responsiveness, and usability, including new scaling classes, table-based layout, and improved scrollbar styling. Updates shortcut help content to use tables instead of lists for clarity. Enhances tooltip positioning logic to prevent overflow outside the viewport and ensures proper display near screen edges.
2025-06-28 04:01:04 +02:00
Dariusz L
be53b6d362 Update README with new features and controls
Expanded the feature list to include persistent state, advanced masking, AI-powered matting, memory management, and improved workflow integration. Rewrote and reorganized the controls section for clarity, adding new shortcuts and detailed descriptions for canvas, layer, clipboard, and mask mode interactions.
2025-06-28 03:42:01 +02:00
Dariusz L
16730cf9a1 Refactor canvas help tooltip for mask mode support
Split help tooltip content into standard and mask mode shortcuts. Tooltip now dynamically displays relevant shortcuts based on whether the mask tool is active, improving user guidance during mask editing.
2025-06-28 03:37:23 +02:00
Dariusz L
4c569a0130 Remove optional input_image and input_mask parameters
Eliminates the 'optional' input_image and input_mask parameters from the CanvasNode class and its process_canvas_image method. Fallback logic for these parameters is also removed, simplifying the code and relying solely on WebSocket cache for image and mask data.
2025-06-28 02:49:07 +02:00
Dariusz L
092748ef85 Add descriptive titles to canvas control buttons
Added 'title' attributes to various canvas control buttons to provide tooltips with descriptive information about each button's function. This improves accessibility and user experience by clarifying the purpose of each control.
2025-06-28 02:37:58 +02:00
Dariusz L
319cbc1dcb Refactor blend mode menu handling in CanvasLayers
Replaces direct DOM removal with a dedicated closeBlendModeMenu method for consistency. Increases menu z-index for better stacking, and appends the menu to the canvas container if available instead of always using document.body.
2025-06-28 02:33:25 +02:00
Dariusz L
3957aa0f61 Refactor canvas state change handling and layer removal
Replaces the onInteractionEnd callback with onStateChange for more consistent state change notifications. Adds a removeSelectedLayers method to Canvas for cleaner layer removal logic. Updates UI event handlers to use the new methods and callbacks, and ensures state is saved after relevant operations. Cleans up redundant updateOutput calls and streamlines output update logic.
2025-06-28 02:26:06 +02:00
Dariusz L
f8f7583c1c Remove cache and output switch options from CanvasNode
Eliminated the 'cache_enabled' and 'output_switch' parameters and related logic from CanvasNode. This simplifies the node's configuration and processing flow by removing unused or redundant options.
2025-06-28 01:55:51 +02:00
Dariusz L
f76f047fa6 Add onInteractionEnd callback to Canvas
Introduces an optional onInteractionEnd callback to the Canvas class, which is triggered at the end of user interactions. CanvasView now uses this callback to update output after interactions, improving responsiveness to user actions.
2025-06-28 01:35:18 +02:00
Dariusz L
d8ebbeea1e Refactor logger setup and path handling
Moved sys.path modification from canvas_node.py to __init__.py for better package management. Improved logger formatting for colored output and enhanced file logging configuration with error handling for log directory creation. Added python/__init__.py to make the 'python' directory a package.
2025-06-28 01:26:33 +02:00
Dariusz L
375ed6a2b8 Refactor codebase for consistent formatting and style
This commit applies consistent code formatting across multiple files, including spacing, indentation, and object destructuring. No functional changes were made; the update improves code readability and maintainability.
2025-06-27 07:13:20 +02:00
Dariusz L
b40d645a79 Refactor canvas and mask handling for clarity and maintainability
Removed redundant comments and streamlined logic across canvas-related modules, including mask positioning, garbage collection, and WebSocket communication. Improved code readability and maintainability by eliminating unnecessary explanations and clarifying intent in both Python and JavaScript files. No functional changes were made; this is a cleanup and refactor for better developer experience.
2025-06-27 06:17:24 +02:00
Dariusz L
711722eb9f Revert "Refactor logging and formatting"
This reverts commit 83ce890ef4.
2025-06-27 05:50:47 +02:00
Dariusz L
83ce890ef4 Refactor logging and formatting
Improved code readability
2025-06-27 05:32:11 +02:00
Dariusz L
be4fae2964 Add WebSocket-based RAM output for CanvasNode
Introduces a WebSocket-based mechanism for CanvasNode to send and receive canvas image and mask data in RAM, enabling fast, diskless data transfer between frontend and backend. Adds a new WebSocketManager utility, updates CanvasIO to support RAM output mode, and modifies CanvasView to send canvas data via WebSocket before prompt execution. The backend (canvas_node.py) is updated to handle WebSocket data storage and retrieval, with improved locking and cleanup logic. This change improves workflow speed and reliability by avoiding unnecessary disk I/O and ensuring up-to-date canvas data is available during node execution.
2025-06-27 05:28:13 +02:00
Dariusz L
daf3abeea7 Add world-space positioning and resizing for mask tool
Introduces x/y coordinates to MaskTool for world-space positioning, allowing the mask to extend beyond the output area. Updates mask drawing, export, and rendering logic to account for mask position. Ensures mask position is updated when moving or resizing the canvas, and preserves mask content during canvas resizing. Improves mask extraction and rendering accuracy.
2025-06-26 22:09:28 +02:00
Dariusz L
f2998f0f08 Bump database version to 3
Incremented the DB_VERSION constant from 2 to 3 in preparation for database schema changes or upgrades.
2025-06-26 20:59:08 +02:00
Dariusz L
3ca0a32a14 Add operation-based auto garbage collection for images
Introduces an operation counter and threshold in ImageReferenceManager to trigger automatic garbage collection after a set number of canvas operations. Canvas now increments the operation count on save, undo, and redo, and exposes methods to set the operation threshold and retrieve stats including operation count. CanvasView displays the operation count and threshold after manual garbage collection.
2025-06-26 19:18:05 +02:00
Dariusz L
48005247fb Update Canvas.js 2025-06-26 18:42:55 +02:00
Dariusz L
a5a3280535 Fix mask canvas sizing to use canvasInstance dimensions
Updated initMaskCanvas to set maskCanvas width and height based on canvasInstance instead of mainCanvas, ensuring correct sizing.
2025-06-26 18:38:24 +02:00
Dariusz L
7d7076cc45 Add image garbage collection to canvas
Introduced ImageReferenceManager to track and clean up unused images from the database and cache. Added manual garbage collection controls to the UI and exposed related stats and cleanup methods in Canvas. Updated db.js with a method to retrieve all image IDs for cleanup purposes.
2025-06-26 18:28:50 +02:00
Dariusz L
dd6a9dfc85 Rename canvas size methods and labels to output area
Refactored method and variable names from 'canvas size' to 'output area size' across multiple files for clarity. Updated UI labels and related function calls to reflect this terminology change.
2025-06-26 18:06:40 +02:00
Dariusz L
8b9edddc6a Remove unused blend mode methods and imports
Eliminated the applyBlendMode method from Canvas and CanvasLayers, along with related unused imports in CanvasIO and CanvasLayers. This streamlines the code by removing dead code and unnecessary dependencies.
2025-06-26 05:17:21 +02:00
Dariusz L
7c23373e8c Refactor file names and clean up imports
Renamed Mask_tool.js to MaskTool.js and Canvas_view.js to CanvasView.js for consistency. Removed unused imports and redundant properties/methods from Canvas.js and CanvasState.js to streamline the codebase.
2025-06-26 05:09:21 +02:00
Dariusz L
93c4bfd90d Remove Polish comments and clean up codebase
Removed Polish-language and redundant comments from multiple modules, including Canvas, CanvasInteractions, CanvasLayers, CanvasRenderer, CanvasState, Canvas_view, Mask_tool, and CommonUtils. This improves code readability and maintainability by reducing clutter and focusing on self-explanatory code.
2025-06-26 05:05:42 +02:00
Dariusz L
98d5b18422 Remove redundant comments and clean up logging code
This commit removes unnecessary and redundant comments from multiple JavaScript modules, streamlining the code and improving readability. No functional changes were made; only comment cleanup and minor formatting adjustments.
2025-06-26 05:03:17 +02:00
Dariusz L
c149976610 Update Canvas.js 2025-06-26 03:44:35 +02:00
Dariusz L
c892f93c35 Refactor utils imports and move utility files to utils/
Moved CommonUtils.js, ImageUtils.js, and LoggerUtils.js to a new utils/ directory and updated all import paths accordingly throughout the codebase. Also increased the default canvas width in Canvas.js from 512 to 1024.
2025-06-26 03:44:21 +02:00
Dariusz L
a20a47b4c1 Update Mask_tool.js 2025-06-26 03:30:44 +02:00
Dariusz L
cb142908ad Add separate undo/redo history for mask and layers
Refactors CanvasState to maintain independent undo/redo stacks for mask editing and layer editing. Updates all relevant logic to use the correct history depending on the active mode, ensuring undo/redo and history buttons work as expected in both modes. MaskTool now saves history on activation, clear, and mouse up, and history info is reported per mode. Improves user experience when switching between mask and layer editing.
2025-06-26 03:22:18 +02:00
Dariusz L
63ab402154 Refactor to use global snapToGrid instead of method
Replaces calls to this.canvas.snapToGrid with the global snapToGrid function throughout CanvasInteractions.js. This simplifies the code and ensures consistent snapping behavior.
2025-06-26 02:19:42 +02:00
Dariusz L
59313566c9 Refactor logger initialization in Canvas modules
Replaced manual logger setup in CanvasIO.js and Canvas_view.js with the createModuleLogger utility for cleaner and more consistent module logging.
2025-06-26 02:09:01 +02:00
Dariusz L
df2680f2c9 Refactor utility functions and IndexedDB handling
Extracted and centralized common utility functions such as createCanvas, normalizeToUint8, and generateUniqueFileName in CommonUtils.js to reduce code duplication. Added createImageFromSource to ImageUtils.js. Refactored db.js to use a helper for IndexedDB requests, simplifying error handling and reducing boilerplate. Updated CanvasIO.js, CanvasLayers.js, and Canvas_view.js to use the new utilities.
2025-06-26 01:58:18 +02:00
Dariusz L
7fe34e940e Refactor logger initialization to use createModuleLogger
Replaced manual logger setup in CanvasRenderer, ImageCache, Mask_tool, and db modules with the createModuleLogger utility for cleaner and more consistent logging initialization.
2025-06-26 01:33:05 +02:00
Dariusz L
7e539d37ab Initial commit
Add initial project files and setup.
2025-06-26 00:57:12 +02:00