diff --git a/canvas_node.py b/canvas_node.py index c7bab11..48ca6e9 100644 --- a/canvas_node.py +++ b/canvas_node.py @@ -24,7 +24,7 @@ import os try: from python.logger import logger, LogLevel, debug, info, warn, error, exception - logger.set_module_level('canvas_node', LogLevel.NONE) + logger.set_module_level('canvas_node', LogLevel.DEBUG) logger.configure({ 'log_to_file': True, diff --git a/js/Canvas.js b/js/Canvas.js index a92735c..6b90e32 100644 --- a/js/Canvas.js +++ b/js/Canvas.js @@ -38,7 +38,7 @@ export class Canvas { this.dataInitialized = false; this.pendingDataCheck = null; - this.maskTool = new MaskTool(this); + this.maskTool = new MaskTool(this, {onStateChange: this.onStateChange}); this.initCanvas(); this.canvasState = new CanvasState(this); this.canvasInteractions = new CanvasInteractions(this); diff --git a/js/MaskTool.js b/js/MaskTool.js index 6cbc04c..a9b56fd 100644 --- a/js/MaskTool.js +++ b/js/MaskTool.js @@ -3,9 +3,10 @@ import {createModuleLogger} from "./utils/LoggerUtils.js"; const log = createModuleLogger('Mask_tool'); export class MaskTool { - constructor(canvasInstance) { + constructor(canvasInstance, callbacks = {}) { this.canvasInstance = canvasInstance; this.mainCanvas = canvasInstance.canvas; + this.onStateChange = callbacks.onStateChange || null; this.maskCanvas = document.createElement('canvas'); this.maskCtx = this.maskCanvas.getContext('2d'); @@ -88,6 +89,9 @@ export class MaskTool { if (this.canvasInstance.canvasState) { this.canvasInstance.canvasState.saveMaskState(); } + if (this.onStateChange) { + this.onStateChange(); + } } } diff --git a/js/utils/LoggerUtils.js b/js/utils/LoggerUtils.js index d88afe6..d1cbdbc 100644 --- a/js/utils/LoggerUtils.js +++ b/js/utils/LoggerUtils.js @@ -11,7 +11,7 @@ import {logger, LogLevel} from "../logger.js"; * @param {LogLevel} level - Poziom logowania (domyślnie DEBUG) * @returns {Object} Obiekt z metodami logowania */ -export function createModuleLogger(moduleName, level = LogLevel.NONE) { +export function createModuleLogger(moduleName, level = LogLevel.DEBUG) { logger.setModuleLevel(moduleName, level); return {