mirror of
https://github.com/Azornes/Comfyui-LayerForge.git
synced 2026-03-24 05:52:12 -03:00
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.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { createModuleLogger } from "./LoggerUtils.js";
|
||||
import { createCanvas } from "./CommonUtils.js";
|
||||
|
||||
const log = createModuleLogger('IconLoader');
|
||||
|
||||
@@ -147,11 +148,8 @@ export class IconLoader {
|
||||
* Create a fallback canvas icon with colored background and text
|
||||
*/
|
||||
private createFallbackIcon(tool: string): HTMLCanvasElement {
|
||||
const canvas = document.createElement('canvas');
|
||||
canvas.width = 24;
|
||||
canvas.height = 24;
|
||||
const { canvas, ctx } = createCanvas(24, 24);
|
||||
|
||||
const ctx = canvas.getContext('2d');
|
||||
if (!ctx) {
|
||||
log.error('Failed to get canvas context for fallback icon');
|
||||
return canvas;
|
||||
|
||||
Reference in New Issue
Block a user