Commit Graph

380 Commits

Author SHA1 Message Date
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
Dariusz L
fb5bbdd187 Unify styling for "Run GC" and "Clear Cache" buttons
Updated the "Run GC" and "Clear Cache" buttons to match the styling of standard UI buttons
2025-07-30 11:10:13 +02:00
Dariusz L
7662a501a4 Add right-click deselection for layers
Implemented a new feature: right-clicking a layer in the layer panel now deselects it (if it was selected).
2025-07-30 11:06:37 +02:00
Dariusz L
fc4c343418 Improve minimized "Custom Output Area Active" styling
Unified the appearance of the minimized "Custom Output Area Active" bar with the full menu styling:
2025-07-30 11:05:04 +02:00
Dariusz L
b09f9789de Last Point yellow
Added a clear first point distinction when drawing a custom shape: if the mouse cursor is near the beginning of a line (the shape can be closed), the first point is drawn in yellow and larger. This allows the user to see when they can close the shape with a single click. The code has been compiled and is ready to use. The functionality works as expected.
2025-07-30 10:37:12 +02:00
Dariusz L
0de9aabb72 Hide pending generation areas 2025-07-30 09:52:07 +02:00
Dariusz L
3941104bd5 Tooltip Menu change to modern layout 2025-07-28 19:42:10 +02:00
Dariusz L
6b04e3891b Changed to switch button mask on/off 2025-07-28 19:02:29 +02:00
Dariusz L
257bada28d Nice Icon Comfy Clipspace
Nice Icon Comfy Clipspace
2025-07-28 17:54:50 +02:00
Dariusz L
7f39cfc8ed modernized the "Custom Shape Menu"
I updated src/css/custom_shape_menu.css with new styles for a modern look and feel, and I refactored src/CustomShapeMenu.ts to use a new HTML structure for the checkboxes that works with the updated CSS. The menu should now be fully functional with the new design.
2025-07-28 17:05:57 +02:00
Dariusz L
d2b7b396aa moved all CSS from src/CustomShapeMenu.ts to a new file
moved all CSS from src/CustomShapeMenu.ts to a new file src/css/custom_shape_menu.css and updated the TypeScript file to use the external stylesheet. This improves code organization and maintainability.
2025-07-28 16:43:59 +02:00
Dariusz L
0bae8c9c9d fixed the persistent shape preview bug
fixed the persistent shape preview bug where blue dashed lines would remain visible even when the user was no longer interacting with the slider. The issue was caused by race conditions and timing problems in the preview system.
2025-07-28 16:38:45 +02:00
Dariusz L
f57b9f6b58 Layout change 2025-07-28 15:57:28 +02:00
Dariusz L
bb687a768b Refactor text rendering and adjust viewport defaults
Introduced a drawTextWithBackground helper to centralize and simplify text rendering with backgrounds in CanvasRenderer (JS/TS). Updated all relevant usages to use this helper. Adjusted initial viewport x/y offsets in Canvas and Canvas.ts for improved default positioning.
2025-07-28 02:50:01 +02:00
Dariusz L
5e9869f827 Refactor notifications and improve matting UX
Refactored notification utilities for a more modern, reusable notification system and added info/success/error notifications to the background removal (matting) workflow. Removed the custom error dialog in favor of notifications, and exposed all notification types for debugging. Updated imports and cleaned up notification-related code.
2025-07-28 00:58:04 +02:00
Dariusz L
bfea0cdbab Enhance notification system and auto-correct node_id
Adds a modern, type-based notification UI with support for success, error, info, warning, and alert styles, including a new showAlertNotification function. CanvasState now auto-corrects the node_id widget before saving state and notifies the user if a correction occurs. CanvasView centering logic now uses the actual canvas container for more accurate viewport adjustments.
2025-07-28 00:28:15 +02:00
Dariusz L
7701ceda56 Center canvas viewport on fullscreen toggle
Adds logic to adjust the canvas viewport to keep content centered when entering or exiting fullscreen mode. The adjustment calculates the difference in container sizes and updates the viewport position accordingly, improving user experience during fullscreen transitions.
2025-07-27 22:51:37 +02:00
Dariusz L
9e4e618955 Add ESC key support to close fullscreen editor
Implemented an ESC key handler to allow users to close the fullscreen editor mode using the Escape key. Updated the editor button tooltip and the shortcuts documentation to reflect this new shortcut.
2025-07-27 21:39:18 +02:00
Dariusz L
19d1f9aa52 Move mask rendering before preview outlines
The mask is now drawn after layers but before all preview outlines, ensuring correct visual stacking. The redundant mask rendering code after the preview outlines has been removed.
2025-07-27 21:23:05 +02:00
Dariusz L
8d6cd783ec Restore and save outputAreaBounds in CanvasState
Adds logic to restore outputAreaBounds from saved state if available, or fallback to a default for legacy saves. Also ensures outputAreaBounds is included when saving state, improving consistency across sessions.
2025-07-27 21:17:52 +02:00
Dariusz L
7fc49d72f5 Update MaskEditorIntegration.js 2025-07-27 21:11:06 +02:00
Dariusz L
e68fc7e2cb Add dynamic wait time based on image size
Introduced a calculateDynamicWaitTime method to determine wait time before applying a mask, scaling the delay according to the image's pixel count. This improves responsiveness and reliability for different image sizes in the mask editor integration.
2025-07-27 21:10:58 +02:00
Dariusz L
058a1c4d67 Standart Error in Utils 2025-07-27 20:30:06 +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
207bacc1f8 Refactor image and mask utility functions
Moved convertToImage, createMaskFromImageSrc, and canvasToMaskImage from MaskProcessingUtils and mask_utils to ImageUtils for better modularity and reuse. Updated imports in dependent modules to use the new locations. Removed duplicate implementations from mask_utils and MaskProcessingUtils.
2025-07-27 18:47:41 +02:00
Dariusz L
9d0c946e22 Refactor canvas creation to use createCanvas utility
Replaces direct usage of document.createElement('canvas') and manual context setup with the createCanvas utility across multiple utility modules. This change improves code consistency, reduces duplication, and centralizes canvas/context creation logic. Also updates notification usage in ClipboardManager to use showNotification and showInfoNotification utilities.
2025-07-27 18:34:46 +02:00
Dariusz L
7e71d3ec3e Refactor image, mask, and notification logic into utils
Extracted image upload, mask processing, notification, and preview update logic into dedicated utility modules. Updated MaskEditorIntegration and SAMDetectorIntegration to use these new utilities, reducing code duplication and improving maintainability.
2025-07-27 18:19:35 +02:00
Dariusz L
25d07767f1 Rename canvasMask to maskEditorIntegration in Canvas
Refactors the Canvas class to rename the 'canvasMask' property to 'maskEditorIntegration' for consistency. Updates all references and import to use the new name with the .js extension.
2025-07-27 18:00:55 +02:00