fix: disable default menu browser reloads and implement Change Image workspace resetter
This commit is contained in:
+34
@@ -69,6 +69,7 @@ const elements = {
|
||||
infoFilename: document.getElementById('info-filename'),
|
||||
infoResolution: document.getElementById('info-resolution'),
|
||||
infoSize: document.getElementById('info-size'),
|
||||
btnChangeImage: document.getElementById('btn-change-image'),
|
||||
|
||||
// Control Tower: AI Processor
|
||||
btnRemoveBg: document.getElementById('btn-remove-bg'),
|
||||
@@ -147,6 +148,39 @@ function initWorkspace() {
|
||||
selectLocalImage();
|
||||
}
|
||||
});
|
||||
|
||||
// Change image button click
|
||||
elements.btnChangeImage.addEventListener('click', resetWorkspaceToEmpty);
|
||||
}
|
||||
|
||||
function resetWorkspaceToEmpty() {
|
||||
currentImagePath = null;
|
||||
originalFileName = '';
|
||||
processedTempPath = null;
|
||||
activeBgMode = 'transparent';
|
||||
scaleX = 1;
|
||||
scaleY = 1;
|
||||
|
||||
// Destroy cropper safely
|
||||
if (cropper) {
|
||||
cropper.destroy();
|
||||
cropper = null;
|
||||
}
|
||||
|
||||
// Restore drag drop state views
|
||||
elements.editorContainer.classList.add('hidden');
|
||||
elements.dropzone.classList.remove('hidden');
|
||||
|
||||
elements.infoCardLoaded.classList.add('hidden');
|
||||
elements.infoCardEmpty.classList.remove('hidden');
|
||||
|
||||
// Disable processing button until a new file is loaded
|
||||
elements.btnRemoveBg.disabled = true;
|
||||
|
||||
// Clear background customizations
|
||||
resetBgSettings();
|
||||
|
||||
showToast("Image Changed", "Workspace cleared. You can now load a new image.", "info");
|
||||
}
|
||||
|
||||
// --- PYTHON VENV INSTALLER ENGINE ---
|
||||
|
||||
Reference in New Issue
Block a user