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.
This commit is contained in:
Dariusz L
2025-07-28 00:28:15 +02:00
parent 7701ceda56
commit bfea0cdbab
5 changed files with 515 additions and 40 deletions

View File

@@ -774,6 +774,11 @@ async function createCanvasWidget(node, widget, app) {
// Remove ESC key listener when editor closes
document.removeEventListener('keydown', handleEscKey);
setTimeout(() => {
// Use the actual canvas container for centering calculation
const currentCanvasContainer = originalParent.querySelector('.painterCanvasContainer.painter-container');
const fullscreenCanvasContainer = backdrop.querySelector('.painterCanvasContainer.painter-container');
const currentRect = currentCanvasContainer.getBoundingClientRect();
const fullscreenRect = fullscreenCanvasContainer.getBoundingClientRect();
adjustViewportForCentering(currentRect, fullscreenRect, -1);
canvas.render();
if (node.onResize) {
@@ -811,8 +816,11 @@ async function createCanvasWidget(node, widget, app) {
// Add ESC key listener when editor opens
document.addEventListener('keydown', handleEscKey);
setTimeout(() => {
const originalRect = originalParent.getBoundingClientRect();
const fullscreenRect = modalContent.getBoundingClientRect();
// Use the actual canvas container for centering calculation
const originalCanvasContainer = originalParent.querySelector('.painterCanvasContainer.painter-container');
const fullscreenCanvasContainer = modalContent.querySelector('.painterCanvasContainer.painter-container');
const originalRect = originalCanvasContainer.getBoundingClientRect();
const fullscreenRect = fullscreenCanvasContainer.getBoundingClientRect();
adjustViewportForCentering(originalRect, fullscreenRect, 1);
canvas.render();
if (node.onResize) {