30 Commits

Author SHA1 Message Date
Dariusz L
2427f0bc5f Add fallback instructions to error for node confirmation failure 2025-08-03 23:08:52 +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
64ee2c6abb createElement to createCanvas 2025-07-27 20:02:45 +02:00
Dariusz L
f36f91487f Replace alert with notification utilities and refactor canvas creation
Replaces all uses of alert() with showErrorNotification or showSuccessNotification for improved user experience and consistency. Refactors canvas creation to use the createCanvas utility function across multiple files, reducing code duplication and improving maintainability. Also updates layer ID generation to use generateUUID.
2025-07-27 19:12:25 +02:00
Dariusz L
0d6bfb01d6 Optimize mask handling and shape mask UX for output area
Replaces full-canvas mask operations with getMaskForOutputArea() for significant performance improvements when processing masks for the output area. Refines shape mask removal and application logic to ensure correct mask state when changing expansion values or custom shapes, including auto-removal and re-application of masks. Adds throttling to shape preview rendering for better UI responsiveness. Improves mask removal to eliminate antialiasing artifacts and updates SAM mask integration to use correct output area positioning.
2025-07-27 17:23:08 +02:00
Dariusz L
796a65d251 Remove unused and redundant methods from canvas modules
Cleaned up the codebase by removing unused or redundant methods from Canvas, CanvasIO, CanvasLayers, CanvasLayersPanel, CanvasRenderer, and MaskTool. This reduces code complexity and improves maintainability without affecting core functionality.
2025-07-26 23:39:29 +02:00
Dariusz L
f28783348e Fix custom shape output area extension and mask logic
Refactors how custom output area shapes interact with extensions, ensuring the shape's position and mask application remain consistent when extensions are toggled. Moves output area shape logic to CanvasInteractions, tracks original shape position, and updates all rendering, IO, and mask operations to use the correct coordinates. Improves mask chunk clearing and adds chunked mask application/removal for shape masks, ensuring correct behavior with expansion and feathering.
2025-07-26 22:39:03 +02:00
Dariusz L
14c5f291a6 Refactor output area and mask handling for flexible canvas bounds
This update introduces a unified output area bounds system, allowing the output area to be extended in all directions independently of the custom shape. All mask and layer operations now reference outputAreaBounds, ensuring correct alignment and rendering. The mask tool, mask editor, and export logic have been refactored to use these bounds, and a new UI for output area extension with live preview and tooltips has been added. The code also improves logging and visualization of mask and output area boundaries.
2025-07-26 18:27:14 +02:00
Dariusz L
3b1a69041c Add layer visibility toggle and icon support
Introduces a 'visible' property to layers and updates all relevant logic to support toggling layer visibility. Adds visibility toggle icons to the layers panel using a new IconLoader utility, with SVG and fallback canvas icons. Updates rendering, selection, and batch preview logic to respect layer visibility. Also improves blend mode menu UI and ensures new/pasted layers are always added on top with correct z-index.
2025-07-24 19:10:17 +02:00
Dariusz L
2778b8df9f Add ShapeTool for custom output area selection
Introduces ShapeTool to allow users to define custom polygonal output areas by holding Shift+S and clicking to add points. The selected shape is used to crop and mask images and layers, and is visualized on the canvas. Updates Canvas, CanvasIO, CanvasInteractions, CanvasLayers, CanvasRenderer, and types to support shape-based output areas, including shape-aware import, export, and rendering logic.
2025-07-24 15:12:53 +02:00
Dariusz L
20d52b632a Refactor layer rendering into reusable methods
Moved layer drawing logic into CanvasLayers._drawLayer and _drawLayers methods, replacing repeated rendering code in CanvasIO and CanvasLayers. This improves maintainability and ensures consistent handling of layer properties such as blend mode, opacity, rotation, and flipping. Also, fixed layer serialization to only generate imageId when missing, and ensured new layers have flipH/flipV set when created from matted images.
2025-07-21 23:03:52 +02:00
Dariusz L
5adc77471f project migration to typescript
Project migration to typescript
2025-07-04 04:22:51 +02:00
Dariusz L
d40f68b8c6 Preserve batch generation area during canvas changes
Introduces a 'generationArea' context for batch image generation, ensuring that batch preview outlines and image placement remain accurate when the canvas is moved or resized. Updates related logic in Canvas, CanvasInteractions, CanvasLayers, and CanvasRenderer to track and render the correct area, and synchronizes context updates across user interactions.
2025-07-03 11:52:16 +02:00
Dariusz L
9f9a733731 Add batch preview manager and mask overlay toggle
Introduces BatchPreviewManager for reviewing and confirming multiple imported layers after auto-refresh. Adds a toggle button for mask overlay visibility in the UI and updates mask rendering logic to respect overlay visibility. Also refactors image import to return new layers and adds a utility for removing layers by ID.
2025-07-03 02:22:51 +02:00
Dariusz L
3419061b6c Add support for importing multiple latest images
Introduces a new backend route and method to fetch all images created since a given timestamp, and updates the frontend to import all new images as layers on auto-refresh. This improves workflow by allowing multiple images generated in a single execution to be imported at once, rather than only the most recent image.
2025-07-03 01:54:50 +02:00
Dariusz L
562b0db042 Initial commit
Project scaffolding and initial file setup.
2025-07-01 17:02:15 +02:00
Dariusz L
81b2a9cc4e Remove redundant white background fill in CanvasIO
Eliminated unnecessary code that filled temporary canvases with a white background in two methods. This streamlines canvas creation and avoids redundant operations.
2025-06-28 09:44:43 +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
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
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
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
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
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
0c3baa3fbd Refactor Canvas I/O logic into CanvasIO module
Moved all input/output related methods from Canvas.js to a new CanvasIO.js module and delegated corresponding Canvas class methods to CanvasIO. This improves code organization and separation of concerns, making Canvas.js more focused on core canvas logic and CanvasIO.js responsible for I/O operations.
2025-06-26 00:31:08 +02:00