tien_nemo

remove func

......@@ -413,47 +413,12 @@
if (idx !== -1) {
this.activeIndex = idx;
this.scrollToBox(idx);
// Reset selectingIndex để không hiển thị dropdown khi highlight từ input
this.selectingIndex = null;
} else {
this.activeIndex = null;
}
},
scrollToBox(index) {
if (!this.$refs.pdfContainer || index < 0 || index >= this.ocrData.length) return;
const item = this.ocrData[index];
if (!item || item.isDeleted) return;
// Tính vị trí hiển thị của box
const [x1, y1, x2, y2] = item.bbox;
if (!this.imageWidth || !this.imageHeight || !this.$refs.pdfImage) return;
const displayedWidth = this.$refs.pdfImage.clientWidth;
const displayedHeight = this.$refs.pdfImage.clientHeight;
const scaleX = displayedWidth / this.imageWidth;
const scaleY = displayedHeight / this.imageHeight;
const displayX = Math.round(x1 * scaleX);
const displayY = Math.round(y1 * scaleY);
// Scroll đến vị trí box
const container = this.$refs.pdfContainer;
const containerRect = container.getBoundingClientRect();
const scrollTop = container.scrollTop;
const scrollLeft = container.scrollLeft;
// Tính vị trí scroll để box nằm ở giữa viewport
const targetScrollTop = scrollTop + displayY - (containerRect.height / 2);
const targetScrollLeft = scrollLeft + displayX - (containerRect.width / 2);
container.scrollTo({
top: Math.max(0, targetScrollTop),
left: Math.max(0, targetScrollLeft),
behavior: 'smooth'
});
},
// Xử lý khi click vào input
onInputClick(fieldName) {
// Kiểm tra xem field này có data không
......