mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
We can scroll with space bar (quick tool shortcut) in MovingPixelState now.
This commit is contained in:
parent
8f66325395
commit
037070730e
@ -35,7 +35,6 @@
|
||||
#include "widgets/editor/editor.h"
|
||||
#include "widgets/editor/editor_customization_delegate.h"
|
||||
#include "widgets/editor/pixels_movement.h"
|
||||
#include "widgets/editor/scrolling_state.h"
|
||||
#include "widgets/editor/standby_state.h"
|
||||
#include "widgets/editor/transform_handles.h"
|
||||
#include "widgets/statebar.h"
|
||||
@ -127,11 +126,8 @@ bool MovingPixelsState::onMouseDown(Editor* editor, Message* msg)
|
||||
Document* document = editor->getDocument();
|
||||
|
||||
// Start scroll loop
|
||||
if (msg->mouse.middle) { // TODO raw msg->mouse.middle here, this should be customizable
|
||||
editor->setState(EditorStatePtr(new ScrollingState()));
|
||||
editor->captureMouse();
|
||||
if (checkForScroll(editor, msg))
|
||||
return true;
|
||||
}
|
||||
|
||||
// Transform selected pixels
|
||||
if (document->isMaskVisible() &&
|
||||
|
@ -115,6 +115,22 @@ void StandbyState::onCurrentToolChange(Editor* editor)
|
||||
editor->invalidate();
|
||||
}
|
||||
|
||||
bool StandbyState::checkForScroll(Editor* editor, Message* msg)
|
||||
{
|
||||
UIContext* context = UIContext::instance();
|
||||
tools::Tool* currentTool = editor->getCurrentEditorTool();
|
||||
tools::Ink* clickedInk = currentTool->getInk(msg->mouse.right ? 1: 0);
|
||||
|
||||
// Start scroll loop
|
||||
if (msg->mouse.middle || clickedInk->isScrollMovement()) { // TODO raw msg->mouse.middle here, this should be customizable
|
||||
editor->setState(EditorStatePtr(new ScrollingState()));
|
||||
editor->captureMouse();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool StandbyState::onMouseDown(Editor* editor, Message* msg)
|
||||
{
|
||||
if (editor->hasCapture())
|
||||
@ -122,7 +138,7 @@ bool StandbyState::onMouseDown(Editor* editor, Message* msg)
|
||||
|
||||
UIContext* context = UIContext::instance();
|
||||
tools::Tool* current_tool = editor->getCurrentEditorTool();
|
||||
tools::Ink* clicked_ink = current_tool->getInk(msg->mouse.right ? 1: 0);
|
||||
tools::Ink* clickedInk = current_tool->getInk(msg->mouse.right ? 1: 0);
|
||||
Sprite* sprite = editor->getSprite();
|
||||
|
||||
// Each time an editor is clicked the current editor and the active
|
||||
@ -133,14 +149,11 @@ bool StandbyState::onMouseDown(Editor* editor, Message* msg)
|
||||
context->setActiveDocument(document);
|
||||
|
||||
// Start scroll loop
|
||||
if (msg->mouse.middle || clicked_ink->isScrollMovement()) { // TODO raw msg->mouse.middle here, this should be customizable
|
||||
editor->setState(EditorStatePtr(new ScrollingState()));
|
||||
editor->captureMouse();
|
||||
if (checkForScroll(editor, msg))
|
||||
return true;
|
||||
}
|
||||
|
||||
// Move cel X,Y coordinates
|
||||
if (clicked_ink->isCelMovement()) {
|
||||
if (clickedInk->isCelMovement()) {
|
||||
if ((sprite->getCurrentLayer()) &&
|
||||
(sprite->getCurrentLayer()->getType() == GFXOBJ_LAYER_IMAGE)) {
|
||||
// TODO you can move the `Background' with tiled mode
|
||||
@ -205,7 +218,7 @@ bool StandbyState::onMouseDown(Editor* editor, Message* msg)
|
||||
}
|
||||
|
||||
// Call the eyedropper command
|
||||
if (clicked_ink->isEyedropper()) {
|
||||
if (clickedInk->isEyedropper()) {
|
||||
Command* eyedropper_cmd =
|
||||
CommandsModule::instance()->getCommandByName(CommandId::Eyedropper);
|
||||
|
||||
|
@ -50,6 +50,10 @@ public:
|
||||
virtual gfx::Transformation getTransformation(Editor* editor);
|
||||
|
||||
protected:
|
||||
// Returns true and changes to ScrollingState when "msg" says "the
|
||||
// user wants to scroll".
|
||||
bool checkForScroll(Editor* editor, Message* msg);
|
||||
|
||||
class Decorator : public EditorDecorator
|
||||
{
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user