mirror of
https://github.com/atom/atom.git
synced 2026-02-16 01:25:13 -05:00
Move ctrl-mousewheel handling out of TextEditorComponent
Signed-off-by: Nathan Sobo <nathan@github.com>
This commit is contained in:
committed by
Nathan Sobo
parent
ab30ecf994
commit
e1f8a72995
@@ -392,15 +392,6 @@ class TextEditorComponent
|
||||
# Only scroll in one direction at a time
|
||||
{wheelDeltaX, wheelDeltaY} = event
|
||||
|
||||
# Ctrl+MouseWheel adjusts font size.
|
||||
if event.ctrlKey and @config.get('editor.zoomFontWhenCtrlScrolling')
|
||||
if wheelDeltaY > 0
|
||||
@workspace.increaseFontSize()
|
||||
else if wheelDeltaY < 0
|
||||
@workspace.decreaseFontSize()
|
||||
event.preventDefault()
|
||||
return
|
||||
|
||||
if Math.abs(wheelDeltaX) > Math.abs(wheelDeltaY)
|
||||
# Scrolling horizontally
|
||||
previousScrollLeft = @presenter.getScrollLeft()
|
||||
|
||||
@@ -76,6 +76,8 @@ class WorkspaceElement extends HTMLElement
|
||||
@verticalAxis.appendChild(@paneContainer)
|
||||
@addEventListener 'focus', @handleFocus.bind(this)
|
||||
|
||||
@addEventListener 'mousewheel', @handleMousewheel.bind(this), true
|
||||
|
||||
@panelContainers =
|
||||
top: @views.getView(@model.panelContainers.top)
|
||||
left: @views.getView(@model.panelContainers.left)
|
||||
@@ -100,6 +102,15 @@ class WorkspaceElement extends HTMLElement
|
||||
|
||||
getModel: -> @model
|
||||
|
||||
handleMousewheel: (event) ->
|
||||
if event.ctrlKey and @config.get('editor.zoomFontWhenCtrlScrolling') and event.target.matches('atom-text-editor')
|
||||
if event.wheelDeltaY > 0
|
||||
@model.increaseFontSize()
|
||||
else if event.wheelDeltaY < 0
|
||||
@model.decreaseFontSize()
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
|
||||
handleFocus: (event) ->
|
||||
@model.getActivePane().activate()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user