mirror of
https://github.com/atom/atom.git
synced 2026-02-18 02:21:43 -05:00
Make sure there's a single source of truth for dock hover state
Previously, the workspace's idea of the hovered dock and the docks' themselves could be out of sync.
This commit is contained in:
15
src/dock.js
15
src/dock.js
@@ -153,7 +153,10 @@ module.exports = class Dock {
|
||||
this.state = nextState
|
||||
this.render(this.state)
|
||||
|
||||
const {visible} = this.state
|
||||
const {hovered, visible} = this.state
|
||||
if (hovered !== prevState.hovered) {
|
||||
this.emitter.emit('did-change-hovered', hovered)
|
||||
}
|
||||
if (visible !== prevState.visible) {
|
||||
this.emitter.emit('did-change-visible', visible)
|
||||
}
|
||||
@@ -609,6 +612,16 @@ module.exports = class Dock {
|
||||
return this.paneContainer.onDidDestroyPaneItem(callback)
|
||||
}
|
||||
|
||||
// Extended: Invoke the given callback when the hovered state of the dock changes.
|
||||
//
|
||||
// * `callback` {Function} to be called when the hovered state changes.
|
||||
// * `hovered` {Boolean} Is the dock now hovered?
|
||||
//
|
||||
// Returns a {Disposable} on which `.dispose()` can be called to unsubscribe.
|
||||
onDidChangeHovered (callback) {
|
||||
return this.emitter.on('did-change-hovered', callback)
|
||||
}
|
||||
|
||||
/*
|
||||
Section: Pane Items
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user