mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-24 04:46:48 +01:00
Now ColorSelectorButton can work both in toggle mode, and in normal mode.
This commit is contained in:
parent
e53868f60f
commit
4b3c8aed30
@ -1246,8 +1246,7 @@ void ColorSelectorButton::_update_picker() {
|
||||
picker->connect("color_changed", this, "_color_changed");
|
||||
popup->connect("modal_closed", this, "_modal_closed");
|
||||
popup->connect("about_to_show", this, "_about_to_show");
|
||||
popup->connect("popup_hide", this, "set_pressed", varray(false));
|
||||
popup->connect("popup_hide", this, "set_toggle_mode", varray(false));
|
||||
//popup->connect("popup_hide", this, "set_pressed", varray(false));
|
||||
picker->set_pick_color(color);
|
||||
picker->set_edit_alpha(edit_alpha);
|
||||
picker->set_display_old_color(true);
|
||||
@ -1259,10 +1258,18 @@ void ColorSelectorButton::pressed() {
|
||||
if (_button == BUTTON_LEFT) {
|
||||
Button::pressed();
|
||||
} else if (_button == BUTTON_RIGHT) {
|
||||
set_toggle_mode(true);
|
||||
popup_open_request();
|
||||
}
|
||||
}
|
||||
void ColorSelectorButton::toggled(bool p_pressed) {
|
||||
if (_button == BUTTON_LEFT) {
|
||||
Button::toggled(p_pressed);
|
||||
} else if (_button == BUTTON_RIGHT) {
|
||||
if (p_pressed) {
|
||||
popup_open_request();
|
||||
}
|
||||
}
|
||||
}
|
||||
void ColorSelectorButton::_gui_input(Ref<InputEvent> p_event) {
|
||||
Ref<InputEventMouseButton> mouse_button = p_event;
|
||||
|
||||
@ -1302,4 +1309,5 @@ ColorSelectorButton::ColorSelectorButton() {
|
||||
edit_alpha = true;
|
||||
|
||||
set_button_mask(BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT);
|
||||
//set_toggle_mode(true);
|
||||
}
|
||||
|
@ -219,6 +219,7 @@ class ColorSelectorButton : public Button {
|
||||
|
||||
protected:
|
||||
void pressed();
|
||||
void toggled(bool p_pressed);
|
||||
void _gui_input(Ref<InputEvent> p_event);
|
||||
|
||||
void _notification(int);
|
||||
|
Loading…
Reference in New Issue
Block a user