From 3db7c40a46703b4410fc63db73fd9d9c4eec7fef Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 20 Jun 2022 22:21:52 +0200 Subject: [PATCH] Fixed the up and down arrows of the paint layers. --- modules/paint/paint_layer_button.cpp | 5 ++++- modules/paint/paint_window.cpp | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/paint/paint_layer_button.cpp b/modules/paint/paint_layer_button.cpp index 7d7ecb272..430a0d4a8 100644 --- a/modules/paint/paint_layer_button.cpp +++ b/modules/paint/paint_layer_button.cpp @@ -25,8 +25,8 @@ SOFTWARE. #include "paint_layer_button.h" #include "core/image.h" -#include "scene/resources/texture.h" #include "scene/resources/style_box.h" +#include "scene/resources/texture.h" #include "scene/gui/box_container.h" #include "scene/gui/button.h" @@ -87,6 +87,7 @@ PaintLayerButton::PaintLayerButton() { layer_button->set_text_align(Button::ALIGN_RIGHT); layer_button->set_h_size_flags(SIZE_EXPAND_FILL); layer_button->set_v_size_flags(SIZE_EXPAND_FILL); + style_box.instance(); style_box->set("bg_color", Color(0.25, 0.25, 0.25)); layer_button->set("custom_styles/hover", style_box); @@ -139,6 +140,7 @@ PaintLayerButton::PaintLayerButton() { up_button->set_v_size_flags(SIZE_EXPAND_FILL); up_button->set_normal_texture(make_icon(arrow_up_png)); up_button->set_pressed_texture(make_icon(minidotta_png)); + up_button->set_custom_minimum_size(Vector2(15, 15)); right_main_container->add_child(up_button); down_button = memnew(TextureButton); @@ -148,6 +150,7 @@ PaintLayerButton::PaintLayerButton() { down_button->set_v_size_flags(SIZE_EXPAND_FILL); down_button->set_normal_texture(make_icon(arrow_down_png)); down_button->set_pressed_texture(make_icon(minidotta_png)); + down_button->set_custom_minimum_size(Vector2(15, 15)); right_main_container->add_child(down_button); } diff --git a/modules/paint/paint_window.cpp b/modules/paint/paint_window.cpp index 67228e3f5..d269e2a9a 100644 --- a/modules/paint/paint_window.cpp +++ b/modules/paint/paint_window.cpp @@ -1508,4 +1508,6 @@ void PaintWindow::_bind_methods() { ClassDB::bind_method(D_METHOD("lock_layer"), &PaintWindow::lock_layer); ClassDB::bind_method(D_METHOD("toggle_layer_visibility"), &PaintWindow::toggle_layer_visibility); ClassDB::bind_method(D_METHOD("select_layer", "name"), &PaintWindow::select_layer); + ClassDB::bind_method(D_METHOD("move_up", "n"), &PaintWindow::move_up); + ClassDB::bind_method(D_METHOD("move_down", "n"), &PaintWindow::move_down); }