Loop through structure clicks
All checks were successful
Build Dev PWA / Build-PWA (push) Successful in 38s
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:
@@ -577,19 +577,31 @@
|
|||||||
this.detectorLevel = value
|
this.detectorLevel = value
|
||||||
},
|
},
|
||||||
structureClick(e) {
|
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 clickX = (e.offsetX - this.canvasOffset.x) / this.canvasZoom
|
||||||
let clickY = (e.offsetY - this.canvasOffset.y) / 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.cvsRight >= clickX &&
|
||||||
r.cvsTop <= clickY &&
|
r.cvsTop <= clickY &&
|
||||||
r.cvsBottom >= clickY &&
|
r.cvsBottom >= clickY &&
|
||||||
this.resultData.detections[i].resultIndex > this.selectedChip &&
|
this.resultData.detections[di].aboveThreshold &&
|
||||||
this.resultData.detections[i].aboveThreshold &&
|
this.resultData.detections[di].isSearched &&
|
||||||
this.resultData.detections[i].isSearched &&
|
!this.resultData.detections[di].isDeleted
|
||||||
!this.resultData.detections[i].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) {
|
box2cvs(boxInput) {
|
||||||
if (!boxInput || boxInput.length == 0) return []
|
if (!boxInput || boxInput.length == 0) return []
|
||||||
|
|||||||
Reference in New Issue
Block a user