Spaces:
Running
Running
info added
Browse files
comic_panel_extractor/static/annotator.html
CHANGED
|
@@ -1736,7 +1736,7 @@
|
|
| 1736 |
this.updateCanvasCursor();
|
| 1737 |
}
|
| 1738 |
|
| 1739 |
-
showModeIndicator(text, type) {
|
| 1740 |
// Create or update mode indicator
|
| 1741 |
let indicator = document.getElementById('modeIndicator');
|
| 1742 |
if (!indicator) {
|
|
@@ -1769,11 +1769,13 @@
|
|
| 1769 |
indicator.textContent = text;
|
| 1770 |
indicator.style.opacity = '1';
|
| 1771 |
|
| 1772 |
-
// Auto-hide
|
| 1773 |
-
|
| 1774 |
-
|
| 1775 |
-
|
| 1776 |
-
|
|
|
|
|
|
|
| 1777 |
}
|
| 1778 |
|
| 1779 |
onDoubleClick(e) {
|
|
@@ -2823,7 +2825,7 @@
|
|
| 2823 |
formData.append('file', file);
|
| 2824 |
|
| 2825 |
try {
|
| 2826 |
-
this.showModeIndicator('File Upload is in progress', 'Uploading File');
|
| 2827 |
const response = await fetch('/api/annotate/upload', {
|
| 2828 |
method: 'POST',
|
| 2829 |
body: formData
|
|
@@ -2831,15 +2833,15 @@
|
|
| 2831 |
|
| 2832 |
if (response.ok) {
|
| 2833 |
const result = await response.json();
|
| 2834 |
-
this.showAlert(result.message, 'success');
|
| 2835 |
await this.loadImages();
|
| 2836 |
|
| 2837 |
// Auto-select the uploaded image
|
| 2838 |
-
var new_file_name =
|
| 2839 |
const index = this.images.findIndex(img => img.name === new_file_name);
|
| 2840 |
if (index >= 0) {
|
| 2841 |
this.currentImageIndex = index;
|
| 2842 |
document.getElementById('imageSelect').value = new_file_name;
|
|
|
|
| 2843 |
this.loadImage(new_file_name);
|
| 2844 |
}
|
| 2845 |
} else {
|
|
|
|
| 1736 |
this.updateCanvasCursor();
|
| 1737 |
}
|
| 1738 |
|
| 1739 |
+
showModeIndicator(text, type, persistent = false) {
|
| 1740 |
// Create or update mode indicator
|
| 1741 |
let indicator = document.getElementById('modeIndicator');
|
| 1742 |
if (!indicator) {
|
|
|
|
| 1769 |
indicator.textContent = text;
|
| 1770 |
indicator.style.opacity = '1';
|
| 1771 |
|
| 1772 |
+
// Auto-hide only if not persistent
|
| 1773 |
+
if (!persistent) {
|
| 1774 |
+
clearTimeout(this.modeIndicatorTimeout);
|
| 1775 |
+
this.modeIndicatorTimeout = setTimeout(() => {
|
| 1776 |
+
indicator.style.opacity = '0';
|
| 1777 |
+
}, 2000);
|
| 1778 |
+
}
|
| 1779 |
}
|
| 1780 |
|
| 1781 |
onDoubleClick(e) {
|
|
|
|
| 2825 |
formData.append('file', file);
|
| 2826 |
|
| 2827 |
try {
|
| 2828 |
+
this.showModeIndicator('File Upload is in progress', 'Uploading File', true);
|
| 2829 |
const response = await fetch('/api/annotate/upload', {
|
| 2830 |
method: 'POST',
|
| 2831 |
body: formData
|
|
|
|
| 2833 |
|
| 2834 |
if (response.ok) {
|
| 2835 |
const result = await response.json();
|
|
|
|
| 2836 |
await this.loadImages();
|
| 2837 |
|
| 2838 |
// Auto-select the uploaded image
|
| 2839 |
+
var new_file_name = file.name
|
| 2840 |
const index = this.images.findIndex(img => img.name === new_file_name);
|
| 2841 |
if (index >= 0) {
|
| 2842 |
this.currentImageIndex = index;
|
| 2843 |
document.getElementById('imageSelect').value = new_file_name;
|
| 2844 |
+
this.showModeIndicator(result.message, 'Uploading File');
|
| 2845 |
this.loadImage(new_file_name);
|
| 2846 |
}
|
| 2847 |
} else {
|