358 Commits

Author SHA1 Message Date
Dariusz L
d0e6bf8b3d Update pyproject.toml v1.5.6 2025-08-09 03:24:49 +02:00
Dariusz L
da37900b33 Refactor: unify image handling in CanvasIO via helpers
Removed duplicate code from CanvasIO.ts and replaced it with unified helpers from ImageUtils.ts. All tensor-to-image conversions and image creation now use centralized utility functions for consistency and maintainability.
2025-08-09 03:07:18 +02:00
Dariusz L
64c5e49707 Unify mask scaling logic with scaleImageToFit util
Refactored mask scaling and drawing into the scaleImageToFit method in ImageUtils.ts. Updated CanvasIO.ts to use this utility, reducing code duplication and improving maintainability.
2025-08-09 02:43:36 +02:00
Dariusz L
06d94f6a63 Improve mask loading logic on node connection
Updated mask loading to immediately use available data from connected nodes and preserve existing masks if none is provided. Backend mask data is only fetched after workflow execution, ensuring no stale data is loaded during connection.
2025-08-09 02:33:28 +02:00
Dariusz L
b21d6e3502 implement strict image/mask input separation
Enhanced LayerForge input handling to strictly separate image and mask loading based on connection type. Images now only load when allowImage=true and masks only when allowMask=true, preventing unintended cross-loading between input types.
2025-08-09 01:44:31 +02:00
Dariusz L
285ad035b2 Improve batch images and mask handling
Fixed batch image processing to prevent duplicates and layer deletion while ensuring proper mask loading from input_mask. Images are now added as new layers without removing existing ones, and masks are always checked from backend regardless of image state.
2025-08-09 00:49:58 +02:00
Dariusz L
949ffa0143 Repair Undo/Redo in Masking Mode 2025-08-08 22:41:19 +02:00
Dariusz L
afdac52144 Added mask and image input 2025-08-08 22:23:15 +02:00
Dariusz L
bf55d13f67 Update pyproject.toml v1.5.5 2025-08-08 17:14:05 +02:00
Dariusz L
de83a884c2 Switch mask preview from chunked to canvas rendering
Replaced chunked rendering approach with direct canvas drawing for mask preview, then applying to main canvas. Added "Mask Opacity" slider.
2025-08-08 17:13:44 +02:00
Dariusz L
dd2a81b6f2 add advanced brush cursor visualization
Implemented dynamic brush cursor with visual feedback for size (circle radius), strength (opacity), and hardness (solid/dashed border with gradient). Added overlay canvas system for smooth cursor updates without affecting main rendering performance.
2025-08-08 14:20:55 +02:00
Dariusz L
176b9d03ac unify modifier key handling in CanvasInteractions
Implemented centralized modifier state management with ModifierState interface and getModifierState() method. This eliminates inconsistencies between event-based and state-based modifier checking across mouse, wheel, and keyboard interactions.
2025-08-08 13:50:13 +02:00
Dariusz L
e4f44c10e8 resolve TypeScript errors and memory leaks
Fixed all TypeScript compilation errors by defining a dedicated TransformOrigin type and adding proper null checks. Implemented comprehensive event handler cleanup to prevent memory leaks and improved cross-platform support with Meta key handling for macOS users.
2025-08-08 13:15:21 +02:00
Dariusz L
11dd554204 Update pyproject.toml v1.5.4 2025-08-06 23:09:19 +02:00
Dariusz L
9f21ff13ae Add clipspace utils with full backward support
Refactored clipspace handling into ClipspaceUtils with validateAndFixClipspace() and safeClipspacePaste() for consistent, defensive logic. Ensures full backward compatibility with all ComfyUI versions and eliminates duplicated code.
2025-08-06 23:08:02 +02:00
Dariusz L
1a1d8748cb Update pyproject.toml v1.5.3 2025-08-04 01:50:29 +02:00
Dariusz L
38973b4698 Rename CanvasNode to LayerForgeNode
Replaced all instances of CanvasNode with LayerForgeNode to prevent naming conflicts with the ComfyUI-YCanvas node.
2025-08-04 01:49:37 +02:00
Dariusz L
1bd261bee0 Adjust Style disabled buttons 2025-08-04 01:00:35 +02:00
Dariusz L
df6979a59b Fix selection border points for vertical/horizontal flip 2025-08-04 00:46:14 +02:00
Dariusz L
2427f0bc5f Add fallback instructions to error for node confirmation failure 2025-08-03 23:08:52 +02:00
Dariusz L
3356c631bb Fix toggle mask switch UI sync with auto refresh
Ensured the toggle mask switch UI stays in sync with mask visibility when auto_refresh_after_generation hides or shows the mask. The checkbox and switch now correctly reflect the current mask state, preventing UI desynchronization and improving user experience.
2025-08-03 22:25:25 +02:00
Dariusz L
3d34bfafd5 Fix matting: refresh image after background removal
Fixed an issue where images were not immediately refreshed after background removal (matting). Now, the canvas updates instantly when the background is removed, ensuring correct display without requiring manual scaling or other actions.
2025-08-03 22:14:39 +02:00
Dariusz L
3c3e6934d7 Refactor CanvasLayers.ts: unify & deduplicate logic
Refactored CanvasLayers.ts to eliminate code duplication by unifying five main areas into reusable functions, following the DRY principle. Improved code readability, maintainability, and flexibility with better naming, documentation, and parameterization.
2025-08-03 21:57:47 +02:00
Dariusz L
84e1e4820c Improve cache selection for scaling with blend & crop
Enhanced the system to always select the best available cache based on both blend area and crop, prioritizing exact matches. Prevented costly operations and live rendering during scaling for optimal performance and smooth user experience.
2025-08-03 21:01:46 +02:00
Dariusz L
012368c52b Revert Cached Blend Area 2025-08-03 18:20:41 +02:00
Dariusz L
82c42f99fe Fix clipboard switch tooltip to update on toggle
Refactored tooltip logic for the clipboard switch so it now updates immediately when toggled, showing the correct template without requiring mouse movement. Added helper functions and improved event handling for better UX.
2025-08-03 14:56:18 +02:00
Dariusz L
5da0855a52 Added tooltip to mask visibility switch 2025-08-03 14:38:40 +02:00
Dariusz L
ed9fdf5d60 disable delete button when no layers selected
Added updateButtonStates() to enable/disable delete button based on selection
Updated control setup and selection handlers to call this method
Added CSS for disabled button state and tooltip
Delete button now disables when no layers are selected; all other panel features unchanged
2025-08-03 14:33:20 +02:00
Dariusz L
d84b9385ad Refactor: Move CanvasLayersPanel inline styles to external CSS
Moved all inline styles from CanvasLayersPanel.ts to layers_panel.css
Updated TypeScript to load external CSS and removed injectStyles()
Replaced inline styles with CSS classes in UI methods
Ensured all panel features and interactions work as before
Improved code maintainability and consistency with project structure
2025-08-03 14:27:31 +02:00
Dariusz L
c4318d4923 Refactor: Move blend mode menu styles to CSS file
Moved all blend mode menu styles from CanvasLayers.ts to a dedicated CSS file. Replaced inline styles with CSS classes and preserved all functionality.
2025-08-03 14:18:21 +02:00
Dariusz L
5b54ab28cb Update pyproject.toml v1.5.2 2025-08-03 02:45:20 +02:00
Dariusz L
503ec126a5 Fix DataCloneError by excluding non-serializable cache from state
Excluded blendedImageCache and blendedImageDirty properties from layer serialization in CanvasState.ts to prevent DataCloneError when saving state. This ensures that only serializable data is sent to Web Workers, while runtime caches are regenerated as needed. Blend area performance optimization remains functional without serialization issues.
2025-08-03 02:43:30 +02:00
Dariusz L
3d6e3901d0 Fix button crop icon display and update functionality 2025-08-03 02:19:52 +02:00
Dariusz L
4df89a793e Fix layer selection bug by sorting hit-test by z-index 2025-08-02 19:52:08 +02:00
Dariusz L
e42e08e35d Crop mode button to switch 2025-08-02 19:43:03 +02:00
Dariusz L
7ed6f7ee93 Implement crop mode for cropping selected layer 2025-08-02 19:05:11 +02:00
Dariusz L
9b0d4b3149 Update pyproject.toml v1.5.1 2025-08-01 15:56:25 +02:00
Dariusz L
f0f3d419f8 Update README.md 2025-08-01 15:51:38 +02:00
Dariusz L
26e2036388 Repair cnr_id 2025-08-01 15:23:18 +02:00
Dariusz L
22f5d028a2 Update README.md 2025-07-30 16:39:49 +02:00
Dariusz L
0b817411b7 Update pyproject.toml v1.5.0 2025-07-30 15:48:55 +02:00
Dariusz L
f755507974 Update README.md 2025-07-30 15:00:19 +02:00
Dariusz L
d65dc4349a Update README.md 2025-07-30 14:47:33 +02:00
Dariusz L
04033a48cb Update README.md 2025-07-30 14:44:28 +02:00
Dariusz L
05c0b91ecc Example_workflows 2025-07-30 14:41:05 +02:00
Dariusz L
4de1812370 Update config.js 2025-07-30 13:35:53 +02:00
Dariusz L
e3cef041c9 Implement robust world-based positioning for Blend Mode menu
Redesigned the positioning system for the Blend Mode menu, inspired by the "Custom Output Area" logic. The menu now anchors precisely to the top-right corner of the viewport and stays in place during panning and zooming.
2025-07-30 13:06:01 +02:00
Dariusz L
03950b1787 Implement adaptive selection frame based on layer coverage
Added a smart selection frame for layers that dynamically switches between solid and dashed lines depending on visibility:

Functionality:

Solid line: visible edge segments, not covered by other layers

Dashed line: covered edge segments, obscured by layers with higher zIndex and opacity > 0.1
2025-07-30 11:43:29 +02:00
Dariusz L
3d60c6aafa Move setOutputAreaSize 2025-07-30 11:37:26 +02:00
Dariusz L
fcb5565a28 Fix "Output Area Size" button behavior using new sizing method
Refactored the "Output Area Size" button to use the new setOutputAreaSize method:

Correctly sets output area size and position based on current system logic (custom shape, extensions, outputAreaBounds)

Fully functional across all editor modes

New resizing logic:

Operates relative to the current center of the output area

Output area expands or contracts around its center without repositioning

Ensures center remains unchanged as expected

This fix provides precise control over layout dimensions and aligns with user expectations across workflows.
2025-07-30 11:17:48 +02:00