Fix regression in hovered dock tracking due to workspace refactor

Also, backfill tests for showing, hiding and updating the dock toggle
buttons in response to mouse movements.
This commit is contained in:
Max Brunsfeld
2017-04-10 14:15:31 -07:00
parent 3292e3b4df
commit 399b70662d
4 changed files with 188 additions and 32 deletions

View File

@@ -118,7 +118,9 @@ module.exports = class Dock {
// Extended: Toggle the dock's visiblity without changing the {Workspace}'s
// active pane container.
toggle () {
this.setState({visible: !this.state.visible})
const state = {visible: !this.state.visible}
if (!state.visible) state.hovered = false
this.setState(state)
}
// Extended: Check if the dock is visible.
@@ -293,7 +295,7 @@ module.exports = class Dock {
// Determine whether the cursor is within the dock hover area. This isn't as simple as just using
// mouseenter/leave because we want to be a little more forgiving. For example, if the cursor is
// over the footer, we want to show the bottom dock's toggle button.
pointWithinHoverArea (point, includeButtonWidth) {
pointWithinHoverArea (point, includeButtonWidth = this.state.hovered) {
const dockBounds = this.innerElement.getBoundingClientRect()
// Copy the bounds object since we can't mutate it.
const bounds = {