Commit Graph

90 Commits

Author SHA1 Message Date
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
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
Dariusz L
2c4ead38ee Refactor rendering logic to CanvasRenderer class
Moved all rendering-related methods from Canvas.js to a new CanvasRenderer.js module. Canvas now delegates rendering to CanvasRenderer, improving separation of concerns and maintainability.
2025-06-26 00:21:25 +02:00
Dariusz L
7c35490e6e Refactor mask generation using visibility canvas
Replaces per-layer mask processing with a single visibility canvas that composites all layers, then generates the mask based on the resulting alpha values. This simplifies the logic and ensures correct handling of partial transparency across all layers.
2025-06-26 00:06:07 +02:00
Dariusz L
b60b1723a3 Replace selected layer with matted image result
Instead of adding a new layer after matting, this change replaces the selected image layer with the matted result and removes the old imageId to ensure the new image is saved. This prevents layer duplication and maintains the correct layer order.
2025-06-25 23:26:54 +02:00
Dariusz L
38ad476719 Improve canvas save logic and add detailed debug logging
Enhanced the canvas save mechanism to ensure unique file names per node, prevent concurrent saves and executions, and handle missing files more robustly. Switched all logger levels to DEBUG for detailed tracing. Added fallback logic for file naming, improved error handling, and ensured that empty canvases are not saved. These changes improve reliability and traceability of canvas operations, especially in multi-node scenarios.
2025-06-25 23:21:50 +02:00
Dariusz L
29ec41b0a1 Refactor layer operations into CanvasLayers module
Moved all layer-related logic from Canvas.js to a new CanvasLayers.js module, including blend modes, clipboard operations, transformations, and utility functions. Canvas.js now delegates these operations to CanvasLayers, improving code organization and maintainability.
2025-06-25 22:43:53 +02:00
Dariusz L
1f63aa9ca1 Refactor Canvas interaction logic to separate module
Moved all user interaction handling (mouse, keyboard, panning, resizing, dragging, etc.) from Canvas.js to a new CanvasInteractions.js module. Canvas.js now delegates interaction events to CanvasInteractions, improving code organization and maintainability.
2025-06-25 22:02:39 +02:00
Dariusz L
041a8a14a8 Refactor canvas state management to CanvasState class
Moved undo/redo history and IndexedDB state logic from Canvas.js to a new CanvasState.js module. Canvas now delegates state persistence and history operations to CanvasState, improving separation of concerns and maintainability.
2025-06-25 20:58:19 +02:00
Dariusz L
e3040c3aed Add logging system 2025-06-25 20:44:25 +02:00
Dariusz L
1e58747b76 Add concurrency locks and detailed logging to canvas processing
Introduces concurrency locks in Python and JavaScript to prevent simultaneous processing and saving operations in canvas-related workflows. Adds extensive logging throughout the canvas image processing, saving, and matting routines to aid debugging and trace execution flow. Also improves error handling and state management in both backend and frontend code.
2025-06-25 20:00:58 +02:00
Dariusz L
0fc64df279 Refactor canvas image storage to use IndexedDB
Images used in canvas layers are now stored in a dedicated 'CanvasImages' object store in IndexedDB, referenced by unique imageId. The Canvas class and db.js were updated to support saving, loading, and removing images by imageId, improving performance and scalability. Legacy imageSrc handling is preserved for backward compatibility, and the database schema version was incremented to 2 to support the new store.
2025-06-25 09:02:28 +02:00
Dariusz L
c3cc33c711 Refactor image utilities and cache to separate modules
Moved image data validation, conversion, mask application, and preparation functions from Canvas_view.js to a new ImageUtils.js module. Extracted the image cache logic into a new ImageCache.js class. Updated Canvas_view.js to use the new modules and refactored relevant imports and usage.
2025-06-25 07:05:44 +02:00
Dariusz L
d5a186cc51 Remove matting and duplicate undo/redo buttons from UI
Deleted the duplicate Matting button
2025-06-25 06:43:33 +02:00
Dariusz L
6b44bd9239 Refactor JS code for consistent formatting and style
Standardized spacing and object literal formatting across multiple JS files for improved readability and consistency. No functional changes were made. Minor Python formatting adjustment for line length in canvas_node.py.
2025-06-25 05:51:47 +02:00
Dariusz L
acdd12b65e Add mask drawing tool and improve mask handling
Introduces a new MaskTool for interactive mask drawing with adjustable brush size, strength, and softness. Updates Canvas.js to integrate mask editing, rendering, and saving, including support for saving images with and without masks. Enhances the UI in Canvas_view.js with mask controls and a dialog for canvas resizing. Updates canvas_node.py to load images without masks for processing. These changes improve user control over mask creation and management in the canvas workflow.
2025-06-25 02:47:40 +02:00
Dariusz L
03ab254f63 Improve layer state comparison and mirror methods
Added getStateSignature to compare layer states by serializing relevant properties, avoiding issues with image object references. Refactored mirrorHorizontal and mirrorVertical to be async and await all image updates before rendering and saving state, ensuring consistency and preventing race conditions.
2025-06-24 19:42:28 +02:00
Dariusz L
0e590ab5d7 Fix aspect ratio lock when resizing with Shift key
Simplifies and corrects the logic for maintaining the original aspect ratio when resizing objects with the Shift key pressed. Ensures consistent behavior regardless of handle or direction.
2025-06-24 19:23:06 +02:00
Dariusz L
c7375206fb Increase z-index for canvas widget tooltip
Raised the z-index of the canvas widget tooltip from 1001 to 9999 to ensure it appears above the modal backdrop and other UI elements.
2025-06-24 19:18:46 +02:00
Dariusz L
ec3e07f4c4 Improve canvas editor modal open/close logic
Refactored the canvas editor modal to allow toggling open and close with the same button. Updated button text and title to reflect the editor state, removed the separate close button, and improved state management for better user experience.
2025-06-24 19:16:14 +02:00
Dariusz L
d5e35f4cfc Adjust editor button size and disable during modal
Increased the 'Open in Editor' button width from 30px to 40px for better visibility. The button is now disabled when the modal is open and re-enabled when the modal is closed to prevent multiple modal instances.
2025-06-24 19:07:19 +02:00
Dariusz L
04d3531bf5 Add modal editor for canvas widget
Introduces a modal dialog that allows users to open the canvas widget in a larger editor view. Adds new styles for the modal, a button to trigger the editor, and ensures proper cleanup when the node is removed.
2025-06-24 19:01:25 +02:00
Dariusz L
20672ab138 Refactor canvas toolbar with grouped button sections
Reorganized the canvas toolbar into visually grouped button sections using new CSS classes for better usability and clarity. Added separators between groups, introduced button groups for help, I/O, canvas/layer management, transforms, tools/history, and cache actions. Simplified and modularized button creation, and improved matting button logic for better user feedback.
2025-06-24 17:49:05 +02:00
Dariusz L
3f67b97871 Replace matting status indicator with button spinner
Removed the MattingStatusIndicator class and replaced it with a spinner animation directly on the Matting button. The button now shows a loading spinner and disables itself during processing, improving user feedback and simplifying the UI.
2025-06-24 17:40:01 +02:00
Dariusz L
64550609b8 Add saveState calls after layer modifications
Added calls to saveState() after scaling, rotating, and removing layers to ensure changes are properly recorded in the undo/redo history. Also refactored the matting button UI for better layout and ensured saveState is called after matting results are applied.
2025-06-24 17:30:32 +02:00
Dariusz L
3922572315 Add button to clear all saved canvas states
Introduces a 'Clear Cache' button to the Canvas widget UI, allowing users to clear all saved canvas states. Implements the clearAllCanvasStates function in db.js to handle the deletion of all canvas state entries from the database.
2025-06-24 16:38:56 +02:00
Dariusz L
a874a341e0 Migrate canvas state storage to IndexedDB
Replaced localStorage usage in Canvas.js with asynchronous IndexedDB operations for saving, loading, and removing canvas state. Added a new db.js module to handle IndexedDB interactions, improving scalability and reliability of state persistence.
2025-06-24 08:21:34 +02:00
Dariusz L
e47d51e19c Add localStorage state persistence and refactor image loading
Introduces methods to save and load canvas state to localStorage, enabling persistence across sessions. Refactors image loading for drag-and-drop, file input, and clipboard paste to use FileReader and data:URL, improving compatibility and reliability. Updates layer addition to consistently update selection and save state. Calls loadInitialState on widget creation to restore previous state if available.
2025-06-24 08:11:45 +02:00
Dariusz L
28f4a09d8b Revert "Add undo/redo shortcuts to help section"
This reverts commit 1c4c2fc475.
2025-06-24 07:50:52 +02:00
Dariusz L
1c4c2fc475 Add undo/redo shortcuts to help section
Updated the help section in Canvas_view.js to include keyboard shortcuts for undo (Ctrl+Z) and redo (Ctrl+Y / Ctrl+Shift+Z) actions.
2025-06-24 06:48:35 +02:00
Dariusz L
c8e7e2c561 Add undo/redo functionality to Canvas
Implemented undo and redo history stacks in Canvas.js, including keyboard shortcuts (Ctrl+Z, Ctrl+Y/Shift+Z), and state saving on relevant actions. Added Undo and Redo buttons to the UI in Canvas_view.js, with dynamic enable/disable based on history state.
2025-06-24 05:34:32 +02:00
Dariusz L
41bd1761c4 Changed naeme 2025-06-21 04:10:43 +02:00
Dariusz L
181d9c89c7 Added focus on canvas 2025-06-21 03:01:49 +02:00
Dariusz L
c46054e442 Update Canvas.js 2025-06-21 02:01:20 +02:00
Dariusz L
fe5ca7e958 Update ShorcutMenu 2025-06-21 01:01:51 +02:00
Dariusz L
797666e2a3 Transform in group 2025-06-21 00:43:07 +02:00
Dariusz L
d9ac5546dd Keep Proportion with shift 2025-06-21 00:25:09 +02:00
Dariusz L
8cd0716449 Move Canvas 2025-06-21 00:15:51 +02:00
Dariusz L
3e1e8bb372 Added Copy-Pasted 2025-06-21 00:00:29 +02:00
Dariusz L
62d858b0c4 Inteligent Scale 2025-06-20 23:42:46 +02:00
Dariusz L
4ab539eea0 Canvas always on top 2025-06-20 23:22:44 +02:00
Dariusz L
e9fe3de6d6 Delete pyproject.toml 2025-06-20 23:03:32 +02:00
Dariusz L
ba4f5fc5ed Update publish.yml 2025-06-20 22:36:23 +02:00
Dariusz L
e87035e7d4 Update README.md 2025-06-20 22:34:01 +02:00
Dariusz L
7ead396465 Added Info button 2025-06-20 22:29:28 +02:00
Dariusz L
7b0400a187 Layer fix 2025-06-20 21:59:01 +02:00
Dariusz L
beb89ed612 Paste Image 2025-06-20 21:38:19 +02:00
Dariusz L
bea71e19e2 Buton disabled 2025-06-20 21:14:47 +02:00
Dariusz L
66e6e6586f Update Canvas.js
Show Layer
2025-06-20 20:24:40 +02:00