Commit 48fb30f7 authored by Phil Hughes's avatar Phil Hughes

fixed up scrolling to items in finder dropdown

parent 27be9666
...@@ -78,8 +78,22 @@ export default { ...@@ -78,8 +78,22 @@ export default {
if (!this.mouseOver) { if (!this.mouseOver) {
this.$nextTick(() => { this.$nextTick(() => {
const el = this.$refs.virtualScrollList.$el; const el = this.$refs.virtualScrollList.$el;
const scrollTop = this.focusedIndex * FILE_FINDER_ROW_HEIGHT;
const bottom = this.listShowCount * FILE_FINDER_ROW_HEIGHT;
el.scrollTop = this.focusedIndex * 55; if (this.focusedIndex === 0) {
// if index is the first index, scroll straight to start
el.scrollTop = 0;
} else if (this.focusedIndex === this.filteredBlobsLength - 1) {
// if index is the last index, scroll to the end
el.scrollTop = this.filteredBlobsLength * FILE_FINDER_ROW_HEIGHT;
} else if (scrollTop >= bottom + el.scrollTop) {
// if element is off the bottom of the scroll list, scroll down one item
el.scrollTop = scrollTop - bottom + FILE_FINDER_ROW_HEIGHT;
} else if (scrollTop < el.scrollTop) {
// if element is off the top of the scroll list, scroll up one item
el.scrollTop = scrollTop;
}
}); });
} }
}, },
...@@ -141,8 +155,9 @@ export default { ...@@ -141,8 +155,9 @@ export default {
this.focusedIndex = index; this.focusedIndex = index;
} }
}, },
onMouseMove() { onMouseMove(index) {
this.cancelMouseOver = false; this.cancelMouseOver = false;
this.onMouseOver(index);
}, },
}, },
}; };
...@@ -152,7 +167,6 @@ export default { ...@@ -152,7 +167,6 @@ export default {
<div <div
class="ide-file-finder-overlay" class="ide-file-finder-overlay"
@mousedown.self="toggleFileFinder(false)" @mousedown.self="toggleFileFinder(false)"
@mousemove="onMouseMove"
> >
<div <div
class="dropdown-menu diff-file-changes ide-file-finder show" class="dropdown-menu diff-file-changes ide-file-finder show"
...@@ -205,6 +219,7 @@ export default { ...@@ -205,6 +219,7 @@ export default {
:index="index" :index="index"
@click="openFile" @click="openFile"
@mouseover="onMouseOver" @mouseover="onMouseOver"
@mousemove="onMouseMove"
/> />
</li> </li>
</template> </template>
......
...@@ -50,6 +50,9 @@ export default { ...@@ -50,6 +50,9 @@ export default {
mouseOverRow() { mouseOverRow() {
this.$emit('mouseover', this.index); this.$emit('mouseover', this.index);
}, },
mouseMove() {
this.$emit('mousemove', this.index);
},
}, },
}; };
</script> </script>
...@@ -63,6 +66,7 @@ export default { ...@@ -63,6 +66,7 @@ export default {
}" }"
@click.prevent="clickRow" @click.prevent="clickRow"
@mouseover="mouseOverRow" @mouseover="mouseOverRow"
@mousemove="mouseMove"
> >
<file-icon <file-icon
:file-name="file.name" :file-name="file.name"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment