Fix panning canvas out of view clips in Auto Guides (fix #2994)

This commit is contained in:
Joshua Ogunyinka 2021-11-26 15:38:29 +04:00 committed by David Capello
parent 04fa9a47ab
commit 31bf651d8b
4 changed files with 11 additions and 5 deletions

View File

@ -961,10 +961,9 @@ void Editor::drawSpriteUnclippedRect(ui::Graphics* g, const gfx::Rect& _rc)
// Draw active layer/cel edges
if ((m_docPref.show.layerEdges() || m_showAutoCelGuides) &&
// Show layer edges only on "standby" like states where brush
// preview is shown (e.g. with this we avoid to showing the
// edges in states like DrawingState, etc.).
m_state->requireBrushPreview()) {
// Show layer edges and possibly cel guides only on states that
// allows it (e.g scrolling state)
m_state->allowLayerEdges()) {
Cel* cel = (m_layer ? m_layer->cel(m_frame): nullptr);
if (cel) {
gfx::Color color = color_utils::color_for_ui(Preferences::instance().guides.layerEdgesColor());
@ -2952,7 +2951,7 @@ void Editor::updateAutoCelGuides(ui::Message* msg)
// Check if the user is pressing the Ctrl or Cmd key on move
// tool to show automatic guides.
if (m_showAutoCelGuides &&
m_state->requireBrushPreview()) {
m_state->allowLayerEdges()) {
auto mouseMsg = dynamic_cast<ui::MouseMessage*>(msg);
ColorPicker picker;

View File

@ -124,6 +124,9 @@ namespace app {
// drawing cursor.
virtual bool requireBrushPreview() { return false; }
// Returns true if this state allow layer edges and cel guides
virtual bool allowLayerEdges() { return false; }
// Returns true if this state accept the given quicktool.
virtual bool acceptQuickTool(tools::Tool* tool) { return true; }

View File

@ -24,6 +24,7 @@ namespace app {
virtual bool onKeyDown(Editor* editor, ui::KeyMessage* msg) override;
virtual bool onKeyUp(Editor* editor, ui::KeyMessage* msg) override;
virtual bool onUpdateStatusBar(Editor* editor) override;
virtual bool allowLayerEdges() override { return true; }
virtual LeaveAction onLeaveState(Editor* editor, EditorState* newState) override {
// Just discard this state if we want to enter to another state

View File

@ -46,6 +46,9 @@ namespace app {
// the brush-preview.
virtual bool requireBrushPreview() override { return true; }
// Layer edges and cel guides are allowed to be drawn.
virtual bool allowLayerEdges() override { return true; }
virtual Transformation getTransformation(Editor* editor);
void startSelectionTransformation(Editor* editor, const gfx::Point& move, double angle);