Loop through structure clicks
All checks were successful
Build Dev PWA / Build-PWA (push) Successful in 38s

Signed-off-by: Justin Georgi <justin.georgi@gmail.com>
This commit is contained in:
2024-09-29 12:01:29 -07:00
parent ce76528958
commit 966782d8b9

View File

@@ -577,19 +577,31 @@
this.detectorLevel = value
},
structureClick(e) {
const boxCoords = this.box2cvs(this.showResults)
let self = this
function loopIndex(i) {
if (self.selectedChip == -1) return i
let li = i + self.selectedChip
if (li >= numBoxes) li -= numBoxes
return li
}
let boxCoords = this.box2cvs(this.showResults)
const numBoxes = boxCoords.length
let clickX = (e.offsetX - this.canvasOffset.x) / this.canvasZoom
let clickY = (e.offsetY - this.canvasOffset.y) / this.canvasZoom
var findBox = boxCoords.findIndex( (r, i) => { return r.cvsLeft <= clickX &&
let boxEnd = boxCoords.splice(0, this.selectedChip)
boxCoords = boxCoords.concat(boxEnd)
var findBox = boxCoords.findIndex( (r, i) => {
let di = loopIndex(i)
if (di == this.selectedChip ) return false
return r.cvsLeft <= clickX &&
r.cvsRight >= clickX &&
r.cvsTop <= clickY &&
r.cvsBottom >= clickY &&
this.resultData.detections[i].resultIndex > this.selectedChip &&
this.resultData.detections[i].aboveThreshold &&
this.resultData.detections[i].isSearched &&
!this.resultData.detections[i].isDeleted
this.resultData.detections[di].aboveThreshold &&
this.resultData.detections[di].isSearched &&
!this.resultData.detections[di].isDeleted
})
this.selectChip(findBox >= 0 ? this.resultData.detections[findBox].resultIndex : this.selectedChip)
this.selectChip(findBox >= 0 ? this.resultData.detections[loopIndex(findBox)].resultIndex : this.selectedChip)
},
box2cvs(boxInput) {
if (!boxInput || boxInput.length == 0) return []