-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from uramakilab/feat/recalibration
Feat/recalibration
- Loading branch information
Showing
10 changed files
with
474 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<template> | ||
<v-dialog v-model="aDialog" max-width="300px" max-height="500px"> | ||
<v-card> | ||
<v-card-title class="headline text-center mx-auto">recalibrate</v-card-title> | ||
<v-card-text> | ||
{{ (mockPattern.length != 0) ? `using ${mockPattern.length} selected points` : `no points selected, using | ||
all ${pattern.length} points` }} | ||
</v-card-text> | ||
<v-card-actions> | ||
<v-spacer></v-spacer> | ||
<v-btn color="blue darken-1" text @click="recalibrate">recalib</v-btn> | ||
<v-btn color="blue darken-1" text @click="goBack">back</v-btn> | ||
<v-btn color="blue darken-1" text @click="aDialog = false">close</v-btn> | ||
|
||
<v-spacer></v-spacer> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
|
||
<script> | ||
export default { | ||
props: { | ||
configDialog: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
data() { | ||
return { | ||
aDialog: false | ||
} | ||
}, | ||
watch: { | ||
configDialog(newDialog) { | ||
this.aDialog = newDialog | ||
}, | ||
aDialog(newAdialog) { | ||
this.$emit('close', newAdialog); | ||
} | ||
}, | ||
computed: { | ||
pattern() { | ||
return this.$store.state.calibration.pattern | ||
}, | ||
mockPattern() { | ||
return this.$store.state.calibration.mockPattern | ||
}, | ||
}, | ||
methods: { | ||
recalibrate() { | ||
this.$emit('recalib'); | ||
}, | ||
goBack(){ | ||
this.$emit('goBack'); | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<template> | ||
<v-dialog v-model="auxDialog" max-width="300px" max-height="500px"> | ||
<v-card> | ||
<v-card-title class="headline text-center mx-auto">Point {{ pointNumber + 1 }}</v-card-title> | ||
<v-card-text> | ||
<v-container> | ||
<v-row> | ||
<v-col cols="6" class="font-weight-bold">(x, y):</v-col> | ||
<v-col cols="6" class="text-right">({{ x }}, {{ y }})</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col cols="6" class="font-weight-bold">Accuracy:</v-col> | ||
<v-col cols="6" class="text-right">{{ accuracy }} px</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col cols="6" class="font-weight-bold">precision (SD):</v-col> | ||
<v-col cols="6" class="text-right">{{ precision }} px</v-col> | ||
</v-row> | ||
</v-container> | ||
</v-card-text> | ||
<v-card-actions> | ||
<v-spacer></v-spacer> | ||
<v-btn color="blue darken-1" text @click="select">{{ selected ? 'unselect' : 'select' }}</v-btn> | ||
<v-btn color="blue darken-1" text @click="auxDialog = false">close</v-btn> | ||
<v-spacer></v-spacer> | ||
</v-card-actions> | ||
</v-card> | ||
</v-dialog> | ||
</template> | ||
|
||
|
||
<script> | ||
export default { | ||
props: { | ||
dialog: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
x: { | ||
type: Number, | ||
default: 0 | ||
}, | ||
y: { | ||
type: Number, | ||
default: 0 | ||
}, | ||
precision: { | ||
type: Number, | ||
default: 0 | ||
}, | ||
accuracy: { | ||
type: Number, | ||
default: 0 | ||
}, | ||
pointNumber: { | ||
type: Number, | ||
default: 0 | ||
} | ||
}, | ||
computed: { | ||
pattern() { | ||
return this.$store.state.calibration.pattern | ||
}, | ||
mockPattern() { | ||
return this.$store.state.calibration.mockPattern | ||
}, | ||
}, | ||
data() { | ||
return { | ||
auxDialog: false, | ||
selected: false | ||
} | ||
}, | ||
watch: { | ||
dialog(newDialog) { | ||
this.auxDialog = newDialog | ||
}, | ||
auxDialog(newAuxDialog) { | ||
this.$emit('close', newAuxDialog); | ||
}, | ||
mockPattern(newMockPattern) { | ||
const point = this.pattern[this.pointNumber] | ||
this.selected = newMockPattern.includes(point) | ||
}, | ||
pointNumber(newPointNumber) { | ||
const point = this.pattern[newPointNumber] | ||
this.selected = this.mockPattern.includes(point) | ||
} | ||
}, | ||
methods: { | ||
select() { | ||
this.$emit('select', this.pointNumber) | ||
}, | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<template> | ||
<div> | ||
<v-btn v-if="showButton" class="draggable-btn" fab dark :color="color" ref="draggableBtn" @mousedown="startDrag"> | ||
<v-icon>{{ icon }}</v-icon> | ||
</v-btn> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: { | ||
color: { | ||
type: String, | ||
default: 'green' | ||
}, | ||
icon: { | ||
type: String, | ||
default: 'mdi-cursor-move', | ||
}, | ||
}, | ||
data() { | ||
return { | ||
dragging: false, | ||
showButton: true, | ||
initialMouseX: 0, | ||
initialMouseY: 0, | ||
initialBtnX: 0, | ||
initialBtnY: 0, | ||
startTime: 0, | ||
}; | ||
}, | ||
methods: { | ||
startDrag(event) { | ||
this.dragging = true; | ||
this.startTime = new Date(); | ||
this.initialMouseX = event.clientX; | ||
this.initialMouseY = event.clientY; | ||
const rect = this.$refs.draggableBtn.$el.getBoundingClientRect(); | ||
this.initialBtnX = rect.left; | ||
this.initialBtnY = rect.top; | ||
window.addEventListener("mousemove", this.handleDrag); | ||
window.addEventListener("mouseup", this.endDrag); | ||
}, | ||
handleDrag(event) { | ||
if (this.dragging) { | ||
const deltaX = event.clientX - this.initialMouseX; | ||
const deltaY = event.clientY - this.initialMouseY; | ||
this.$refs.draggableBtn.$el.style.left = this.initialBtnX + deltaX + "px"; | ||
this.$refs.draggableBtn.$el.style.top = this.initialBtnY + deltaY + "px"; | ||
} | ||
}, | ||
endDrag() { | ||
if (this.dragging) { | ||
this.dragging = false; | ||
const endTime = new Date(); | ||
const timeDifference = endTime - this.startTime; | ||
// console.log(`User dragged for ${timeDifference} milliseconds`); | ||
if (timeDifference <= 100) { | ||
this.handleClick() | ||
} | ||
} | ||
}, | ||
handleClick(event) { | ||
if (!this.dragging) { | ||
this.$emit('click', event); | ||
} | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style> | ||
.draggable-btn { | ||
position: fixed; | ||
bottom: 20px; | ||
right: 20px; | ||
z-index: 1000; | ||
} | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.