Hand tool now really scrolls.

This commit is contained in:
David Capello 2010-03-27 19:15:00 -03:00
parent 9331e3e5d2
commit b9d0e846b2
3 changed files with 15 additions and 1 deletions

View File

@ -109,13 +109,18 @@ class ScrollInk : public ToolInk
{
public:
bool isScrollMovement() const { return true; }
void prepareInk(IToolLoop* loop)
{
// Do nothing
}
void inkHline(int x1, int y, int x2, IToolLoop* loop)
{
// Do nothing
}
};

View File

@ -81,6 +81,9 @@ public:
// Returns true if this ink picks colors from the image
virtual bool isEyedropper() const { return false; }
// Returns true if this ink moves the scroll only
virtual bool isScrollMovement() const { return false; }
// It is called when the tool-loop start (generally when the user
// presses a mouse button over a sprite editor)
virtual void prepareInk(IToolLoop* loop) { }

View File

@ -865,7 +865,8 @@ bool Editor::msg_proc(JMessage msg)
context->set_current_sprite(m_sprite);
/* move the scroll */
if (msg->mouse.middle || m_space_pressed) {
if (msg->mouse.middle || m_space_pressed ||
current_tool->getInk(msg->mouse.right ? 1: 0)->isScrollMovement()) {
m_state = EDITOR_STATE_MOVING_SCROLL;
editor_setcursor(msg->mouse.x, msg->mouse.y);
@ -1336,6 +1337,11 @@ void Editor::editor_setcursor(int x, int y)
jmouse_set_cursor(JI_CURSOR_EYEDROPPER);
return;
}
else if (current_tool->getInk(0)->isScrollMovement()) {
hide_drawing_cursor();
jmouse_set_cursor(JI_CURSOR_SCROLL);
return;
}
}
if (m_insideSelection)