Fix regression: 'Simple Crosshair' mouse cursor dissapears when we switch to Eraser tool

Regression introduced in: ef4f691459d13b45459c56383ab3673ca6fbec0a
This commit is contained in:
David Capello 2021-04-16 12:09:49 -03:00
parent 4fe8c93c5c
commit ca41785f18
4 changed files with 18 additions and 7 deletions

View File

@ -469,7 +469,11 @@ void BrushPreview::createNativeCursor()
if (cursorBounds.isEmpty()) {
ASSERT(!m_cursor);
m_editor->manager()->getDisplay()->setNativeMouseCursor(os::NativeCursor::kNoCursor);
if (!(m_type & NATIVE_CROSSHAIR)) {
// TODO should we use ui::set_mouse_cursor()?
ui::set_mouse_cursor_reset_info();
m_editor->manager()->getDisplay()->setNativeMouseCursor(os::NativeCursor::kNoCursor);
}
return;
}
@ -508,6 +512,10 @@ void BrushPreview::forEachLittleCrossPixel(
}
if (m_cursor) {
ASSERT(m_cursor);
// TODO should we use ui::set_mouse_cursor()?
ui::set_mouse_cursor_reset_info();
m_editor->manager()->getDisplay()->setNativeMouseCursor(
m_cursor, m_cursorCenter,
m_editor->manager()->getDisplay()->scale());

View File

@ -2680,10 +2680,6 @@ void Editor::showMouseCursor(CursorType cursorType,
void Editor::showBrushPreview(const gfx::Point& screenPos)
{
if (Preferences::instance().cursor.paintingCursorType() !=
app::gen::PaintingCursorType::SIMPLE_CROSSHAIR)
ui::set_mouse_cursor(kNoCursor);
m_brushPreview.show(screenPos);
}

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2018-2020 Igara Studio S.A.
// Copyright (C) 2018-2021 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This file is released under the terms of the MIT license.
@ -299,6 +299,12 @@ void set_mouse_cursor_scale(const int newScale)
update_mouse_cursor();
}
void set_mouse_cursor_reset_info()
{
mouse_cursor_type = kCustomCursor;
mouse_cursor_custom = nullptr;
}
void hide_mouse_cursor()
{
ASSERT(mouse_scares >= 0);

View File

@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2019-2020 Igara Studio S.A.
// Copyright (C) 2019-2021 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This file is released under the terms of the MIT license.
@ -57,6 +57,7 @@ namespace ui {
CursorType get_mouse_cursor();
void set_mouse_cursor(CursorType type, const Cursor* cursor = nullptr);
void set_mouse_cursor_scale(const int newScale);
void set_mouse_cursor_reset_info();
void hide_mouse_cursor();
void show_mouse_cursor();