mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-24 12:47:12 +01:00
Don't update the preview when the mouse is not over a PaintCanvas.
This commit is contained in:
parent
dc4ded8bd8
commit
af1018bae6
@ -774,8 +774,10 @@ bool PaintCanvas::_forward_canvas_gui_input(const Ref<InputEvent> &event) {
|
||||
_mouse_position = get_global_mouse_position();
|
||||
_cell_mouse_position = local_position;
|
||||
|
||||
if (_mouse_down) {
|
||||
if (has_point(local_position)) {
|
||||
_was_mouse_outside = false;
|
||||
|
||||
if (_mouse_down) {
|
||||
//handle_draw(local_position, event)
|
||||
_cell_mouse_position = local_position;
|
||||
|
||||
@ -787,10 +789,15 @@ bool PaintCanvas::_forward_canvas_gui_input(const Ref<InputEvent> &event) {
|
||||
_last_cell_mouse_position = local_position;
|
||||
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
draw_brush_preview();
|
||||
}
|
||||
} else {
|
||||
if (!_was_mouse_outside) {
|
||||
clear_preview();
|
||||
_was_mouse_outside = true;
|
||||
}
|
||||
}
|
||||
|
||||
_last_mouse_position = _mouse_position;
|
||||
_last_cell_mouse_position = local_position;
|
||||
@ -844,6 +851,7 @@ PaintCanvas::PaintCanvas() {
|
||||
_brush_size = 1;
|
||||
_current_tool = 0;
|
||||
_previous_tool = 0;
|
||||
_was_mouse_outside = true;
|
||||
|
||||
_image.instance();
|
||||
_preview_image.instance();
|
||||
|
@ -146,6 +146,8 @@ protected:
|
||||
Vector2 _last_mouse_position;
|
||||
Vector2 _last_canvas_mouse_position;
|
||||
Vector2 _last_cell_mouse_position;
|
||||
|
||||
bool _was_mouse_outside;
|
||||
};
|
||||
|
||||
VARIANT_ENUM_CAST(PaintCanvas::Tools);
|
||||
|
Loading…
Reference in New Issue
Block a user