Add option to disable auto-scroll (fix #1277)

This commit is contained in:
David Capello 2016-12-02 20:37:54 -03:00
parent 77a9fd0ae6
commit 105cbe4d58
4 changed files with 12 additions and 3 deletions

View File

@ -115,6 +115,7 @@
<option id="zoom_from_center_with_wheel" type="bool" default="false" />
<option id="zoom_from_center_with_keys" type="bool" default="false" />
<option id="show_scrollbars" type="bool" default="true" migrate="Options.ShowScrollbars" />
<option id="auto_scroll" type="bool" default="true" />
<option id="right_click_mode" type="RightClickMode" default="RightClickMode::PAINT_BGCOLOR" migrate="Options.RightClickMode" />
<option id="auto_select_layer" type="bool" default="false" migrate="Options.AutoSelectLayer" />
<option id="play_once" type="bool" default="false" />

View File

@ -67,6 +67,7 @@
<check text="Zoom from center with scroll wheel" id="zoom_from_center_with_wheel" />
<check text="Zoom from center with keys" id="zoom_from_center_with_keys" />
<check text="Show scroll-bars in sprite editor" id="show_scrollbars" tooltip="Show scroll-bars in all sprite editors." />
<check text="Auto-scroll on editor edges" id="auto_scroll" />
<hbox>
<label text="Right-click:" />
<combobox id="right_click_behavior" expansive="true" />

View File

@ -159,6 +159,9 @@ public:
if (m_pref.editor.showScrollbars())
showScrollbars()->setSelected(true);
if (m_pref.editor.autoScroll())
autoScroll()->setSelected(true);
// Scope
gridScope()->addItem("New Documents");
if (context->activeDocument()) {
@ -277,6 +280,7 @@ public:
m_pref.editor.zoomFromCenterWithWheel(zoomFromCenterWithWheel()->isSelected());
m_pref.editor.zoomFromCenterWithKeys(zoomFromCenterWithKeys()->isSelected());
m_pref.editor.showScrollbars(showScrollbars()->isSelected());
m_pref.editor.autoScroll(autoScroll()->isSelected());
m_pref.editor.zoomWithWheel(wheelZoom()->isSelected());
#if __APPLE__
m_pref.editor.zoomWithSlide(slideZoom()->isSelected());

View File

@ -942,11 +942,14 @@ void Editor::flashCurrentLayer()
gfx::Point Editor::autoScroll(MouseMessage* msg, AutoScroll dir)
{
// // Hide the brush preview
// HideBrushPreview hide(editor->brushPreview());
gfx::Point mousePos = msg->position();
if (!Preferences::instance().editor.autoScroll())
return mousePos;
// Hide the brush preview
//HideBrushPreview hide(editor->brushPreview());
View* view = View::getView(this);
gfx::Rect vp = view->viewportBounds();
gfx::Point mousePos = msg->position();
if (!vp.contains(mousePos)) {
gfx::Point delta = (mousePos - m_oldPos);