Skip to content

Commit

Permalink
Merge pull request #80544 from MewPurPur/buff-editorspinslider-2
Browse files Browse the repository at this point in the history
Fix read-only EditorSpinSlider display
  • Loading branch information
akien-mga committed Feb 9, 2024
2 parents 94dbf69 + fac939b commit d584ce0
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions editor/gui/editor_spin_slider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "editor/themes/editor_scale.h"

String EditorSpinSlider::get_tooltip(const Point2 &p_pos) const {
if (grabber->is_visible()) {
if (!read_only && grabber->is_visible()) {
Key key = (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) ? Key::META : Key::CTRL;
return TS->format_number(rtos(get_value())) + "\n\n" + vformat(TTR("Hold %s to round to integers.\nHold Shift for more precise changes."), find_keycode_name(key));
}
Expand Down Expand Up @@ -390,13 +390,9 @@ void EditorSpinSlider::_draw_spin_slider() {

grabbing_spinner_mouse_pos = get_global_position() + grabber_rect.get_center();

bool display_grabber = (grabbing_grabber || mouse_over_spin || mouse_over_grabber) && !grabbing_spinner && !(value_input_popup && value_input_popup->is_visible());
bool display_grabber = !read_only && (grabbing_grabber || mouse_over_spin || mouse_over_grabber) && !grabbing_spinner && !(value_input_popup && value_input_popup->is_visible());
if (grabber->is_visible() != display_grabber) {
if (display_grabber) {
grabber->show();
} else {
grabber->hide();
}
grabber->set_visible(display_grabber);
}

if (display_grabber) {
Expand Down

0 comments on commit d584ce0

Please sign in to comment.