Showing
1 changed file
with
0 additions
and
35 deletions
| ... | @@ -413,47 +413,12 @@ | ... | @@ -413,47 +413,12 @@ |
| 413 | 413 | ||
| 414 | if (idx !== -1) { | 414 | if (idx !== -1) { |
| 415 | this.activeIndex = idx; | 415 | this.activeIndex = idx; |
| 416 | - this.scrollToBox(idx); | ||
| 417 | // Reset selectingIndex để không hiển thị dropdown khi highlight từ input | 416 | // Reset selectingIndex để không hiển thị dropdown khi highlight từ input |
| 418 | this.selectingIndex = null; | 417 | this.selectingIndex = null; |
| 419 | } else { | 418 | } else { |
| 420 | this.activeIndex = null; | 419 | this.activeIndex = null; |
| 421 | } | 420 | } |
| 422 | }, | 421 | }, |
| 423 | - scrollToBox(index) { | ||
| 424 | - if (!this.$refs.pdfContainer || index < 0 || index >= this.ocrData.length) return; | ||
| 425 | - | ||
| 426 | - const item = this.ocrData[index]; | ||
| 427 | - if (!item || item.isDeleted) return; | ||
| 428 | - | ||
| 429 | - // Tính vị trí hiển thị của box | ||
| 430 | - const [x1, y1, x2, y2] = item.bbox; | ||
| 431 | - if (!this.imageWidth || !this.imageHeight || !this.$refs.pdfImage) return; | ||
| 432 | - | ||
| 433 | - const displayedWidth = this.$refs.pdfImage.clientWidth; | ||
| 434 | - const displayedHeight = this.$refs.pdfImage.clientHeight; | ||
| 435 | - const scaleX = displayedWidth / this.imageWidth; | ||
| 436 | - const scaleY = displayedHeight / this.imageHeight; | ||
| 437 | - | ||
| 438 | - const displayX = Math.round(x1 * scaleX); | ||
| 439 | - const displayY = Math.round(y1 * scaleY); | ||
| 440 | - | ||
| 441 | - // Scroll đến vị trí box | ||
| 442 | - const container = this.$refs.pdfContainer; | ||
| 443 | - const containerRect = container.getBoundingClientRect(); | ||
| 444 | - const scrollTop = container.scrollTop; | ||
| 445 | - const scrollLeft = container.scrollLeft; | ||
| 446 | - | ||
| 447 | - // Tính vị trí scroll để box nằm ở giữa viewport | ||
| 448 | - const targetScrollTop = scrollTop + displayY - (containerRect.height / 2); | ||
| 449 | - const targetScrollLeft = scrollLeft + displayX - (containerRect.width / 2); | ||
| 450 | - | ||
| 451 | - container.scrollTo({ | ||
| 452 | - top: Math.max(0, targetScrollTop), | ||
| 453 | - left: Math.max(0, targetScrollLeft), | ||
| 454 | - behavior: 'smooth' | ||
| 455 | - }); | ||
| 456 | - }, | ||
| 457 | // Xử lý khi click vào input | 422 | // Xử lý khi click vào input |
| 458 | onInputClick(fieldName) { | 423 | onInputClick(fieldName) { |
| 459 | // Kiểm tra xem field này có data không | 424 | // Kiểm tra xem field này có data không | ... | ... |
-
Please register or sign in to post a comment