Skip to content

Commit

Permalink
Create a slider to navigate between frames (#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley authored Oct 3, 2022
1 parent 41d0027 commit f5f9dbb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
17 changes: 15 additions & 2 deletions web_client/src/components/ControlPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ export default {
.catch(this.handleNavigationError);
}
},
slideToFrame(framePosition) {
this.navigateToFrame(this.currentViewData.scanFramesList[framePosition - 1]);
},
updateImage() {
if (this.direction === 'back') {
this.navigateToFrame(this.previousFrame);
Expand Down Expand Up @@ -337,7 +340,8 @@ export default {
class="grey--text"
style="display:inline"
>
{{ currentViewData.scanPositionString }}
({{ currentViewData.scanPosition }} /
{{ currentViewData.experimentScansList.length }})
</p>
</div>
<div>
Expand Down Expand Up @@ -368,9 +372,18 @@ export default {
class="grey--text"
style="display:inline"
>
{{ currentViewData.framePositionString }}
({{ currentViewData.framePosition }} /
{{ currentViewData.scanFramesList.length }})
</p>
</div>
<v-slider
:value="currentViewData.framePosition"
ticks="always"
tick-size="4"
:min="1"
:max="currentViewData.scanFramesList.length"
@input="slideToFrame"
/>
<div>
<v-btn
:disabled="!previousFrame"
Expand Down
6 changes: 4 additions & 2 deletions web_client/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,10 @@ const {
scanSubject: scan.subjectID,
scanLink: scan.link,
scanDecisions: scan.decisions,
scanPositionString: `(${experimentScansList.indexOf(scan.id) + 1}/${experimentScansList.length})`,
framePositionString: `(${scanFramesList.indexOf(currentFrame.id) + 1}/${scanFramesList.length})`,
experimentScansList,
scanFramesList,
scanPosition: experimentScansList.indexOf(scan.id) + 1,
framePosition: scanFramesList.indexOf(currentFrame.id) + 1,
backTo: currentFrame.previousFrame,
forwardTo: currentFrame.nextFrame,
upTo: state.scanFrames[upTo] ? state.scanFrames[upTo][0] : undefined,
Expand Down

0 comments on commit f5f9dbb

Please sign in to comment.