Skip to content

Commit

Permalink
🐛 fix #139
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidZhang73 committed Mar 6, 2022
1 parent e515ded commit 8a08a1b
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/pages/annotation/CanvasPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const labelOption = computed(() => configurationStore.objectLabelData.map(label
}
}))
const handleSelectInput = (labelId) => {
annotationList.value.at(-1).color = configurationStore.objectLabelData.find(label => label.id === labelId).color
annotationList.value[annotationList.value.length - 1].color = configurationStore.objectLabelData.find(label => label.id === labelId).color
}
/// autofocus
Expand Down Expand Up @@ -601,7 +601,7 @@ const handleMousemove = event => {
// creating a region
if (createContext) {
const activeAnnotation = createContext.regionAnnotation
const lastPoint = activeAnnotation.pointList.at(-1)
const lastPoint = activeAnnotation.pointList[activeAnnotation.pointList.length - 1]
lastPoint.x = mouseX
lastPoint.y = mouseY
}
Expand Down Expand Up @@ -783,10 +783,10 @@ const handleMousedown = event => {
}
if (minIndex === 0 && maxIndex === regionAnnotation.pointList.length - 1) {
regionAnnotation.pointList.push(newPoint)
newPoint = regionAnnotation.pointList.at(-1)
newPoint = regionAnnotation.pointList[regionAnnotation.pointList.length - 1]
} else {
regionAnnotation.pointList.splice(minIndex + 1, 0, newPoint)
newPoint = regionAnnotation.pointList.at(minIndex + 1)
newPoint = regionAnnotation.pointList[minIndex + 1]
}
dragContext = {
type: 'sizing',
Expand All @@ -799,7 +799,7 @@ const handleMousedown = event => {
if (shiftDown.value && !nearPoint) {
regionAnnotation = regionAnnotation.clone()
annotationList.value.push(regionAnnotation)
regionAnnotation = annotationList.value.at(-1)
regionAnnotation = annotationList.value[annotationList.value.length - 1]
}
dragContext = {
type: nearPoint ? 'sizing' : 'moving',
Expand All @@ -822,7 +822,7 @@ const handleMousedown = event => {
])
annotationList.value.push(regionAnnotation)
createContext = {
regionAnnotation: annotationList.value.at(-1)
regionAnnotation: annotationList.value[annotationList.value.length - 1]
}
}
} else if (annotationStore.mode === 'skeleton' && preferenceStore.skeletons) {
Expand All @@ -845,7 +845,7 @@ const handleMousedown = event => {
if (shiftDown.value && nearPoint && nearPoint.name === 'center') {
skeletonAnnotation = skeletonAnnotation.clone()
annotationList.value.push(skeletonAnnotation)
skeletonAnnotation = annotationList.value.at(-1)
skeletonAnnotation = annotationList.value[annotationList.value.length - 1]
}
dragContext = {
type: nearPoint && nearPoint.name !== 'center' ? 'sizing' : 'moving',
Expand All @@ -862,7 +862,7 @@ const handleMousedown = event => {
const skeletonAnnotation = new SkeletonAnnotation(mouseX, mouseY, annotationStore.skeletonTypeId)
annotationList.value.push(skeletonAnnotation)
createContext = {
skeletonAnnotation: annotationList.value.at(-1),
skeletonAnnotation: annotationList.value[annotationList.value.length - 1],
mouseDownX: mouseX,
mouseDownY: mouseY
}
Expand Down Expand Up @@ -1055,10 +1055,10 @@ const handleTouchstart = event => {
}
if (minIndex === 0 && maxIndex === regionAnnotation.pointList.length - 1) {
regionAnnotation.pointList.push(nearPoint)
nearPoint = regionAnnotation.pointList.at(-1)
nearPoint = regionAnnotation.pointList[regionAnnotation.pointList.length - 1]
} else {
regionAnnotation.pointList.splice(minIndex + 1, 0, nearPoint)
nearPoint = regionAnnotation.pointList.at(minIndex + 1)
nearPoint = regionAnnotation.pointList[minIndex + 1]
}
type = 'sizing'
}
Expand All @@ -1085,7 +1085,7 @@ const handleTouchstart = event => {
regionAnnotation.highlight = true
annotationList.value.push(regionAnnotation)
createContext = {
regionAnnotation: annotationList.value.at(-1)
regionAnnotation: annotationList.value[annotationList.value.length - 1]
}
}
} else if (annotationStore.mode === 'skeleton' && preferenceStore.skeletons) {
Expand All @@ -1104,7 +1104,7 @@ const handleTouchstart = event => {
skeletonAnnotation = skeletonAnnotation.clone()
skeletonAnnotation.highlight = true
annotationList.value.push(skeletonAnnotation)
skeletonAnnotation = annotationList.value.at(-1)
skeletonAnnotation = annotationList.value[annotationList.value.length - 1]
}
if (!(annotationStore.copyMode || annotationStore.delMode || annotationStore.indicatingMode) ||
nearPoint.name ===
Expand All @@ -1130,7 +1130,7 @@ const handleTouchstart = event => {
skeletonAnnotation.highlight = true
annotationList.value.push(skeletonAnnotation)
createContext = {
skeletonAnnotation: annotationList.value.at(-1),
skeletonAnnotation: annotationList.value[annotationList.value.length - 1],
mouseDownX: mouseX,
mouseDownY: mouseY
}
Expand Down

0 comments on commit 8a08a1b

Please sign in to comment.