fix: disable default menu browser reloads and implement Change Image workspace resetter
This commit is contained in:
@@ -252,6 +252,10 @@
|
||||
<span class="label">Size</span>
|
||||
<span class="val" id="info-size">-</span>
|
||||
</div>
|
||||
<button class="btn btn-secondary btn-sm w-full" id="btn-change-image" style="margin-top: 10px; border-color: rgba(255, 122, 0, 0.2) !important;">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="17 8 12 3 7 8"></polyline><line x1="12" y1="3" x2="12" y2="15"></line></svg>
|
||||
<span style="font-size: 11px;">Yeni Görsel Yükle</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ function createWindow() {
|
||||
});
|
||||
|
||||
mainWindow.loadFile(path.join(__dirname, 'index.html'));
|
||||
mainWindow.setMenu(null); // Disable default menu and browser shortcuts (F5, F11, Ctrl+F5) to act as a proper native application.
|
||||
|
||||
// Open DevTools if running in dev (optional)
|
||||
// mainWindow.webContents.openDevTools();
|
||||
|
||||
+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