mirror of
https://github.com/atom/atom.git
synced 2026-02-19 02:44:29 -05:00
Merge pull request #16546 from atom/as-allow-clicking-scrollbar-with-dock-indicators
Programmatically detect when mouse approaches the edge of a dock
This commit is contained in:
@@ -327,12 +327,15 @@ module.exports = class Dock {
|
||||
// Include all panels that are closer to the edge than the dock in our calculations.
|
||||
switch (this.location) {
|
||||
case 'right':
|
||||
if (!this.isVisible()) bounds.left = bounds.right - 2
|
||||
bounds.right = Number.POSITIVE_INFINITY
|
||||
break
|
||||
case 'bottom':
|
||||
if (!this.isVisible()) bounds.top = bounds.bottom - 1
|
||||
bounds.bottom = Number.POSITIVE_INFINITY
|
||||
break
|
||||
case 'left':
|
||||
if (!this.isVisible()) bounds.right = bounds.left + 2
|
||||
bounds.left = Number.NEGATIVE_INFINITY
|
||||
break
|
||||
}
|
||||
|
||||
@@ -104,6 +104,7 @@ class WorkspaceElement extends HTMLElement {
|
||||
|
||||
this.addEventListener('mousewheel', this.handleMousewheel.bind(this), true)
|
||||
window.addEventListener('dragstart', this.handleDragStart)
|
||||
window.addEventListener('mousemove', this.handleEdgesMouseMove)
|
||||
|
||||
this.panelContainers = {
|
||||
top: this.model.panelContainers.top.getElement(),
|
||||
@@ -132,6 +133,10 @@ class WorkspaceElement extends HTMLElement {
|
||||
return this
|
||||
}
|
||||
|
||||
destroy () {
|
||||
this.subscriptions.dispose()
|
||||
}
|
||||
|
||||
getModel () { return this.model }
|
||||
|
||||
handleDragStart (event) {
|
||||
@@ -169,7 +174,6 @@ class WorkspaceElement extends HTMLElement {
|
||||
// being hovered.
|
||||
this.cursorInCenter = false
|
||||
this.updateHoveredDock({x: event.pageX, y: event.pageY})
|
||||
window.addEventListener('mousemove', this.handleEdgesMouseMove)
|
||||
window.addEventListener('dragend', this.handleDockDragEnd)
|
||||
}
|
||||
|
||||
@@ -199,7 +203,6 @@ class WorkspaceElement extends HTMLElement {
|
||||
|
||||
checkCleanupDockHoverEvents () {
|
||||
if (this.cursorInCenter && !this.hoveredDock) {
|
||||
window.removeEventListener('mousemove', this.handleEdgesMouseMove)
|
||||
window.removeEventListener('dragend', this.handleDockDragEnd)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,7 +310,10 @@ module.exports = class Workspace extends Model {
|
||||
this.originalFontSize = null
|
||||
this.openers = []
|
||||
this.destroyedItemURIs = []
|
||||
this.element = null
|
||||
if (this.element) {
|
||||
this.element.destroy()
|
||||
this.element = null
|
||||
}
|
||||
this.consumeServices(this.packageManager)
|
||||
}
|
||||
|
||||
@@ -1570,6 +1573,7 @@ module.exports = class Workspace extends Model {
|
||||
if (this.activeItemSubscriptions != null) {
|
||||
this.activeItemSubscriptions.dispose()
|
||||
}
|
||||
if (this.element) this.element.destroy()
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user