Skip to content

Commit

Permalink
should not do auto scroll when navigating using mouse (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
riophae committed Jun 12, 2018
1 parent b45d3db commit 9f4c0df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/mixins/optionMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
}),

setCurrentHighlightedOption() {
this.instance.setCurrentHighlightedOption(this.node)
this.instance.setCurrentHighlightedOption(this.node, false)
},
},
}
8 changes: 5 additions & 3 deletions src/mixins/treeselectMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,13 +1171,15 @@ export default {
return true
},

setCurrentHighlightedOption(node) {
setCurrentHighlightedOption(node, scroll = true) {
if (!node) return

this.menu.current = node.id

const $option = this.$el.querySelector(`.vue-treeselect__option[data-id="${node.id}"]`)
if ($option) scrollIntoView(this.$refs.menu, $option)
if (scroll) {
const $option = this.$el.querySelector(`.vue-treeselect__option[data-id="${node.id}"]`)
if ($option) scrollIntoView(this.$refs.menu, $option)
}
},

resetHighlightedOptionWhenNecessary(forceReset = false) {
Expand Down

0 comments on commit 9f4c0df

Please sign in to comment.