Spaces:
Running
Running
manual box value fix reset
Browse files
comic_panel_extractor/static/annotator.html
CHANGED
|
@@ -922,8 +922,53 @@
|
|
| 922 |
}
|
| 923 |
}
|
| 924 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 925 |
async loadImage(imageName) {
|
| 926 |
try {
|
|
|
|
| 927 |
// Load image data
|
| 928 |
const imageResponse = await fetch(`/api/annotate/image/${encodeURIComponent(imageName)}`);
|
| 929 |
const imageData = await imageResponse.json();
|
|
|
|
| 922 |
}
|
| 923 |
}
|
| 924 |
|
| 925 |
+
resetAnnotationStates() {
|
| 926 |
+
// Reset selection
|
| 927 |
+
this.selectedBoxIndex = -1;
|
| 928 |
+
|
| 929 |
+
// Reset drawing states
|
| 930 |
+
this.isDrawing = false;
|
| 931 |
+
this.isDragging = false;
|
| 932 |
+
this.isResizing = false;
|
| 933 |
+
this.isDraggingEdge = false;
|
| 934 |
+
this.isDraggingPoint = false;
|
| 935 |
+
|
| 936 |
+
// Reset segmentation states
|
| 937 |
+
this.isDrawingPolygon = false;
|
| 938 |
+
this.polygonPoints = [];
|
| 939 |
+
this.currentPolygon = null;
|
| 940 |
+
|
| 941 |
+
// Reset bbox states
|
| 942 |
+
this.currentBox = null;
|
| 943 |
+
this.resizeHandle = null;
|
| 944 |
+
|
| 945 |
+
// Reset drag states
|
| 946 |
+
this.draggingEdgeIndex = -1;
|
| 947 |
+
this.draggingPointIndex = -1;
|
| 948 |
+
this.dragStartX = 0;
|
| 949 |
+
this.dragStartY = 0;
|
| 950 |
+
this.lastMouseX = 0;
|
| 951 |
+
this.lastMouseY = 0;
|
| 952 |
+
|
| 953 |
+
// Reset dynamic detection states
|
| 954 |
+
this.waitingForDrag = false;
|
| 955 |
+
this.initialClickPos = null;
|
| 956 |
+
this.clickStartTime = 0;
|
| 957 |
+
|
| 958 |
+
// Reset cursor
|
| 959 |
+
this.canvas.style.cursor = 'crosshair';
|
| 960 |
+
|
| 961 |
+
// Hide edit panel
|
| 962 |
+
const editPanel = document.getElementById('annotationEditPanel');
|
| 963 |
+
if (editPanel) {
|
| 964 |
+
editPanel.style.display = 'none';
|
| 965 |
+
}
|
| 966 |
+
}
|
| 967 |
+
|
| 968 |
+
|
| 969 |
async loadImage(imageName) {
|
| 970 |
try {
|
| 971 |
+
this.resetAnnotationStates();
|
| 972 |
// Load image data
|
| 973 |
const imageResponse = await fetch(`/api/annotate/image/${encodeURIComponent(imageName)}`);
|
| 974 |
const imageData = await imageResponse.json();
|