mirror of https://github.com/godotengine/godot
Rename ButtonList enum and members to MouseButton
This commit is contained in:
parent
70eff30c5f
commit
10d7fccb54
|
|
@ -106,7 +106,7 @@ static Vector<_CoreConstant> _global_constants;
|
||||||
|
|
||||||
VARIANT_ENUM_CAST(KeyList);
|
VARIANT_ENUM_CAST(KeyList);
|
||||||
VARIANT_ENUM_CAST(KeyModifierMask);
|
VARIANT_ENUM_CAST(KeyModifierMask);
|
||||||
VARIANT_ENUM_CAST(ButtonList);
|
VARIANT_ENUM_CAST(MouseButton);
|
||||||
VARIANT_ENUM_CAST(JoyButtonList);
|
VARIANT_ENUM_CAST(JoyButtonList);
|
||||||
VARIANT_ENUM_CAST(JoyAxisList);
|
VARIANT_ENUM_CAST(JoyAxisList);
|
||||||
VARIANT_ENUM_CAST(MidiMessageList);
|
VARIANT_ENUM_CAST(MidiMessageList);
|
||||||
|
|
@ -397,20 +397,20 @@ void register_global_constants() {
|
||||||
BIND_CORE_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH);
|
BIND_CORE_ENUM_CONSTANT(KEY_MASK_GROUP_SWITCH);
|
||||||
|
|
||||||
// mouse
|
// mouse
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_LEFT);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_LEFT);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_RIGHT);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_RIGHT);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_MIDDLE);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MIDDLE);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_XBUTTON1);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_XBUTTON1);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_XBUTTON2);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_XBUTTON2);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_UP);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_UP);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_DOWN);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_DOWN);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_LEFT);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_LEFT);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_WHEEL_RIGHT);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_WHEEL_RIGHT);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_LEFT);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_LEFT);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_RIGHT);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_RIGHT);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_MIDDLE);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_MIDDLE);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON1);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_XBUTTON1);
|
||||||
BIND_CORE_ENUM_CONSTANT(BUTTON_MASK_XBUTTON2);
|
BIND_CORE_ENUM_CONSTANT(MOUSE_BUTTON_MASK_XBUTTON2);
|
||||||
|
|
||||||
// Joypad buttons
|
// Joypad buttons
|
||||||
BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_INVALID);
|
BIND_CORE_ENUM_CONSTANT(JOY_BUTTON_INVALID);
|
||||||
|
|
|
||||||
|
|
@ -560,11 +560,11 @@ void Input::_parse_input_event_impl(const Ref<InputEvent> &p_event, bool p_is_em
|
||||||
button_event->set_position(st->get_position());
|
button_event->set_position(st->get_position());
|
||||||
button_event->set_global_position(st->get_position());
|
button_event->set_global_position(st->get_position());
|
||||||
button_event->set_pressed(st->is_pressed());
|
button_event->set_pressed(st->is_pressed());
|
||||||
button_event->set_button_index(BUTTON_LEFT);
|
button_event->set_button_index(MOUSE_BUTTON_LEFT);
|
||||||
if (st->is_pressed()) {
|
if (st->is_pressed()) {
|
||||||
button_event->set_button_mask(mouse_button_mask | (1 << (BUTTON_LEFT - 1)));
|
button_event->set_button_mask(mouse_button_mask | (1 << (MOUSE_BUTTON_LEFT - 1)));
|
||||||
} else {
|
} else {
|
||||||
button_event->set_button_mask(mouse_button_mask & ~(1 << (BUTTON_LEFT - 1)));
|
button_event->set_button_mask(mouse_button_mask & ~(1 << (MOUSE_BUTTON_LEFT - 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
_parse_input_event_impl(button_event, true);
|
_parse_input_event_impl(button_event, true);
|
||||||
|
|
@ -792,8 +792,8 @@ void Input::ensure_touch_mouse_raised() {
|
||||||
button_event->set_position(mouse_pos);
|
button_event->set_position(mouse_pos);
|
||||||
button_event->set_global_position(mouse_pos);
|
button_event->set_global_position(mouse_pos);
|
||||||
button_event->set_pressed(false);
|
button_event->set_pressed(false);
|
||||||
button_event->set_button_index(BUTTON_LEFT);
|
button_event->set_button_index(MOUSE_BUTTON_LEFT);
|
||||||
button_event->set_button_mask(mouse_button_mask & ~(1 << (BUTTON_LEFT - 1)));
|
button_event->set_button_mask(mouse_button_mask & ~(1 << (MOUSE_BUTTON_LEFT - 1)));
|
||||||
|
|
||||||
_parse_input_event_impl(button_event, true);
|
_parse_input_event_impl(button_event, true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -619,15 +619,15 @@ String InputEventMouseButton::as_text() const {
|
||||||
// Button
|
// Button
|
||||||
int idx = get_button_index();
|
int idx = get_button_index();
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
case BUTTON_LEFT:
|
case MOUSE_BUTTON_LEFT:
|
||||||
case BUTTON_RIGHT:
|
case MOUSE_BUTTON_RIGHT:
|
||||||
case BUTTON_MIDDLE:
|
case MOUSE_BUTTON_MIDDLE:
|
||||||
case BUTTON_WHEEL_UP:
|
case MOUSE_BUTTON_WHEEL_UP:
|
||||||
case BUTTON_WHEEL_DOWN:
|
case MOUSE_BUTTON_WHEEL_DOWN:
|
||||||
case BUTTON_WHEEL_LEFT:
|
case MOUSE_BUTTON_WHEEL_LEFT:
|
||||||
case BUTTON_WHEEL_RIGHT:
|
case MOUSE_BUTTON_WHEEL_RIGHT:
|
||||||
case BUTTON_XBUTTON1:
|
case MOUSE_BUTTON_XBUTTON1:
|
||||||
case BUTTON_XBUTTON2:
|
case MOUSE_BUTTON_XBUTTON2:
|
||||||
full_string += RTR(_mouse_button_descriptions[idx - 1]); // button index starts from 1, array index starts from 0, so subtract 1
|
full_string += RTR(_mouse_button_descriptions[idx - 1]); // button index starts from 1, array index starts from 0, so subtract 1
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -651,15 +651,15 @@ String InputEventMouseButton::to_string() {
|
||||||
String button_string = itos(idx);
|
String button_string = itos(idx);
|
||||||
|
|
||||||
switch (idx) {
|
switch (idx) {
|
||||||
case BUTTON_LEFT:
|
case MOUSE_BUTTON_LEFT:
|
||||||
case BUTTON_RIGHT:
|
case MOUSE_BUTTON_RIGHT:
|
||||||
case BUTTON_MIDDLE:
|
case MOUSE_BUTTON_MIDDLE:
|
||||||
case BUTTON_WHEEL_UP:
|
case MOUSE_BUTTON_WHEEL_UP:
|
||||||
case BUTTON_WHEEL_DOWN:
|
case MOUSE_BUTTON_WHEEL_DOWN:
|
||||||
case BUTTON_WHEEL_LEFT:
|
case MOUSE_BUTTON_WHEEL_LEFT:
|
||||||
case BUTTON_WHEEL_RIGHT:
|
case MOUSE_BUTTON_WHEEL_RIGHT:
|
||||||
case BUTTON_XBUTTON1:
|
case MOUSE_BUTTON_XBUTTON1:
|
||||||
case BUTTON_XBUTTON2:
|
case MOUSE_BUTTON_XBUTTON2:
|
||||||
button_string += " (" + RTR(_mouse_button_descriptions[idx - 1]) + ")"; // button index starts from 1, array index starts from 0, so subtract 1
|
button_string += " (" + RTR(_mouse_button_descriptions[idx - 1]) + ")"; // button index starts from 1, array index starts from 0, so subtract 1
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -761,20 +761,20 @@ String InputEventMouseMotion::to_string() {
|
||||||
int button_mask = get_button_mask();
|
int button_mask = get_button_mask();
|
||||||
String button_mask_string = itos(button_mask);
|
String button_mask_string = itos(button_mask);
|
||||||
switch (get_button_mask()) {
|
switch (get_button_mask()) {
|
||||||
case BUTTON_MASK_LEFT:
|
case MOUSE_BUTTON_MASK_LEFT:
|
||||||
button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_LEFT - 1]) + ")";
|
button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_LEFT - 1]) + ")";
|
||||||
break;
|
break;
|
||||||
case BUTTON_MASK_MIDDLE:
|
case MOUSE_BUTTON_MASK_MIDDLE:
|
||||||
button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_MIDDLE - 1]) + ")";
|
button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_MIDDLE - 1]) + ")";
|
||||||
break;
|
break;
|
||||||
case BUTTON_MASK_RIGHT:
|
case MOUSE_BUTTON_MASK_RIGHT:
|
||||||
button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_RIGHT - 1]) + ")";
|
button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_RIGHT - 1]) + ")";
|
||||||
break;
|
break;
|
||||||
case BUTTON_MASK_XBUTTON1:
|
case MOUSE_BUTTON_MASK_XBUTTON1:
|
||||||
button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_XBUTTON1 - 1]) + ")";
|
button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_XBUTTON1 - 1]) + ")";
|
||||||
break;
|
break;
|
||||||
case BUTTON_MASK_XBUTTON2:
|
case MOUSE_BUTTON_MASK_XBUTTON2:
|
||||||
button_mask_string += " (" + RTR(_mouse_button_descriptions[BUTTON_XBUTTON2 - 1]) + ")";
|
button_mask_string += " (" + RTR(_mouse_button_descriptions[MOUSE_BUTTON_XBUTTON2 - 1]) + ")";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -42,21 +42,21 @@
|
||||||
* The events are pretty obvious.
|
* The events are pretty obvious.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum ButtonList {
|
enum MouseButton {
|
||||||
BUTTON_LEFT = 1,
|
MOUSE_BUTTON_LEFT = 1,
|
||||||
BUTTON_RIGHT = 2,
|
MOUSE_BUTTON_RIGHT = 2,
|
||||||
BUTTON_MIDDLE = 3,
|
MOUSE_BUTTON_MIDDLE = 3,
|
||||||
BUTTON_WHEEL_UP = 4,
|
MOUSE_BUTTON_WHEEL_UP = 4,
|
||||||
BUTTON_WHEEL_DOWN = 5,
|
MOUSE_BUTTON_WHEEL_DOWN = 5,
|
||||||
BUTTON_WHEEL_LEFT = 6,
|
MOUSE_BUTTON_WHEEL_LEFT = 6,
|
||||||
BUTTON_WHEEL_RIGHT = 7,
|
MOUSE_BUTTON_WHEEL_RIGHT = 7,
|
||||||
BUTTON_XBUTTON1 = 8,
|
MOUSE_BUTTON_XBUTTON1 = 8,
|
||||||
BUTTON_XBUTTON2 = 9,
|
MOUSE_BUTTON_XBUTTON2 = 9,
|
||||||
BUTTON_MASK_LEFT = (1 << (BUTTON_LEFT - 1)),
|
MOUSE_BUTTON_MASK_LEFT = (1 << (MOUSE_BUTTON_LEFT - 1)),
|
||||||
BUTTON_MASK_RIGHT = (1 << (BUTTON_RIGHT - 1)),
|
MOUSE_BUTTON_MASK_RIGHT = (1 << (MOUSE_BUTTON_RIGHT - 1)),
|
||||||
BUTTON_MASK_MIDDLE = (1 << (BUTTON_MIDDLE - 1)),
|
MOUSE_BUTTON_MASK_MIDDLE = (1 << (MOUSE_BUTTON_MIDDLE - 1)),
|
||||||
BUTTON_MASK_XBUTTON1 = (1 << (BUTTON_XBUTTON1 - 1)),
|
MOUSE_BUTTON_MASK_XBUTTON1 = (1 << (MOUSE_BUTTON_XBUTTON1 - 1)),
|
||||||
BUTTON_MASK_XBUTTON2 = (1 << (BUTTON_XBUTTON2 - 1))
|
MOUSE_BUTTON_MASK_XBUTTON2 = (1 << (MOUSE_BUTTON_XBUTTON2 - 1))
|
||||||
};
|
};
|
||||||
|
|
||||||
enum JoyButtonList {
|
enum JoyButtonList {
|
||||||
|
|
|
||||||
|
|
@ -2061,46 +2061,46 @@
|
||||||
<constant name="KEY_MASK_GROUP_SWITCH" value="1073741824" enum="KeyModifierMask">
|
<constant name="KEY_MASK_GROUP_SWITCH" value="1073741824" enum="KeyModifierMask">
|
||||||
Group Switch key mask.
|
Group Switch key mask.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_LEFT" value="1" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_LEFT" value="1" enum="ButtonList">
|
||||||
Left mouse button.
|
Left mouse button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_RIGHT" value="2" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_RIGHT" value="2" enum="ButtonList">
|
||||||
Right mouse button.
|
Right mouse button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_MIDDLE" value="3" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_MIDDLE" value="3" enum="ButtonList">
|
||||||
Middle mouse button.
|
Middle mouse button.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_XBUTTON1" value="8" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_XBUTTON1" value="8" enum="ButtonList">
|
||||||
Extra mouse button 1 (only present on some mice).
|
Extra mouse button 1 (only present on some mice).
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_XBUTTON2" value="9" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_XBUTTON2" value="9" enum="ButtonList">
|
||||||
Extra mouse button 2 (only present on some mice).
|
Extra mouse button 2 (only present on some mice).
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_WHEEL_UP" value="4" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_WHEEL_UP" value="4" enum="ButtonList">
|
||||||
Mouse wheel up.
|
Mouse wheel up.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_WHEEL_DOWN" value="5" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_WHEEL_DOWN" value="5" enum="ButtonList">
|
||||||
Mouse wheel down.
|
Mouse wheel down.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_WHEEL_LEFT" value="6" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_WHEEL_LEFT" value="6" enum="ButtonList">
|
||||||
Mouse wheel left button (only present on some mice).
|
Mouse wheel left button (only present on some mice).
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_WHEEL_RIGHT" value="7" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_WHEEL_RIGHT" value="7" enum="ButtonList">
|
||||||
Mouse wheel right button (only present on some mice).
|
Mouse wheel right button (only present on some mice).
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_MASK_LEFT" value="1" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_MASK_LEFT" value="1" enum="ButtonList">
|
||||||
Left mouse button mask.
|
Left mouse button mask.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_MASK_RIGHT" value="2" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_MASK_RIGHT" value="2" enum="ButtonList">
|
||||||
Right mouse button mask.
|
Right mouse button mask.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_MASK_MIDDLE" value="4" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_MASK_MIDDLE" value="4" enum="ButtonList">
|
||||||
Middle mouse button mask.
|
Middle mouse button mask.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_MASK_XBUTTON1" value="128" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_MASK_XBUTTON1" value="128" enum="ButtonList">
|
||||||
Extra mouse button 1 mask.
|
Extra mouse button 1 mask.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="BUTTON_MASK_XBUTTON2" value="256" enum="ButtonList">
|
<constant name="MOUSE_BUTTON_MASK_XBUTTON2" value="256" enum="ButtonList">
|
||||||
Extra mouse button 2 mask.
|
Extra mouse button 2 mask.
|
||||||
</constant>
|
</constant>
|
||||||
<constant name="JOY_BUTTON_INVALID" value="-1" enum="JoyButtonList">
|
<constant name="JOY_BUTTON_INVALID" value="-1" enum="JoyButtonList">
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
</member>
|
</member>
|
||||||
<member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask" default="1">
|
<member name="button_mask" type="int" setter="set_button_mask" getter="get_button_mask" default="1">
|
||||||
Binary mask to choose which mouse buttons this button will respond to.
|
Binary mask to choose which mouse buttons this button will respond to.
|
||||||
To allow both left-click and right-click, use [code]BUTTON_MASK_LEFT | BUTTON_MASK_RIGHT[/code].
|
To allow both left-click and right-click, use [code]MOUSE_BUTTON_MASK_LEFT | MOUSE_BUTTON_MASK_RIGHT[/code].
|
||||||
</member>
|
</member>
|
||||||
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled" default="false">
|
<member name="disabled" type="bool" setter="set_disabled" getter="is_disabled" default="false">
|
||||||
If [code]true[/code], the button is in disabled state and can't be clicked or toggled.
|
If [code]true[/code], the button is in disabled state and can't be clicked or toggled.
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
[gdscript]
|
[gdscript]
|
||||||
func _gui_input(event):
|
func _gui_input(event):
|
||||||
if event is InputEventMouseButton:
|
if event is InputEventMouseButton:
|
||||||
if event.button_index == BUTTON_LEFT and event.pressed:
|
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
|
||||||
print("I've been clicked D:")
|
print("I've been clicked D:")
|
||||||
[/gdscript]
|
[/gdscript]
|
||||||
[csharp]
|
[csharp]
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
[codeblocks]
|
[codeblocks]
|
||||||
[gdscript]
|
[gdscript]
|
||||||
func _input(event):
|
func _input(event):
|
||||||
if event is InputEventMouseButton and event.pressed and event.button_index == BUTTON_LEFT:
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||||
if get_rect().has_point(to_local(event.position)):
|
if get_rect().has_point(to_local(event.position)):
|
||||||
print("A click!")
|
print("A click!")
|
||||||
[/gdscript]
|
[/gdscript]
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ void InputEventConfigurationDialog::_update_input_list() {
|
||||||
mouse_root->set_collapsed(collapse);
|
mouse_root->set_collapsed(collapse);
|
||||||
mouse_root->set_meta("__type", INPUT_MOUSE_BUTTON);
|
mouse_root->set_meta("__type", INPUT_MOUSE_BUTTON);
|
||||||
|
|
||||||
int mouse_buttons[9] = { BUTTON_LEFT, BUTTON_RIGHT, BUTTON_MIDDLE, BUTTON_WHEEL_UP, BUTTON_WHEEL_DOWN, BUTTON_WHEEL_LEFT, BUTTON_WHEEL_RIGHT, BUTTON_XBUTTON1, BUTTON_XBUTTON2 };
|
MouseButton mouse_buttons[9] = { MOUSE_BUTTON_LEFT, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MIDDLE, MOUSE_BUTTON_WHEEL_UP, MOUSE_BUTTON_WHEEL_DOWN, MOUSE_BUTTON_WHEEL_LEFT, MOUSE_BUTTON_WHEEL_RIGHT, MOUSE_BUTTON_XBUTTON1, MOUSE_BUTTON_XBUTTON2 };
|
||||||
for (int i = 0; i < 9; i++) {
|
for (int i = 0; i < 9; i++) {
|
||||||
Ref<InputEventMouseButton> mb;
|
Ref<InputEventMouseButton> mb;
|
||||||
mb.instance();
|
mb.instance();
|
||||||
|
|
|
||||||
|
|
@ -615,7 +615,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
float v_zoom_orig = v_zoom;
|
float v_zoom_orig = v_zoom;
|
||||||
if (mb->get_command()) {
|
if (mb->get_command()) {
|
||||||
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
|
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
|
||||||
|
|
@ -628,7 +628,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
float v_zoom_orig = v_zoom;
|
float v_zoom_orig = v_zoom;
|
||||||
if (mb->get_command()) {
|
if (mb->get_command()) {
|
||||||
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
|
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
|
||||||
|
|
@ -641,7 +641,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_MIDDLE) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_MIDDLE) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
int x = mb->get_position().x - timeline->get_name_limit();
|
int x = mb->get_position().x - timeline->get_name_limit();
|
||||||
panning_timeline_from = x / timeline->get_zoom_scale();
|
panning_timeline_from = x / timeline->get_zoom_scale();
|
||||||
|
|
@ -652,7 +652,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
|
||||||
menu_insert_key = mb->get_position();
|
menu_insert_key = mb->get_position();
|
||||||
if (menu_insert_key.x >= timeline->get_name_limit() && menu_insert_key.x <= get_size().width - timeline->get_buttons_width()) {
|
if (menu_insert_key.x >= timeline->get_name_limit() && menu_insert_key.x <= get_size().width - timeline->get_buttons_width()) {
|
||||||
Vector2 popup_pos = get_global_transform().xform(mb->get_position());
|
Vector2 popup_pos = get_global_transform().xform(mb->get_position());
|
||||||
|
|
@ -672,7 +672,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (close_icon_rect.has_point(mb->get_position())) {
|
if (close_icon_rect.has_point(mb->get_position())) {
|
||||||
emit_signal("close_request");
|
emit_signal("close_request");
|
||||||
return;
|
return;
|
||||||
|
|
@ -789,7 +789,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box_selecting_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (box_selecting_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (box_selecting) {
|
if (box_selecting) {
|
||||||
//do actual select
|
//do actual select
|
||||||
if (!box_selecting_add) {
|
if (!box_selecting_add) {
|
||||||
|
|
@ -819,7 +819,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (moving_handle != 0 && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
undo_redo->create_action(TTR("Move Bezier Points"));
|
undo_redo->create_action(TTR("Move Bezier Points"));
|
||||||
undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, moving_handle_key, moving_handle_left);
|
undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_in_handle", track, moving_handle_key, moving_handle_left);
|
||||||
undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, moving_handle_key, moving_handle_right);
|
undo_redo->add_do_method(animation.ptr(), "bezier_track_set_key_out_handle", track, moving_handle_key, moving_handle_right);
|
||||||
|
|
@ -831,7 +831,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moving_selection_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (moving_selection_attempt && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (moving_selection) {
|
if (moving_selection) {
|
||||||
//combit it
|
//combit it
|
||||||
|
|
||||||
|
|
@ -927,7 +927,7 @@ void AnimationBezierTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_MIDDLE) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
|
||||||
v_scroll += mm->get_relative().y * v_zoom;
|
v_scroll += mm->get_relative().y * v_zoom;
|
||||||
if (v_scroll > 100000) {
|
if (v_scroll > 100000) {
|
||||||
v_scroll = 100000;
|
v_scroll = 100000;
|
||||||
|
|
|
||||||
|
|
@ -1643,24 +1643,24 @@ void AnimationTimelineEdit::_play_position_draw() {
|
||||||
void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && hsize_rect.has_point(mb->get_position())) {
|
||||||
dragging_hsize = true;
|
dragging_hsize = true;
|
||||||
dragging_hsize_from = mb->get_position().x;
|
dragging_hsize_from = mb->get_position().x;
|
||||||
dragging_hsize_at = name_limit;
|
dragging_hsize_at = name_limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && dragging_hsize) {
|
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && dragging_hsize) {
|
||||||
dragging_hsize = false;
|
dragging_hsize = false;
|
||||||
}
|
}
|
||||||
if (mb.is_valid() && mb->get_position().x > get_name_limit() && mb->get_position().x < (get_size().width - get_buttons_width())) {
|
if (mb.is_valid() && mb->get_position().x > get_name_limit() && mb->get_position().x < (get_size().width - get_buttons_width())) {
|
||||||
if (!panning_timeline && mb->get_button_index() == BUTTON_LEFT) {
|
if (!panning_timeline && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
int x = mb->get_position().x - get_name_limit();
|
int x = mb->get_position().x - get_name_limit();
|
||||||
|
|
||||||
float ofs = x / get_zoom_scale() + get_value();
|
float ofs = x / get_zoom_scale() + get_value();
|
||||||
emit_signal("timeline_changed", ofs, false);
|
emit_signal("timeline_changed", ofs, false);
|
||||||
dragging_timeline = true;
|
dragging_timeline = true;
|
||||||
}
|
}
|
||||||
if (!dragging_timeline && mb->get_button_index() == BUTTON_MIDDLE) {
|
if (!dragging_timeline && mb->get_button_index() == MOUSE_BUTTON_MIDDLE) {
|
||||||
int x = mb->get_position().x - get_name_limit();
|
int x = mb->get_position().x - get_name_limit();
|
||||||
panning_timeline_from = x / get_zoom_scale();
|
panning_timeline_from = x / get_zoom_scale();
|
||||||
panning_timeline = true;
|
panning_timeline = true;
|
||||||
|
|
@ -1668,11 +1668,11 @@ void AnimationTimelineEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dragging_timeline && mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
|
if (dragging_timeline && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
|
||||||
dragging_timeline = false;
|
dragging_timeline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panning_timeline && mb.is_valid() && mb->get_button_index() == BUTTON_MIDDLE && !mb->is_pressed()) {
|
if (panning_timeline && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_MIDDLE && !mb->is_pressed()) {
|
||||||
panning_timeline = false;
|
panning_timeline = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2540,7 +2540,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Point2 pos = mb->get_position();
|
Point2 pos = mb->get_position();
|
||||||
|
|
||||||
if (check_rect.has_point(pos)) {
|
if (check_rect.has_point(pos)) {
|
||||||
|
|
@ -2683,7 +2683,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
Point2 pos = mb->get_position();
|
Point2 pos = mb->get_position();
|
||||||
if (pos.x >= timeline->get_name_limit() && pos.x <= get_size().width - timeline->get_buttons_width()) {
|
if (pos.x >= timeline->get_name_limit() && pos.x <= get_size().width - timeline->get_buttons_width()) {
|
||||||
// Can do something with menu too! show insert key.
|
// Can do something with menu too! show insert key.
|
||||||
|
|
@ -2713,7 +2713,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && clicking_on_name) {
|
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && clicking_on_name) {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
path_popup = memnew(Popup);
|
path_popup = memnew(Popup);
|
||||||
path_popup->set_wrap_controls(true);
|
path_popup->set_wrap_controls(true);
|
||||||
|
|
@ -2735,7 +2735,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && moving_selection_attempt) {
|
if (mb.is_valid() && moving_selection_attempt) {
|
||||||
if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
moving_selection_attempt = false;
|
moving_selection_attempt = false;
|
||||||
if (moving_selection) {
|
if (moving_selection) {
|
||||||
emit_signal("move_selection_commit");
|
emit_signal("move_selection_commit");
|
||||||
|
|
@ -2746,7 +2746,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
select_single_attempt = -1;
|
select_single_attempt = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (moving_selection && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
if (moving_selection && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
moving_selection_attempt = false;
|
moving_selection_attempt = false;
|
||||||
moving_selection = false;
|
moving_selection = false;
|
||||||
emit_signal("move_selection_cancel");
|
emit_signal("move_selection_cancel");
|
||||||
|
|
@ -2754,7 +2754,7 @@ void AnimationTrackEdit::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT && moving_selection_attempt) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && moving_selection_attempt) {
|
||||||
if (!moving_selection) {
|
if (!moving_selection) {
|
||||||
moving_selection = true;
|
moving_selection = true;
|
||||||
emit_signal("move_selection_begin");
|
emit_signal("move_selection_begin");
|
||||||
|
|
@ -4955,17 +4955,17 @@ void AnimationTrackEditor::_box_selection_draw() {
|
||||||
void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
|
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() * 1.05);
|
||||||
scroll->accept_event();
|
scroll->accept_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_command() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
|
timeline->get_zoom()->set_value(timeline->get_zoom()->get_value() / 1.05);
|
||||||
scroll->accept_event();
|
scroll->accept_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
box_selecting = true;
|
box_selecting = true;
|
||||||
box_selecting_from = scroll->get_global_transform().xform(mb->get_position());
|
box_selecting_from = scroll->get_global_transform().xform(mb->get_position());
|
||||||
|
|
@ -4993,12 +4993,12 @@ void AnimationTrackEditor::_scroll_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
|
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_MIDDLE) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
|
||||||
timeline->set_value(timeline->get_value() - mm->get_relative().x / timeline->get_zoom_scale());
|
timeline->set_value(timeline->get_value() - mm->get_relative().x / timeline->get_zoom_scale());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mm.is_valid() && box_selecting) {
|
if (mm.is_valid() && box_selecting) {
|
||||||
if (!(mm->get_button_mask() & BUTTON_MASK_LEFT)) {
|
if (!(mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT)) {
|
||||||
//no longer
|
//no longer
|
||||||
box_selection->hide();
|
box_selection->hide();
|
||||||
box_selecting = false;
|
box_selecting = false;
|
||||||
|
|
|
||||||
|
|
@ -1076,7 +1076,7 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && get_default_cursor_shape() == CURSOR_HSIZE) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && get_default_cursor_shape() == CURSOR_HSIZE) {
|
||||||
len_resizing = true;
|
len_resizing = true;
|
||||||
len_resizing_start = mb->get_shift();
|
len_resizing_start = mb->get_shift();
|
||||||
len_resizing_from_px = mb->get_position().x;
|
len_resizing_from_px = mb->get_position().x;
|
||||||
|
|
@ -1086,7 +1086,7 @@ void AnimationTrackEditTypeAudio::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len_resizing && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (len_resizing && mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
float ofs_local = -len_resizing_rel / get_timeline()->get_zoom_scale();
|
float ofs_local = -len_resizing_rel / get_timeline()->get_zoom_scale();
|
||||||
if (len_resizing_start) {
|
if (len_resizing_start) {
|
||||||
float prev_ofs = get_animation()->audio_track_get_key_start_offset(get_track(), len_resizing_index);
|
float prev_ofs = get_animation()->audio_track_get_key_start_offset(get_track(), len_resizing_index);
|
||||||
|
|
|
||||||
|
|
@ -723,9 +723,9 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_pressed() && mb->get_command()) {
|
if (mb->is_pressed() && mb->get_command()) {
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_UP) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
_zoom_in();
|
_zoom_in();
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
_zoom_out();
|
_zoom_out();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1548,7 +1548,7 @@ void CodeTextEditor::validate_script() {
|
||||||
|
|
||||||
void CodeTextEditor::_warning_label_gui_input(const Ref<InputEvent> &p_event) {
|
void CodeTextEditor::_warning_label_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
_warning_button_pressed();
|
_warning_button_pressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1572,7 +1572,7 @@ void CodeTextEditor::_toggle_scripts_pressed() {
|
||||||
|
|
||||||
void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
|
void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
goto_error();
|
goto_error();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ TreeItem *EditorPerformanceProfiler::_create_monitor_item(const StringName &p_mo
|
||||||
|
|
||||||
void EditorPerformanceProfiler::_marker_input(const Ref<InputEvent> &p_event) {
|
void EditorPerformanceProfiler::_marker_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Vector<StringName> active;
|
Vector<StringName> active;
|
||||||
for (OrderedHashMap<StringName, Monitor>::Element i = monitors.front(); i; i = i.next()) {
|
for (OrderedHashMap<StringName, Monitor>::Element i = monitors.front(); i; i = i.next()) {
|
||||||
if (i.value().item->is_checked(0)) {
|
if (i.value().item->is_checked(0)) {
|
||||||
|
|
|
||||||
|
|
@ -482,7 +482,7 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
|
||||||
Ref<InputEventMouseMotion> mm = p_ev;
|
Ref<InputEventMouseMotion> mm = p_ev;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) ||
|
(mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) ||
|
||||||
(mm.is_valid())) {
|
(mm.is_valid())) {
|
||||||
int x = me->get_position().x;
|
int x = me->get_position().x;
|
||||||
x = x * frame_metrics.size() / graph->get_size().width;
|
x = x * frame_metrics.size() / graph->get_size().width;
|
||||||
|
|
@ -510,7 +510,7 @@ void EditorProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
|
||||||
hover_metric = -1;
|
hover_metric = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() || mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mb.is_valid() || mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
//cursor_metric=x;
|
//cursor_metric=x;
|
||||||
updating_frame = true;
|
updating_frame = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -517,7 +517,7 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
|
||||||
Ref<InputEventMouseMotion> mm = p_ev;
|
Ref<InputEventMouseMotion> mm = p_ev;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) ||
|
(mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) ||
|
||||||
(mm.is_valid())) {
|
(mm.is_valid())) {
|
||||||
int half_w = graph->get_size().width / 2;
|
int half_w = graph->get_size().width / 2;
|
||||||
int x = me->get_position().x;
|
int x = me->get_position().x;
|
||||||
|
|
@ -549,7 +549,7 @@ void EditorVisualProfiler::_graph_tex_input(const Ref<InputEvent> &p_ev) {
|
||||||
hover_metric = -1;
|
hover_metric = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() || mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mb.is_valid() || mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
//cursor_metric=x;
|
//cursor_metric=x;
|
||||||
updating_frame = true;
|
updating_frame = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -532,7 +532,7 @@ void EditorAudioBus::_effect_add(int p_which) {
|
||||||
|
|
||||||
void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
|
void EditorAudioBus::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
|
||||||
Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y);
|
Vector2 pos = Vector2(mb->get_position().x, mb->get_position().y);
|
||||||
bus_popup->set_position(get_global_position() + pos);
|
bus_popup->set_position(get_global_position() + pos);
|
||||||
bus_popup->popup();
|
bus_popup->popup();
|
||||||
|
|
|
||||||
|
|
@ -693,7 +693,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
if (is_layout_rtl()) {
|
if (is_layout_rtl()) {
|
||||||
mpos.x = get_size().x - mpos.x;
|
mpos.x = get_size().x - mpos.x;
|
||||||
}
|
}
|
||||||
bool button_left = me->get_button_mask() & BUTTON_MASK_LEFT;
|
bool button_left = me->get_button_mask() & MOUSE_BUTTON_MASK_LEFT;
|
||||||
|
|
||||||
bool new_keying_hover = keying_rect.has_point(mpos) && !button_left;
|
bool new_keying_hover = keying_rect.has_point(mpos) && !button_left;
|
||||||
if (new_keying_hover != keying_hover) {
|
if (new_keying_hover != keying_hover) {
|
||||||
|
|
@ -722,7 +722,7 @@ void EditorProperty::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Vector2 mpos = mb->get_position();
|
Vector2 mpos = mb->get_position();
|
||||||
if (is_layout_rtl()) {
|
if (is_layout_rtl()) {
|
||||||
mpos.x = get_size().x - mpos.x;
|
mpos.x = get_size().x - mpos.x;
|
||||||
|
|
@ -1359,7 +1359,7 @@ void EditorInspectorSection::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Ref<Font> font = get_theme_font("font", "Tree");
|
Ref<Font> font = get_theme_font("font", "Tree");
|
||||||
int font_size = get_theme_font_size("font_size", "Tree");
|
int font_size = get_theme_font_size("font_size", "Tree");
|
||||||
if (mb->get_position().y > font->get_height(font_size)) { //clicked outside
|
if (mb->get_position().y > font->get_height(font_size)) { //clicked outside
|
||||||
|
|
|
||||||
|
|
@ -4836,15 +4836,15 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (scene_tabs->get_hovered_tab() >= 0) {
|
if (scene_tabs->get_hovered_tab() >= 0) {
|
||||||
if (mb->get_button_index() == BUTTON_MIDDLE && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_MIDDLE && mb->is_pressed()) {
|
||||||
_scene_tab_closed(scene_tabs->get_hovered_tab());
|
_scene_tab_closed(scene_tabs->get_hovered_tab());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((mb->get_button_index() == BUTTON_LEFT && mb->is_doubleclick()) || (mb->get_button_index() == BUTTON_MIDDLE && mb->is_pressed())) {
|
if ((mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_doubleclick()) || (mb->get_button_index() == MOUSE_BUTTON_MIDDLE && mb->is_pressed())) {
|
||||||
_menu_option_confirm(FILE_NEW_SCENE, true);
|
_menu_option_confirm(FILE_NEW_SCENE, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
|
||||||
// context menu
|
// context menu
|
||||||
scene_tabs_context_menu->clear();
|
scene_tabs_context_menu->clear();
|
||||||
scene_tabs_context_menu->set_size(Size2(1, 1));
|
scene_tabs_context_menu->set_size(Size2(1, 1));
|
||||||
|
|
|
||||||
|
|
@ -621,7 +621,7 @@ public:
|
||||||
|
|
||||||
const Ref<InputEventMouseButton> mb = p_ev;
|
const Ref<InputEventMouseButton> mb = p_ev;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed() && hovered_index >= 0) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed() && hovered_index >= 0) {
|
||||||
// Toggle the flag.
|
// Toggle the flag.
|
||||||
// We base our choice on the hovered flag, so that it always matches the hovered flag.
|
// We base our choice on the hovered flag, so that it always matches the hovered flag.
|
||||||
if (value & (1 << hovered_index)) {
|
if (value & (1 << hovered_index)) {
|
||||||
|
|
@ -927,11 +927,11 @@ EditorPropertyFloat::EditorPropertyFloat() {
|
||||||
void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
|
void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
|
||||||
const Ref<InputEventMouseButton> mb = p_ev;
|
const Ref<InputEventMouseButton> mb = p_ev;
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_doubleclick() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->is_doubleclick() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
_setup_spin();
|
_setup_spin();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
preset->set_position(easing_draw->get_screen_transform().xform(mb->get_position()));
|
preset->set_position(easing_draw->get_screen_transform().xform(mb->get_position()));
|
||||||
preset->popup();
|
preset->popup();
|
||||||
|
|
||||||
|
|
@ -940,7 +940,7 @@ void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
|
||||||
easing_draw->update();
|
easing_draw->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
dragging = mb->is_pressed();
|
dragging = mb->is_pressed();
|
||||||
// Update to display the correct dragging color
|
// Update to display the correct dragging color
|
||||||
easing_draw->update();
|
easing_draw->update();
|
||||||
|
|
@ -949,7 +949,7 @@ void EditorPropertyEasing::_drag_easing(const Ref<InputEvent> &p_ev) {
|
||||||
|
|
||||||
const Ref<InputEventMouseMotion> mm = p_ev;
|
const Ref<InputEventMouseMotion> mm = p_ev;
|
||||||
|
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
float rel = mm->get_relative().x;
|
float rel = mm->get_relative().x;
|
||||||
if (rel == 0) {
|
if (rel == 0) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -2814,7 +2814,7 @@ void EditorPropertyResource::_sub_inspector_object_id_selected(int p_id) {
|
||||||
void EditorPropertyResource::_button_input(const Ref<InputEvent> &p_event) {
|
void EditorPropertyResource::_button_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
_update_menu_items();
|
_update_menu_items();
|
||||||
Vector2 pos = get_screen_position() + mb->get_position();
|
Vector2 pos = get_screen_position() + mb->get_position();
|
||||||
//pos = assign->get_global_transform().xform(pos);
|
//pos = assign->get_global_transform().xform(pos);
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
if (updown_offset != -1 && mb->get_position().x > updown_offset) {
|
if (updown_offset != -1 && mb->get_position().x > updown_offset) {
|
||||||
//there is an updown, so use it.
|
//there is an updown, so use it.
|
||||||
|
|
@ -84,7 +84,7 @@ void EditorSpinSlider::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
grabbing_spinner_attempt = false;
|
grabbing_spinner_attempt = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_UP || mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP || mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
if (grabber->is_visible()) {
|
if (grabber->is_visible()) {
|
||||||
call_deferred("update");
|
call_deferred("update");
|
||||||
}
|
}
|
||||||
|
|
@ -146,17 +146,17 @@ void EditorSpinSlider::_grabber_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
if (grabbing_grabber) {
|
if (grabbing_grabber) {
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_UP) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
set_value(get_value() + get_step());
|
set_value(get_value() + get_step());
|
||||||
mousewheel_over_grabber = true;
|
mousewheel_over_grabber = true;
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
set_value(get_value() - get_step());
|
set_value(get_value() - get_step());
|
||||||
mousewheel_over_grabber = true;
|
mousewheel_over_grabber = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
grabbing_grabber = true;
|
grabbing_grabber = true;
|
||||||
if (!mousewheel_over_grabber) {
|
if (!mousewheel_over_grabber) {
|
||||||
|
|
|
||||||
|
|
@ -668,21 +668,21 @@ void SceneImportSettings::_viewport_input(const Ref<InputEvent> &p_input) {
|
||||||
zoom = &md.cam_zoom;
|
zoom = &md.cam_zoom;
|
||||||
}
|
}
|
||||||
Ref<InputEventMouseMotion> mm = p_input;
|
Ref<InputEventMouseMotion> mm = p_input;
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
(*rot_x) -= mm->get_relative().y * 0.01 * EDSCALE;
|
(*rot_x) -= mm->get_relative().y * 0.01 * EDSCALE;
|
||||||
(*rot_y) -= mm->get_relative().x * 0.01 * EDSCALE;
|
(*rot_y) -= mm->get_relative().x * 0.01 * EDSCALE;
|
||||||
(*rot_x) = CLAMP((*rot_x), -Math_PI / 2, Math_PI / 2);
|
(*rot_x) = CLAMP((*rot_x), -Math_PI / 2, Math_PI / 2);
|
||||||
_update_camera();
|
_update_camera();
|
||||||
}
|
}
|
||||||
Ref<InputEventMouseButton> mb = p_input;
|
Ref<InputEventMouseButton> mb = p_input;
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
(*zoom) *= 1.1;
|
(*zoom) *= 1.1;
|
||||||
if ((*zoom) > 10.0) {
|
if ((*zoom) > 10.0) {
|
||||||
(*zoom) = 10.0;
|
(*zoom) = 10.0;
|
||||||
}
|
}
|
||||||
_update_camera();
|
_update_camera();
|
||||||
}
|
}
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
(*zoom) /= 1.1;
|
(*zoom) /= 1.1;
|
||||||
if ((*zoom) < 0.1) {
|
if ((*zoom) < 0.1) {
|
||||||
(*zoom) = 0.1;
|
(*zoom) = 0.1;
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||||
Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(mb->get_position())));
|
Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(mb->get_position())));
|
||||||
|
|
||||||
if (mode == MODE_EDIT || (_is_line() && mode == MODE_CREATE)) {
|
if (mode == MODE_EDIT || (_is_line() && mode == MODE_CREATE)) {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
if (mb->get_control() || mb->get_shift() || mb->get_alt()) {
|
if (mb->get_control() || mb->get_shift() || mb->get_alt()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -326,7 +326,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && !edited_point.valid()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && !edited_point.valid()) {
|
||||||
const PosVertex closest = closest_point(gpoint);
|
const PosVertex closest = closest_point(gpoint);
|
||||||
|
|
||||||
if (closest.valid()) {
|
if (closest.valid()) {
|
||||||
|
|
@ -335,7 +335,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mode == MODE_DELETE) {
|
} else if (mode == MODE_DELETE) {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
|
||||||
const PosVertex closest = closest_point(gpoint);
|
const PosVertex closest = closest_point(gpoint);
|
||||||
|
|
||||||
if (closest.valid()) {
|
if (closest.valid()) {
|
||||||
|
|
@ -346,7 +346,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == MODE_CREATE) {
|
if (mode == MODE_CREATE) {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
|
||||||
if (_is_line()) {
|
if (_is_line()) {
|
||||||
// for lines, we don't have a wip mode, and we can undo each single add point.
|
// for lines, we don't have a wip mode, and we can undo each single add point.
|
||||||
Vector<Vector2> vertices = _get_polygon(0);
|
Vector<Vector2> vertices = _get_polygon(0);
|
||||||
|
|
@ -384,7 +384,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && wip_active) {
|
||||||
_wip_cancel();
|
_wip_cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -395,7 +395,7 @@ bool AbstractPolygon2DEditor::forward_gui_input(const Ref<InputEvent> &p_event)
|
||||||
if (mm.is_valid()) {
|
if (mm.is_valid()) {
|
||||||
Vector2 gpoint = mm->get_position();
|
Vector2 gpoint = mm->get_position();
|
||||||
|
|
||||||
if (edited_point.valid() && (wip_active || (mm->get_button_mask() & BUTTON_MASK_LEFT))) {
|
if (edited_point.valid() && (wip_active || (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT))) {
|
||||||
Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
|
Vector2 cpoint = _get_node()->get_global_transform().affine_inverse().xform(canvas_item_editor->snap_point(canvas_item_editor->get_canvas_transform().affine_inverse().xform(gpoint)));
|
||||||
|
|
||||||
//Move the point in a single axis. Should only work when editing a polygon and while holding shift.
|
//Move the point in a single axis. Should only work when editing a polygon and while holding shift.
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) || (mb->get_button_index() == BUTTON_LEFT && tool_create->is_pressed()))) {
|
if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && tool_create->is_pressed()))) {
|
||||||
menu->clear();
|
menu->clear();
|
||||||
animations_menu->clear();
|
animations_menu->clear();
|
||||||
animations_to_add.clear();
|
animations_to_add.clear();
|
||||||
|
|
@ -110,7 +110,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
blend_space_draw->update(); // why not
|
blend_space_draw->update(); // why not
|
||||||
|
|
||||||
// try to see if a point can be selected
|
// try to see if a point can be selected
|
||||||
|
|
@ -132,7 +132,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (dragging_selected) {
|
if (dragging_selected) {
|
||||||
// move
|
// move
|
||||||
float point = blend_space->get_blend_point_position(selected_point);
|
float point = blend_space->get_blend_point_position(selected_point);
|
||||||
|
|
@ -161,7 +161,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
}
|
}
|
||||||
|
|
||||||
// *set* the blend
|
// *set* the blend
|
||||||
if (mb.is_valid() && !mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && !mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
float blend_pos = mb->get_position().x / blend_space_draw->get_size().x;
|
float blend_pos = mb->get_position().x / blend_space_draw->get_size().x;
|
||||||
blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
|
blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
|
||||||
blend_pos += blend_space->get_min_space();
|
blend_pos += blend_space->get_min_space();
|
||||||
|
|
@ -184,7 +184,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
_update_edited_point_pos();
|
_update_edited_point_pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
float blend_pos = mm->get_position().x / blend_space_draw->get_size().x;
|
float blend_pos = mm->get_position().x / blend_space_draw->get_size().x;
|
||||||
blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
|
blend_pos *= blend_space->get_max_space() - blend_space->get_min_space();
|
||||||
blend_pos += blend_space->get_min_space();
|
blend_pos += blend_space->get_min_space();
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) || (mb->get_button_index() == BUTTON_LEFT && tool_create->is_pressed()))) {
|
if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && tool_create->is_pressed()))) {
|
||||||
menu->clear();
|
menu->clear();
|
||||||
animations_menu->clear();
|
animations_menu->clear();
|
||||||
animations_to_add.clear();
|
animations_to_add.clear();
|
||||||
|
|
@ -134,7 +134,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
blend_space_draw->update(); //update anyway
|
blend_space_draw->update(); //update anyway
|
||||||
//try to see if a point can be selected
|
//try to see if a point can be selected
|
||||||
selected_point = -1;
|
selected_point = -1;
|
||||||
|
|
@ -174,7 +174,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && tool_triangle->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && tool_triangle->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
blend_space_draw->update(); //update anyway
|
blend_space_draw->update(); //update anyway
|
||||||
//try to see if a point can be selected
|
//try to see if a point can be selected
|
||||||
selected_point = -1;
|
selected_point = -1;
|
||||||
|
|
@ -209,7 +209,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && !mb->is_pressed() && dragging_selected_attempt && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (dragging_selected) {
|
if (dragging_selected) {
|
||||||
//move
|
//move
|
||||||
Vector2 point = blend_space->get_blend_point_position(selected_point);
|
Vector2 point = blend_space->get_blend_point_position(selected_point);
|
||||||
|
|
@ -236,7 +236,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
blend_space_draw->update();
|
blend_space_draw->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && tool_blend->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Vector2 blend_pos = (mb->get_position() / blend_space_draw->get_size());
|
Vector2 blend_pos = (mb->get_position() / blend_space_draw->get_size());
|
||||||
blend_pos.y = 1.0 - blend_pos.y;
|
blend_pos.y = 1.0 - blend_pos.y;
|
||||||
blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
|
blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
|
||||||
|
|
@ -270,7 +270,7 @@ void AnimationNodeBlendSpace2DEditor::_blend_space_gui_input(const Ref<InputEven
|
||||||
blend_space_draw->update();
|
blend_space_draw->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm.is_valid() && tool_blend->is_pressed() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
Vector2 blend_pos = (mm->get_position() / blend_space_draw->get_size());
|
Vector2 blend_pos = (mm->get_position() / blend_space_draw->get_size());
|
||||||
blend_pos.y = 1.0 - blend_pos.y;
|
blend_pos.y = 1.0 - blend_pos.y;
|
||||||
blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
|
blend_pos *= (blend_space->get_max_space() - blend_space->get_min_space());
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
//Add new node
|
//Add new node
|
||||||
if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) || (tool_create->is_pressed() && mb->get_button_index() == BUTTON_LEFT))) {
|
if (mb.is_valid() && mb->is_pressed() && ((tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (tool_create->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT))) {
|
||||||
menu->clear();
|
menu->clear();
|
||||||
animations_menu->clear();
|
animations_menu->clear();
|
||||||
animations_to_add.clear();
|
animations_to_add.clear();
|
||||||
|
|
@ -124,7 +124,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
||||||
}
|
}
|
||||||
|
|
||||||
// select node or push a field inside
|
// select node or push a field inside
|
||||||
if (mb.is_valid() && !mb->get_shift() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && !mb->get_shift() && mb->is_pressed() && tool_select->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
selected_transition_from = StringName();
|
selected_transition_from = StringName();
|
||||||
selected_transition_to = StringName();
|
selected_transition_to = StringName();
|
||||||
selected_node = StringName();
|
selected_node = StringName();
|
||||||
|
|
@ -216,7 +216,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
||||||
}
|
}
|
||||||
|
|
||||||
//end moving node
|
//end moving node
|
||||||
if (mb.is_valid() && dragging_selected_attempt && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
|
if (mb.is_valid() && dragging_selected_attempt && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
|
||||||
if (dragging_selected) {
|
if (dragging_selected) {
|
||||||
Ref<AnimationNode> an = state_machine->get_node(selected_node);
|
Ref<AnimationNode> an = state_machine->get_node(selected_node);
|
||||||
updating = true;
|
updating = true;
|
||||||
|
|
@ -237,7 +237,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
||||||
}
|
}
|
||||||
|
|
||||||
//connect nodes
|
//connect nodes
|
||||||
if (mb.is_valid() && ((tool_select->is_pressed() && mb->get_shift()) || tool_connect->is_pressed()) && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
|
if (mb.is_valid() && ((tool_select->is_pressed() && mb->get_shift()) || tool_connect->is_pressed()) && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
|
||||||
for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order
|
for (int i = node_rects.size() - 1; i >= 0; i--) { //inverse to draw order
|
||||||
if (node_rects[i].node.has_point(mb->get_position())) { //select node since nothing else was selected
|
if (node_rects[i].node.has_point(mb->get_position())) { //select node since nothing else was selected
|
||||||
connecting = true;
|
connecting = true;
|
||||||
|
|
@ -250,7 +250,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
||||||
}
|
}
|
||||||
|
|
||||||
//end connecting nodes
|
//end connecting nodes
|
||||||
if (mb.is_valid() && connecting && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
|
if (mb.is_valid() && connecting && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
|
||||||
if (connecting_to_node != StringName()) {
|
if (connecting_to_node != StringName()) {
|
||||||
if (state_machine->has_transition(connecting_from, connecting_to_node)) {
|
if (state_machine->has_transition(connecting_from, connecting_to_node)) {
|
||||||
EditorNode::get_singleton()->show_warning(TTR("Transition exists!"));
|
EditorNode::get_singleton()->show_warning(TTR("Transition exists!"));
|
||||||
|
|
@ -284,7 +284,7 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
|
|
||||||
//pan window
|
//pan window
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_MIDDLE) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
|
||||||
h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x);
|
h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x);
|
||||||
v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y);
|
v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1095,7 +1095,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start dragging a guide
|
// Start dragging a guide
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) {
|
||||||
// Press button
|
// Press button
|
||||||
if (b->get_position().x < RULER_WIDTH && b->get_position().y < RULER_WIDTH) {
|
if (b->get_position().x < RULER_WIDTH && b->get_position().y < RULER_WIDTH) {
|
||||||
// Drag a new double guide
|
// Drag a new double guide
|
||||||
|
|
@ -1154,7 +1154,7 @@ bool CanvasItemEditor::_gui_input_rulers_and_guides(const Ref<InputEvent> &p_eve
|
||||||
}
|
}
|
||||||
|
|
||||||
// Release confirms the guide move
|
// Release confirms the guide move
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
|
||||||
if (show_guides && EditorNode::get_singleton()->get_edited_scene()) {
|
if (show_guides && EditorNode::get_singleton()->get_edited_scene()) {
|
||||||
Transform2D xform = viewport_scrollable->get_transform() * transform;
|
Transform2D xform = viewport_scrollable->get_transform() * transform;
|
||||||
|
|
||||||
|
|
@ -1268,7 +1268,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
|
||||||
if (pan_on_scroll) {
|
if (pan_on_scroll) {
|
||||||
// Perform horizontal scrolling first so we can check for Shift being held.
|
// Perform horizontal scrolling first so we can check for Shift being held.
|
||||||
if (b->is_pressed() &&
|
if (b->is_pressed() &&
|
||||||
(b->get_button_index() == BUTTON_WHEEL_LEFT || (b->get_shift() && b->get_button_index() == BUTTON_WHEEL_UP))) {
|
(b->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT || (b->get_shift() && b->get_button_index() == MOUSE_BUTTON_WHEEL_UP))) {
|
||||||
// Pan left
|
// Pan left
|
||||||
view_offset.x -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
|
view_offset.x -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
|
||||||
update_viewport();
|
update_viewport();
|
||||||
|
|
@ -1276,7 +1276,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->is_pressed() &&
|
if (b->is_pressed() &&
|
||||||
(b->get_button_index() == BUTTON_WHEEL_RIGHT || (b->get_shift() && b->get_button_index() == BUTTON_WHEEL_DOWN))) {
|
(b->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT || (b->get_shift() && b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN))) {
|
||||||
// Pan right
|
// Pan right
|
||||||
view_offset.x += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
|
view_offset.x += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
|
||||||
update_viewport();
|
update_viewport();
|
||||||
|
|
@ -1284,7 +1284,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_DOWN) {
|
if (b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
// Scroll or pan down
|
// Scroll or pan down
|
||||||
if (pan_on_scroll) {
|
if (pan_on_scroll) {
|
||||||
view_offset.y += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
|
view_offset.y += int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
|
||||||
|
|
@ -1299,7 +1299,7 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->is_pressed() && b->get_button_index() == BUTTON_WHEEL_UP) {
|
if (b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
// Scroll or pan up
|
// Scroll or pan up
|
||||||
if (pan_on_scroll) {
|
if (pan_on_scroll) {
|
||||||
view_offset.y -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
|
view_offset.y -= int(EditorSettings::get_singleton()->get("editors/2d/pan_speed")) / zoom * b->get_factor();
|
||||||
|
|
@ -1316,17 +1316,17 @@ bool CanvasItemEditor::_gui_input_zoom_or_pan(const Ref<InputEvent> &p_event, bo
|
||||||
|
|
||||||
if (!panning) {
|
if (!panning) {
|
||||||
if (b->is_pressed() &&
|
if (b->is_pressed() &&
|
||||||
(b->get_button_index() == BUTTON_MIDDLE ||
|
(b->get_button_index() == MOUSE_BUTTON_MIDDLE ||
|
||||||
b->get_button_index() == BUTTON_RIGHT ||
|
b->get_button_index() == MOUSE_BUTTON_RIGHT ||
|
||||||
(b->get_button_index() == BUTTON_LEFT && tool == TOOL_PAN) ||
|
(b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_PAN) ||
|
||||||
(b->get_button_index() == BUTTON_LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_panning") && pan_pressed))) {
|
(b->get_button_index() == MOUSE_BUTTON_LEFT && !EditorSettings::get_singleton()->get("editors/2d/simple_panning") && pan_pressed))) {
|
||||||
// Pan the viewport
|
// Pan the viewport
|
||||||
panning = true;
|
panning = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panning) {
|
if (panning) {
|
||||||
if (!b->is_pressed() && (pan_on_scroll || (b->get_button_index() != BUTTON_WHEEL_DOWN && b->get_button_index() != BUTTON_WHEEL_UP))) {
|
if (!b->is_pressed() && (pan_on_scroll || (b->get_button_index() != MOUSE_BUTTON_WHEEL_DOWN && b->get_button_index() != MOUSE_BUTTON_WHEEL_UP))) {
|
||||||
// Stop panning the viewport (for any mouse button press except zooming)
|
// Stop panning the viewport (for any mouse button press except zooming)
|
||||||
panning = false;
|
panning = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1412,7 +1412,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
// Drag the pivot (in pivot mode / with V key)
|
// Drag the pivot (in pivot mode / with V key)
|
||||||
if (drag_type == DRAG_NONE) {
|
if (drag_type == DRAG_NONE) {
|
||||||
if ((b.is_valid() && b->is_pressed() && b->get_button_index() == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) ||
|
if ((b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) ||
|
||||||
(k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_V)) {
|
(k.is_valid() && k->is_pressed() && !k->is_echo() && k->get_keycode() == KEY_V)) {
|
||||||
List<CanvasItem *> selection = _get_edited_canvas_items();
|
List<CanvasItem *> selection = _get_edited_canvas_items();
|
||||||
|
|
||||||
|
|
@ -1466,7 +1466,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
// Confirm the pivot move
|
// Confirm the pivot move
|
||||||
if (drag_selection.size() >= 1 &&
|
if (drag_selection.size() >= 1 &&
|
||||||
((b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) ||
|
((b.is_valid() && !b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_EDIT_PIVOT) ||
|
||||||
(k.is_valid() && !k->is_pressed() && k->get_keycode() == KEY_V))) {
|
(k.is_valid() && !k->is_pressed() && k->get_keycode() == KEY_V))) {
|
||||||
_commit_canvas_item_state(
|
_commit_canvas_item_state(
|
||||||
drag_selection,
|
drag_selection,
|
||||||
|
|
@ -1480,7 +1480,7 @@ bool CanvasItemEditor::_gui_input_pivot(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// Cancel a drag
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
|
||||||
_restore_canvas_item_state(drag_selection);
|
_restore_canvas_item_state(drag_selection);
|
||||||
drag_type = DRAG_NONE;
|
drag_type = DRAG_NONE;
|
||||||
viewport->update();
|
viewport->update();
|
||||||
|
|
@ -1566,7 +1566,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
// Start rotation
|
// Start rotation
|
||||||
if (drag_type == DRAG_NONE) {
|
if (drag_type == DRAG_NONE) {
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) {
|
||||||
if ((b->get_command() && !b->get_alt() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) {
|
if ((b->get_command() && !b->get_alt() && tool == TOOL_SELECT) || tool == TOOL_ROTATE) {
|
||||||
List<CanvasItem *> selection = _get_edited_canvas_items();
|
List<CanvasItem *> selection = _get_edited_canvas_items();
|
||||||
|
|
||||||
|
|
@ -1610,7 +1610,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirms the node rotation
|
// Confirms the node rotation
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
|
||||||
if (drag_selection.size() != 1) {
|
if (drag_selection.size() != 1) {
|
||||||
_commit_canvas_item_state(
|
_commit_canvas_item_state(
|
||||||
drag_selection,
|
drag_selection,
|
||||||
|
|
@ -1634,7 +1634,7 @@ bool CanvasItemEditor::_gui_input_rotate(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// Cancel a drag
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
|
||||||
_restore_canvas_item_state(drag_selection);
|
_restore_canvas_item_state(drag_selection);
|
||||||
drag_type = DRAG_NONE;
|
drag_type = DRAG_NONE;
|
||||||
viewport->update();
|
viewport->update();
|
||||||
|
|
@ -1648,7 +1648,7 @@ bool CanvasItemEditor::_gui_input_open_scene_on_double_click(const Ref<InputEven
|
||||||
Ref<InputEventMouseButton> b = p_event;
|
Ref<InputEventMouseButton> b = p_event;
|
||||||
|
|
||||||
// Open a sub-scene on double-click
|
// Open a sub-scene on double-click
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && b->is_doubleclick() && tool == TOOL_SELECT) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && b->is_doubleclick() && tool == TOOL_SELECT) {
|
||||||
List<CanvasItem *> selection = _get_edited_canvas_items();
|
List<CanvasItem *> selection = _get_edited_canvas_items();
|
||||||
if (selection.size() == 1) {
|
if (selection.size() == 1) {
|
||||||
CanvasItem *canvas_item = selection[0];
|
CanvasItem *canvas_item = selection[0];
|
||||||
|
|
@ -1667,7 +1667,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
// Starts anchor dragging if needed
|
// Starts anchor dragging if needed
|
||||||
if (drag_type == DRAG_NONE) {
|
if (drag_type == DRAG_NONE) {
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
|
||||||
List<CanvasItem *> selection = _get_edited_canvas_items();
|
List<CanvasItem *> selection = _get_edited_canvas_items();
|
||||||
if (selection.size() == 1) {
|
if (selection.size() == 1) {
|
||||||
Control *control = Object::cast_to<Control>(selection[0]);
|
Control *control = Object::cast_to<Control>(selection[0]);
|
||||||
|
|
@ -1787,7 +1787,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirms new anchor position
|
// Confirms new anchor position
|
||||||
if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) {
|
if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
|
||||||
_commit_canvas_item_state(
|
_commit_canvas_item_state(
|
||||||
drag_selection,
|
drag_selection,
|
||||||
vformat(TTR("Move CanvasItem \"%s\" Anchor"), drag_selection[0]->get_name()));
|
vformat(TTR("Move CanvasItem \"%s\" Anchor"), drag_selection[0]->get_name()));
|
||||||
|
|
@ -1796,7 +1796,7 @@ bool CanvasItemEditor::_gui_input_anchors(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// Cancel a drag
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
|
||||||
_restore_canvas_item_state(drag_selection);
|
_restore_canvas_item_state(drag_selection);
|
||||||
drag_type = DRAG_NONE;
|
drag_type = DRAG_NONE;
|
||||||
viewport->update();
|
viewport->update();
|
||||||
|
|
@ -1812,7 +1812,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
// Drag resize handles
|
// Drag resize handles
|
||||||
if (drag_type == DRAG_NONE) {
|
if (drag_type == DRAG_NONE) {
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
|
||||||
List<CanvasItem *> selection = _get_edited_canvas_items();
|
List<CanvasItem *> selection = _get_edited_canvas_items();
|
||||||
if (selection.size() == 1) {
|
if (selection.size() == 1) {
|
||||||
CanvasItem *canvas_item = selection[0];
|
CanvasItem *canvas_item = selection[0];
|
||||||
|
|
@ -1966,7 +1966,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm resize
|
// Confirm resize
|
||||||
if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) {
|
if (drag_selection.size() >= 1 && b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
|
||||||
const Node2D *node2d = Object::cast_to<Node2D>(drag_selection[0]);
|
const Node2D *node2d = Object::cast_to<Node2D>(drag_selection[0]);
|
||||||
if (node2d) {
|
if (node2d) {
|
||||||
// Extends from Node2D.
|
// Extends from Node2D.
|
||||||
|
|
@ -2003,7 +2003,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// Cancel a drag
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
|
||||||
_restore_canvas_item_state(drag_selection);
|
_restore_canvas_item_state(drag_selection);
|
||||||
snap_target[0] = SNAP_TARGET_NONE;
|
snap_target[0] = SNAP_TARGET_NONE;
|
||||||
snap_target[1] = SNAP_TARGET_NONE;
|
snap_target[1] = SNAP_TARGET_NONE;
|
||||||
|
|
@ -2021,7 +2021,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
// Drag resize handles
|
// Drag resize handles
|
||||||
if (drag_type == DRAG_NONE) {
|
if (drag_type == DRAG_NONE) {
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && ((b->get_alt() && b->get_control()) || tool == TOOL_SCALE)) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && ((b->get_alt() && b->get_control()) || tool == TOOL_SCALE)) {
|
||||||
List<CanvasItem *> selection = _get_edited_canvas_items();
|
List<CanvasItem *> selection = _get_edited_canvas_items();
|
||||||
if (selection.size() == 1) {
|
if (selection.size() == 1) {
|
||||||
CanvasItem *canvas_item = selection[0];
|
CanvasItem *canvas_item = selection[0];
|
||||||
|
|
@ -2117,7 +2117,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm resize
|
// Confirm resize
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && !b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed()) {
|
||||||
if (drag_selection.size() != 1) {
|
if (drag_selection.size() != 1) {
|
||||||
_commit_canvas_item_state(
|
_commit_canvas_item_state(
|
||||||
drag_selection,
|
drag_selection,
|
||||||
|
|
@ -2142,7 +2142,7 @@ bool CanvasItemEditor::_gui_input_scale(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// Cancel a drag
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
|
||||||
_restore_canvas_item_state(drag_selection);
|
_restore_canvas_item_state(drag_selection);
|
||||||
drag_type = DRAG_NONE;
|
drag_type = DRAG_NONE;
|
||||||
viewport->update();
|
viewport->update();
|
||||||
|
|
@ -2159,7 +2159,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
if (drag_type == DRAG_NONE) {
|
if (drag_type == DRAG_NONE) {
|
||||||
//Start moving the nodes
|
//Start moving the nodes
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) {
|
||||||
if ((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) {
|
if ((b->get_alt() && !b->get_control()) || tool == TOOL_MOVE) {
|
||||||
List<CanvasItem *> selection = _get_edited_canvas_items();
|
List<CanvasItem *> selection = _get_edited_canvas_items();
|
||||||
|
|
||||||
|
|
@ -2262,7 +2262,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Confirm the move (only if it was moved)
|
// Confirm the move (only if it was moved)
|
||||||
if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT) {
|
if (b.is_valid() && !b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (transform.affine_inverse().xform(b->get_position()) != drag_from) {
|
if (transform.affine_inverse().xform(b->get_position()) != drag_from) {
|
||||||
if (drag_selection.size() != 1) {
|
if (drag_selection.size() != 1) {
|
||||||
_commit_canvas_item_state(
|
_commit_canvas_item_state(
|
||||||
|
|
@ -2295,7 +2295,7 @@ bool CanvasItemEditor::_gui_input_move(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel a drag
|
// Cancel a drag
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
|
||||||
_restore_canvas_item_state(drag_selection, true);
|
_restore_canvas_item_state(drag_selection, true);
|
||||||
snap_target[0] = SNAP_TARGET_NONE;
|
snap_target[0] = SNAP_TARGET_NONE;
|
||||||
snap_target[1] = SNAP_TARGET_NONE;
|
snap_target[1] = SNAP_TARGET_NONE;
|
||||||
|
|
@ -2435,8 +2435,8 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
if (drag_type == DRAG_NONE) {
|
if (drag_type == DRAG_NONE) {
|
||||||
if (b.is_valid() &&
|
if (b.is_valid() &&
|
||||||
((b->get_button_index() == BUTTON_RIGHT && b->get_alt() && tool == TOOL_SELECT) ||
|
((b->get_button_index() == MOUSE_BUTTON_RIGHT && b->get_alt() && tool == TOOL_SELECT) ||
|
||||||
(b->get_button_index() == BUTTON_LEFT && tool == TOOL_LIST_SELECT))) {
|
(b->get_button_index() == MOUSE_BUTTON_LEFT && tool == TOOL_LIST_SELECT))) {
|
||||||
// Popup the selection menu list
|
// Popup the selection menu list
|
||||||
Point2 click = transform.affine_inverse().xform(b->get_position());
|
Point2 click = transform.affine_inverse().xform(b->get_position());
|
||||||
|
|
||||||
|
|
@ -2497,7 +2497,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b.is_valid() && b->is_pressed() && b->get_button_index() == BUTTON_RIGHT && b->get_control()) {
|
if (b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT && b->get_control()) {
|
||||||
add_node_menu->set_position(get_global_transform().xform(get_local_mouse_position()));
|
add_node_menu->set_position(get_global_transform().xform(get_local_mouse_position()));
|
||||||
add_node_menu->set_size(Vector2(1, 1));
|
add_node_menu->set_size(Vector2(1, 1));
|
||||||
add_node_menu->popup();
|
add_node_menu->popup();
|
||||||
|
|
@ -2505,7 +2505,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed() && tool == TOOL_SELECT) {
|
||||||
// Single item selection
|
// Single item selection
|
||||||
Point2 click = transform.affine_inverse().xform(b->get_position());
|
Point2 click = transform.affine_inverse().xform(b->get_position());
|
||||||
|
|
||||||
|
|
@ -2571,7 +2571,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drag_type == DRAG_BOX_SELECTION) {
|
if (drag_type == DRAG_BOX_SELECTION) {
|
||||||
if (b.is_valid() && !b->is_pressed() && b->get_button_index() == BUTTON_LEFT) {
|
if (b.is_valid() && !b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
// Confirms box selection
|
// Confirms box selection
|
||||||
Node *scene = editor->get_edited_scene();
|
Node *scene = editor->get_edited_scene();
|
||||||
if (scene) {
|
if (scene) {
|
||||||
|
|
@ -2597,7 +2597,7 @@ bool CanvasItemEditor::_gui_input_select(const Ref<InputEvent> &p_event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b.is_valid() && b->is_pressed() && b->get_button_index() == BUTTON_RIGHT) {
|
if (b.is_valid() && b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
// Cancel box selection
|
// Cancel box selection
|
||||||
drag_type = DRAG_NONE;
|
drag_type = DRAG_NONE;
|
||||||
viewport->update();
|
viewport->update();
|
||||||
|
|
@ -2634,7 +2634,7 @@ bool CanvasItemEditor::_gui_input_ruler_tool(const Ref<InputEvent> &p_event) {
|
||||||
ruler_tool_origin = snap_point(viewport->get_local_mouse_position() / zoom + view_offset);
|
ruler_tool_origin = snap_point(viewport->get_local_mouse_position() / zoom + view_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b.is_valid() && b->get_button_index() == BUTTON_LEFT) {
|
if (b.is_valid() && b->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (b->is_pressed()) {
|
if (b->is_pressed()) {
|
||||||
ruler_tool_active = true;
|
ruler_tool_active = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MODE_CREATE: {
|
case MODE_CREATE: {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
|
||||||
if (!wip_active) {
|
if (!wip_active) {
|
||||||
wip.clear();
|
wip.clear();
|
||||||
wip.push_back(cpoint);
|
wip.push_back(cpoint);
|
||||||
|
|
@ -166,14 +166,14 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && wip_active) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && wip_active) {
|
||||||
_wip_close();
|
_wip_close();
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case MODE_EDIT: {
|
case MODE_EDIT: {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
if (mb->get_control()) {
|
if (mb->get_control()) {
|
||||||
if (poly.size() < 3) {
|
if (poly.size() < 3) {
|
||||||
|
|
@ -267,7 +267,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
|
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed() && edited_point == -1) {
|
||||||
int closest_idx = -1;
|
int closest_idx = -1;
|
||||||
Vector2 closest_pos;
|
Vector2 closest_pos;
|
||||||
real_t closest_dist = 1e10;
|
real_t closest_dist = 1e10;
|
||||||
|
|
@ -301,7 +301,7 @@ bool CollisionPolygon3DEditor::forward_spatial_gui_input(Camera3D *p_camera, con
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
|
|
||||||
if (mm.is_valid()) {
|
if (mm.is_valid()) {
|
||||||
if (edited_point != -1 && (wip_active || mm->get_button_mask() & BUTTON_MASK_LEFT)) {
|
if (edited_point != -1 && (wip_active || mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT)) {
|
||||||
Vector2 gpoint = mm->get_position();
|
Vector2 gpoint = mm->get_position();
|
||||||
|
|
||||||
Vector3 ray_from = p_camera->project_ray_origin(gpoint);
|
Vector3 ray_from = p_camera->project_ray_origin(gpoint);
|
||||||
|
|
|
||||||
|
|
@ -325,7 +325,7 @@ bool CollisionShape2DEditor::forward_canvas_gui_input(const Ref<InputEvent> &p_e
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
Vector2 gpoint = mb->get_position();
|
Vector2 gpoint = mb->get_position();
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
for (int i = 0; i < handles.size(); i++) {
|
for (int i = 0; i < handles.size(); i++) {
|
||||||
if (xform.xform(handles[i]).distance_to(gpoint) < 8) {
|
if (xform.xform(handles[i]).distance_to(gpoint) < 8) {
|
||||||
|
|
|
||||||
|
|
@ -115,22 +115,22 @@ void CurveEditor::on_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mb.get_button_index()) {
|
switch (mb.get_button_index()) {
|
||||||
case BUTTON_RIGHT:
|
case MOUSE_BUTTON_RIGHT:
|
||||||
_context_click_pos = mpos;
|
_context_click_pos = mpos;
|
||||||
open_context_menu(get_global_transform().xform(mpos));
|
open_context_menu(get_global_transform().xform(mpos));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_MIDDLE:
|
case MOUSE_BUTTON_MIDDLE:
|
||||||
remove_point(_hover_point);
|
remove_point(_hover_point);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BUTTON_LEFT:
|
case MOUSE_BUTTON_LEFT:
|
||||||
_dragging = true;
|
_dragging = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mb.is_pressed() && _dragging && mb.get_button_index() == BUTTON_LEFT) {
|
if (!mb.is_pressed() && _dragging && mb.get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
_dragging = false;
|
_dragging = false;
|
||||||
if (_has_undo_data) {
|
if (_has_undo_data) {
|
||||||
UndoRedo &ur = *EditorNode::get_singleton()->get_undo_redo();
|
UndoRedo &ur = *EditorNode::get_singleton()->get_undo_redo();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
void MeshEditor::_gui_input(Ref<InputEvent> p_event) {
|
void MeshEditor::_gui_input(Ref<InputEvent> p_event) {
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
rot_x -= mm->get_relative().y * 0.01;
|
rot_x -= mm->get_relative().y * 0.01;
|
||||||
rot_y -= mm->get_relative().x * 0.01;
|
rot_y -= mm->get_relative().x * 0.01;
|
||||||
if (rot_x < -Math_PI / 2) {
|
if (rot_x < -Math_PI / 2) {
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ void ViewportRotationControl::_get_sorted_axis(Vector<Axis2D> &r_axis) {
|
||||||
|
|
||||||
void ViewportRotationControl::_gui_input(Ref<InputEvent> p_event) {
|
void ViewportRotationControl::_gui_input(Ref<InputEvent> p_event) {
|
||||||
const Ref<InputEventMouseButton> mb = p_event;
|
const Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Vector2 pos = mb->get_position();
|
Vector2 pos = mb->get_position();
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
if (pos.distance_to(get_size() / 2.0) < get_size().x / 2.0) {
|
if (pos.distance_to(get_size() / 2.0) < get_size().x / 2.0) {
|
||||||
|
|
@ -1123,23 +1123,21 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
float zoom_factor = 1 + (ZOOM_FREELOOK_MULTIPLIER - 1) * b->get_factor();
|
float zoom_factor = 1 + (ZOOM_FREELOOK_MULTIPLIER - 1) * b->get_factor();
|
||||||
switch (b->get_button_index()) {
|
switch (b->get_button_index()) {
|
||||||
case BUTTON_WHEEL_UP: {
|
case MOUSE_BUTTON_WHEEL_UP: {
|
||||||
if (is_freelook_active()) {
|
if (is_freelook_active()) {
|
||||||
scale_freelook_speed(zoom_factor);
|
scale_freelook_speed(zoom_factor);
|
||||||
} else {
|
} else {
|
||||||
scale_cursor_distance(1.0 / zoom_factor);
|
scale_cursor_distance(1.0 / zoom_factor);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case MOUSE_BUTTON_WHEEL_DOWN: {
|
||||||
case BUTTON_WHEEL_DOWN: {
|
|
||||||
if (is_freelook_active()) {
|
if (is_freelook_active()) {
|
||||||
scale_freelook_speed(1.0 / zoom_factor);
|
scale_freelook_speed(1.0 / zoom_factor);
|
||||||
} else {
|
} else {
|
||||||
scale_cursor_distance(zoom_factor);
|
scale_cursor_distance(zoom_factor);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
case MOUSE_BUTTON_RIGHT: {
|
||||||
case BUTTON_RIGHT: {
|
|
||||||
NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
|
NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
|
||||||
|
|
||||||
if (b->is_pressed() && _edit.gizmo.is_valid()) {
|
if (b->is_pressed() && _edit.gizmo.is_valid()) {
|
||||||
|
|
@ -1200,7 +1198,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case BUTTON_MIDDLE: {
|
case MOUSE_BUTTON_MIDDLE: {
|
||||||
if (b->is_pressed() && _edit.mode != TRANSFORM_NONE) {
|
if (b->is_pressed() && _edit.mode != TRANSFORM_NONE) {
|
||||||
switch (_edit.plane) {
|
switch (_edit.plane) {
|
||||||
case TRANSFORM_VIEW: {
|
case TRANSFORM_VIEW: {
|
||||||
|
|
@ -1231,7 +1229,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case BUTTON_LEFT: {
|
case MOUSE_BUTTON_LEFT: {
|
||||||
if (b->is_pressed()) {
|
if (b->is_pressed()) {
|
||||||
NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
|
NavigationScheme nav_scheme = (NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
|
||||||
if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->get_alt()) {
|
if ((nav_scheme == NAVIGATION_MAYA || nav_scheme == NAVIGATION_MODO) && b->get_alt()) {
|
||||||
|
|
@ -1440,7 +1438,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||||
String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle);
|
String n = _edit.gizmo->get_handle_name(_edit.gizmo_handle);
|
||||||
set_message(n + ": " + String(v));
|
set_message(n + ": " + String(v));
|
||||||
|
|
||||||
} else if (m->get_button_mask() & BUTTON_MASK_LEFT) {
|
} else if (m->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
|
if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
|
||||||
nav_mode = NAVIGATION_ORBIT;
|
nav_mode = NAVIGATION_ORBIT;
|
||||||
} else if (nav_scheme == NAVIGATION_MODO && m->get_alt() && m->get_shift()) {
|
} else if (nav_scheme == NAVIGATION_MODO && m->get_alt() && m->get_shift()) {
|
||||||
|
|
@ -1830,8 +1828,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if ((m->get_button_mask() & MOUSE_BUTTON_MASK_RIGHT) || freelook_active) {
|
||||||
} else if ((m->get_button_mask() & BUTTON_MASK_RIGHT) || freelook_active) {
|
|
||||||
if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
|
if (nav_scheme == NAVIGATION_MAYA && m->get_alt()) {
|
||||||
nav_mode = NAVIGATION_ZOOM;
|
nav_mode = NAVIGATION_ZOOM;
|
||||||
} else if (freelook_active) {
|
} else if (freelook_active) {
|
||||||
|
|
@ -1840,7 +1837,7 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||||
nav_mode = NAVIGATION_PAN;
|
nav_mode = NAVIGATION_PAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (m->get_button_mask() & BUTTON_MASK_MIDDLE) {
|
} else if (m->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
|
||||||
const int mod = _get_key_modifier(m);
|
const int mod = _get_key_modifier(m);
|
||||||
if (nav_scheme == NAVIGATION_GODOT) {
|
if (nav_scheme == NAVIGATION_GODOT) {
|
||||||
if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
|
if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
|
||||||
|
|
@ -1851,13 +1848,11 @@ void Node3DEditorViewport::_sinput(const Ref<InputEvent> &p_event) {
|
||||||
// Always allow Alt as a modifier to better support graphic tablets.
|
// Always allow Alt as a modifier to better support graphic tablets.
|
||||||
nav_mode = NAVIGATION_ORBIT;
|
nav_mode = NAVIGATION_ORBIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (nav_scheme == NAVIGATION_MAYA) {
|
} else if (nav_scheme == NAVIGATION_MAYA) {
|
||||||
if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
|
if (mod == _get_key_modifier_setting("editors/3d/navigation/pan_modifier")) {
|
||||||
nav_mode = NAVIGATION_PAN;
|
nav_mode = NAVIGATION_PAN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_3_button_mouse")) {
|
} else if (EditorSettings::get_singleton()->get("editors/3d/navigation/emulate_3_button_mouse")) {
|
||||||
// Handle trackpad (no external mouse) use case
|
// Handle trackpad (no external mouse) use case
|
||||||
const int mod = _get_key_modifier(m);
|
const int mod = _get_key_modifier(m);
|
||||||
|
|
@ -4199,7 +4194,7 @@ Node3DEditorViewport::~Node3DEditorViewport() {
|
||||||
void Node3DEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event) {
|
void Node3DEditorViewportContainer::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
Vector2 size = get_size();
|
Vector2 size = get_size();
|
||||||
|
|
||||||
|
|
@ -6611,7 +6606,7 @@ void Node3DEditor::_update_preview_environment() {
|
||||||
|
|
||||||
void Node3DEditor::_sun_direction_input(const Ref<InputEvent> &p_event) {
|
void Node3DEditor::_sun_direction_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
float x = -mm->get_relative().y * 0.02 * EDSCALE;
|
float x = -mm->get_relative().y * 0.02 * EDSCALE;
|
||||||
float y = mm->get_relative().x * 0.02 * EDSCALE;
|
float y = mm->get_relative().x * 0.02 * EDSCALE;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
real_t dist_to_p_in = gpoint.distance_to(xform.xform(curve->get_point_position(i) + curve->get_point_in(i)));
|
real_t dist_to_p_in = gpoint.distance_to(xform.xform(curve->get_point_position(i) + curve->get_point_in(i)));
|
||||||
|
|
||||||
// Check for point movement start (for point + in/out controls).
|
// Check for point movement start (for point + in/out controls).
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mode == MODE_EDIT && !mb->get_shift() && dist_to_p < grab_threshold) {
|
if (mode == MODE_EDIT && !mb->get_shift() && dist_to_p < grab_threshold) {
|
||||||
// Points can only be moved in edit mode.
|
// Points can only be moved in edit mode.
|
||||||
|
|
||||||
|
|
@ -118,7 +118,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for point deletion.
|
// Check for point deletion.
|
||||||
if ((mb->get_button_index() == BUTTON_RIGHT && mode == MODE_EDIT) || (mb->get_button_index() == BUTTON_LEFT && mode == MODE_DELETE)) {
|
if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT && mode == MODE_EDIT) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && mode == MODE_DELETE)) {
|
||||||
if (dist_to_p < grab_threshold) {
|
if (dist_to_p < grab_threshold) {
|
||||||
undo_redo->create_action(TTR("Remove Point from Curve"));
|
undo_redo->create_action(TTR("Remove Point from Curve"));
|
||||||
undo_redo->add_do_method(curve.ptr(), "remove_point", i);
|
undo_redo->add_do_method(curve.ptr(), "remove_point", i);
|
||||||
|
|
@ -149,7 +149,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for point creation.
|
// Check for point creation.
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && ((mb->get_command() && mode == MODE_EDIT) || mode == MODE_CREATE)) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && ((mb->get_command() && mode == MODE_EDIT) || mode == MODE_CREATE)) {
|
||||||
Ref<Curve2D> curve = node->get_curve();
|
Ref<Curve2D> curve = node->get_curve();
|
||||||
|
|
||||||
undo_redo->create_action(TTR("Add Point to Curve"));
|
undo_redo->create_action(TTR("Add Point to Curve"));
|
||||||
|
|
@ -170,7 +170,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for segment split.
|
// Check for segment split.
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && mode == MODE_EDIT && on_edge) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mode == MODE_EDIT && on_edge) {
|
||||||
Vector2 gpoint2 = mb->get_position();
|
Vector2 gpoint2 = mb->get_position();
|
||||||
Ref<Curve2D> curve = node->get_curve();
|
Ref<Curve2D> curve = node->get_curve();
|
||||||
|
|
||||||
|
|
@ -207,7 +207,7 @@ bool Path2DEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for point movement completion.
|
// Check for point movement completion.
|
||||||
if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && action != ACTION_NONE) {
|
if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && action != ACTION_NONE) {
|
||||||
Ref<Curve2D> curve = node->get_curve();
|
Ref<Curve2D> curve = node->get_curve();
|
||||||
|
|
||||||
Vector2 new_pos = moving_from + xform.affine_inverse().basis_xform(gpoint - moving_screen_from);
|
Vector2 new_pos = moving_from + xform.affine_inverse().basis_xform(gpoint - moving_screen_from);
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,7 @@ bool Path3DEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref
|
||||||
set_handle_clicked(false);
|
set_handle_clicked(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && (curve_create->is_pressed() || (curve_edit->is_pressed() && mb->get_control()))) {
|
||||||
//click into curve, break it down
|
//click into curve, break it down
|
||||||
Vector<Vector3> v3a = c->tessellate();
|
Vector<Vector3> v3a = c->tessellate();
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
@ -411,7 +411,7 @@ bool Path3DEditorPlugin::forward_spatial_gui_input(Camera3D *p_camera, const Ref
|
||||||
//add new at pos
|
//add new at pos
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (mb->is_pressed() && ((mb->get_button_index() == BUTTON_LEFT && curve_del->is_pressed()) || (mb->get_button_index() == BUTTON_RIGHT && curve_edit->is_pressed()))) {
|
} else if (mb->is_pressed() && ((mb->get_button_index() == MOUSE_BUTTON_LEFT && curve_del->is_pressed()) || (mb->get_button_index() == MOUSE_BUTTON_RIGHT && curve_edit->is_pressed()))) {
|
||||||
for (int i = 0; i < c->get_point_count(); i++) {
|
for (int i = 0; i < c->get_point_count(); i++) {
|
||||||
real_t dist_to_p = p_camera->unproject_position(gt.xform(c->get_point_position(i))).distance_to(mbpos);
|
real_t dist_to_p = p_camera->unproject_position(gt.xform(c->get_point_position(i))).distance_to(mbpos);
|
||||||
real_t dist_to_p_out = p_camera->unproject_position(gt.xform(c->get_point_position(i) + c->get_point_out(i))).distance_to(mbpos);
|
real_t dist_to_p_out = p_camera->unproject_position(gt.xform(c->get_point_position(i) + c->get_point_out(i))).distance_to(mbpos);
|
||||||
|
|
|
||||||
|
|
@ -447,7 +447,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||||
Ref<InputEventMouseButton> mb = p_input;
|
Ref<InputEventMouseButton> mb = p_input;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
uv_drag_from = snap_point(Vector2(mb->get_position().x, mb->get_position().y));
|
uv_drag_from = snap_point(Vector2(mb->get_position().x, mb->get_position().y));
|
||||||
uv_drag = true;
|
uv_drag = true;
|
||||||
|
|
@ -759,7 +759,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||||
bone_painting = false;
|
bone_painting = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
|
||||||
_cancel_editing();
|
_cancel_editing();
|
||||||
|
|
||||||
if (bone_painting) {
|
if (bone_painting) {
|
||||||
|
|
@ -768,9 +768,9 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||||
|
|
||||||
uv_edit_draw->update();
|
uv_edit_draw->update();
|
||||||
|
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) {
|
||||||
uv_zoom->set_value(uv_zoom->get_value() / (1 - (0.1 * mb->get_factor())));
|
uv_zoom->set_value(uv_zoom->get_value() / (1 - (0.1 * mb->get_factor())));
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) {
|
||||||
uv_zoom->set_value(uv_zoom->get_value() * (1 - (0.1 * mb->get_factor())));
|
uv_zoom->set_value(uv_zoom->get_value() * (1 - (0.1 * mb->get_factor())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -778,7 +778,7 @@ void Polygon2DEditor::_uv_input(const Ref<InputEvent> &p_input) {
|
||||||
Ref<InputEventMouseMotion> mm = p_input;
|
Ref<InputEventMouseMotion> mm = p_input;
|
||||||
|
|
||||||
if (mm.is_valid()) {
|
if (mm.is_valid()) {
|
||||||
if ((mm->get_button_mask() & BUTTON_MASK_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
|
if ((mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
|
||||||
Vector2 drag(mm->get_relative().x, mm->get_relative().y);
|
Vector2 drag(mm->get_relative().x, mm->get_relative().y);
|
||||||
uv_hscroll->set_value(uv_hscroll->get_value() - drag.x);
|
uv_hscroll->set_value(uv_hscroll->get_value() - drag.x);
|
||||||
uv_vscroll->set_value(uv_vscroll->get_value() - drag.y);
|
uv_vscroll->set_value(uv_vscroll->get_value() - drag.y);
|
||||||
|
|
|
||||||
|
|
@ -2737,7 +2737,7 @@ void ScriptEditor::_script_list_gui_input(const Ref<InputEvent> &ev) {
|
||||||
Ref<InputEventMouseButton> mb = ev;
|
Ref<InputEventMouseButton> mb = ev;
|
||||||
if (mb.is_valid() && mb->is_pressed()) {
|
if (mb.is_valid() && mb->is_pressed()) {
|
||||||
switch (mb->get_button_index()) {
|
switch (mb->get_button_index()) {
|
||||||
case BUTTON_MIDDLE: {
|
case MOUSE_BUTTON_MIDDLE: {
|
||||||
// Right-click selects automatically; middle-click does not.
|
// Right-click selects automatically; middle-click does not.
|
||||||
int idx = script_list->get_item_at_position(mb->get_position(), true);
|
int idx = script_list->get_item_at_position(mb->get_position(), true);
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
|
|
@ -2747,7 +2747,7 @@ void ScriptEditor::_script_list_gui_input(const Ref<InputEvent> &ev) {
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case BUTTON_RIGHT: {
|
case MOUSE_BUTTON_RIGHT: {
|
||||||
_make_script_list_context_menu();
|
_make_script_list_context_menu();
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1517,7 +1517,7 @@ void ScriptTextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
|
||||||
bool create_menu = false;
|
bool create_menu = false;
|
||||||
|
|
||||||
CodeEdit *tx = code_editor->get_text_editor();
|
CodeEdit *tx = code_editor->get_text_editor();
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
|
||||||
local_pos = mb->get_global_position() - tx->get_global_position();
|
local_pos = mb->get_global_position() - tx->get_global_position();
|
||||||
create_menu = true;
|
create_menu = true;
|
||||||
} else if (k.is_valid() && k->get_keycode() == KEY_MENU) {
|
} else if (k.is_valid() && k->get_keycode() == KEY_MENU) {
|
||||||
|
|
|
||||||
|
|
@ -460,7 +460,7 @@ void ShaderEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
|
||||||
Ref<InputEventMouseButton> mb = ev;
|
Ref<InputEventMouseButton> mb = ev;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
|
||||||
int col, row;
|
int col, row;
|
||||||
CodeEdit *tx = shader_editor->get_text_editor();
|
CodeEdit *tx = shader_editor->get_text_editor();
|
||||||
tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
|
tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ void SpriteFramesEditor::_sheet_preview_draw() {
|
||||||
void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) {
|
void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Size2i size = split_sheet_preview->get_size();
|
Size2i size = split_sheet_preview->get_size();
|
||||||
int h = split_sheet_h->get_value();
|
int h = split_sheet_h->get_value();
|
||||||
int v = split_sheet_v->get_value();
|
int v = split_sheet_v->get_value();
|
||||||
|
|
@ -150,11 +150,11 @@ void SpriteFramesEditor::_sheet_scroll_input(const Ref<InputEvent> &p_event) {
|
||||||
// Zoom in/out using Ctrl + mouse wheel. This is done on the ScrollContainer
|
// Zoom in/out using Ctrl + mouse wheel. This is done on the ScrollContainer
|
||||||
// to allow performing this action anywhere, even if the cursor isn't
|
// to allow performing this action anywhere, even if the cursor isn't
|
||||||
// hovering the texture in the workspace.
|
// hovering the texture in the workspace.
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) {
|
||||||
_sheet_zoom_in();
|
_sheet_zoom_in();
|
||||||
// Don't scroll up after zooming in.
|
// Don't scroll up after zooming in.
|
||||||
accept_event();
|
accept_event();
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) {
|
||||||
_sheet_zoom_out();
|
_sheet_zoom_out();
|
||||||
// Don't scroll down after zooming out.
|
// Don't scroll down after zooming out.
|
||||||
accept_event();
|
accept_event();
|
||||||
|
|
@ -694,11 +694,11 @@ void SpriteFramesEditor::_tree_input(const Ref<InputEvent> &p_event) {
|
||||||
const Ref<InputEventMouseButton> mb = p_event;
|
const Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) {
|
||||||
_zoom_in();
|
_zoom_in();
|
||||||
// Don't scroll up after zooming in.
|
// Don't scroll up after zooming in.
|
||||||
accept_event();
|
accept_event();
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) {
|
||||||
_zoom_out();
|
_zoom_out();
|
||||||
// Don't scroll down after zooming out.
|
// Don't scroll down after zooming out.
|
||||||
accept_event();
|
accept_event();
|
||||||
|
|
|
||||||
|
|
@ -469,7 +469,7 @@ void TextEditor::_text_edit_gui_input(const Ref<InputEvent> &ev) {
|
||||||
Ref<InputEventMouseButton> mb = ev;
|
Ref<InputEventMouseButton> mb = ev;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_RIGHT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
int col, row;
|
int col, row;
|
||||||
CodeEdit *tx = code_editor->get_text_editor();
|
CodeEdit *tx = code_editor->get_text_editor();
|
||||||
tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
|
tx->_get_mouse_pos(mb->get_global_position() - tx->get_global_position(), row, col);
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
void TextureLayeredEditor::_gui_input(Ref<InputEvent> p_event) {
|
void TextureLayeredEditor::_gui_input(Ref<InputEvent> p_event) {
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
y_rot += -mm->get_relative().x * 0.01;
|
y_rot += -mm->get_relative().x * 0.01;
|
||||||
x_rot += mm->get_relative().y * 0.01;
|
x_rot += mm->get_relative().y * 0.01;
|
||||||
_update_material();
|
_update_material();
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_input;
|
Ref<InputEventMouseButton> mb = p_input;
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
if (node_ninepatch || obj_styleBox.is_valid()) {
|
if (node_ninepatch || obj_styleBox.is_valid()) {
|
||||||
edited_margin = -1;
|
edited_margin = -1;
|
||||||
|
|
@ -447,7 +447,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
|
||||||
creating = false;
|
creating = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (mb->get_button_index() == BUTTON_RIGHT && mb->is_pressed()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && mb->is_pressed()) {
|
||||||
if (drag) {
|
if (drag) {
|
||||||
drag = false;
|
drag = false;
|
||||||
if (edited_margin >= 0) {
|
if (edited_margin >= 0) {
|
||||||
|
|
@ -466,9 +466,9 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
|
||||||
drag_index = -1;
|
drag_index = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) {
|
||||||
_zoom_on_position(draw_zoom * ((0.95 + (0.05 * mb->get_factor())) / 0.95), mb->get_position());
|
_zoom_on_position(draw_zoom * ((0.95 + (0.05 * mb->get_factor())) / 0.95), mb->get_position());
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) {
|
||||||
_zoom_on_position(draw_zoom * (1 - (0.05 * mb->get_factor())), mb->get_position());
|
_zoom_on_position(draw_zoom * (1 - (0.05 * mb->get_factor())), mb->get_position());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -476,7 +476,7 @@ void TextureRegionEditor::_region_input(const Ref<InputEvent> &p_input) {
|
||||||
Ref<InputEventMouseMotion> mm = p_input;
|
Ref<InputEventMouseMotion> mm = p_input;
|
||||||
|
|
||||||
if (mm.is_valid()) {
|
if (mm.is_valid()) {
|
||||||
if (mm->get_button_mask() & BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
|
if (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE || Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
|
||||||
Vector2 dragged(mm->get_relative().x / draw_zoom, mm->get_relative().y / draw_zoom);
|
Vector2 dragged(mm->get_relative().x / draw_zoom, mm->get_relative().y / draw_zoom);
|
||||||
hscroll->set_value(hscroll->get_value() - dragged.x);
|
hscroll->set_value(hscroll->get_value() - dragged.x);
|
||||||
vscroll->set_value(vscroll->get_value() - dragged.y);
|
vscroll->set_value(vscroll->get_value() - dragged.y);
|
||||||
|
|
|
||||||
|
|
@ -233,11 +233,11 @@ void TileMapEditor::_palette_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
// Zoom in/out using Ctrl + mouse wheel.
|
// Zoom in/out using Ctrl + mouse wheel.
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_command()) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_command()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
size_slider->set_value(size_slider->get_value() + 0.2);
|
size_slider->set_value(size_slider->get_value() + 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
size_slider->set_value(size_slider->get_value() - 0.2);
|
size_slider->set_value(size_slider->get_value() - 0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1027,7 +1027,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
if (Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
|
if (Input::get_singleton()->is_key_pressed(KEY_SPACE)) {
|
||||||
return false; // Drag.
|
return false; // Drag.
|
||||||
|
|
@ -1177,7 +1177,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mb->get_button_index() == BUTTON_RIGHT) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
if (tool == TOOL_SELECTING || selection_active) {
|
if (tool == TOOL_SELECTING || selection_active) {
|
||||||
tool = TOOL_NONE;
|
tool = TOOL_NONE;
|
||||||
|
|
@ -1462,7 +1462,7 @@ bool TileMapEditor::forward_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
|
if (tool == TOOL_PICKING && Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT)) {
|
||||||
_pick_tile(over_tile);
|
_pick_tile(over_tile);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -1246,12 +1246,12 @@ void TileSetEditor::_on_scroll_container_input(const Ref<InputEvent> &p_event) {
|
||||||
// Zoom in/out using Ctrl + mouse wheel. This is done on the ScrollContainer
|
// Zoom in/out using Ctrl + mouse wheel. This is done on the ScrollContainer
|
||||||
// to allow performing this action anywhere, even if the cursor isn't
|
// to allow performing this action anywhere, even if the cursor isn't
|
||||||
// hovering the texture in the workspace.
|
// hovering the texture in the workspace.
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed() && mb->get_control()) {
|
||||||
print_line("zooming in");
|
print_line("zooming in");
|
||||||
_zoom_in();
|
_zoom_in();
|
||||||
// Don't scroll up after zooming in.
|
// Don't scroll up after zooming in.
|
||||||
accept_event();
|
accept_event();
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed() && mb->get_control()) {
|
||||||
print_line("zooming out");
|
print_line("zooming out");
|
||||||
_zoom_out();
|
_zoom_out();
|
||||||
// Don't scroll down after zooming out.
|
// Don't scroll down after zooming out.
|
||||||
|
|
@ -1280,7 +1280,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
const Ref<InputEventMouseMotion> mm = p_ie;
|
const Ref<InputEventMouseMotion> mm = p_ie;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && !creating_shape) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !creating_shape) {
|
||||||
if (!current_tile_region.has_point(mb->get_position())) {
|
if (!current_tile_region.has_point(mb->get_position())) {
|
||||||
List<int> *tiles = new List<int>();
|
List<int> *tiles = new List<int>();
|
||||||
tileset->get_tile_list(tiles);
|
tileset->get_tile_list(tiles);
|
||||||
|
|
@ -1304,7 +1304,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
}
|
}
|
||||||
// Drag Middle Mouse
|
// Drag Middle Mouse
|
||||||
if (mm.is_valid()) {
|
if (mm.is_valid()) {
|
||||||
if (mm->get_button_mask() & BUTTON_MASK_MIDDLE) {
|
if (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE) {
|
||||||
Vector2 dragged(mm->get_relative().x, mm->get_relative().y);
|
Vector2 dragged(mm->get_relative().x, mm->get_relative().y);
|
||||||
scroll->set_h_scroll(scroll->get_h_scroll() - dragged.x * workspace->get_scale().x);
|
scroll->set_h_scroll(scroll->get_h_scroll() - dragged.x * workspace->get_scale().x);
|
||||||
scroll->set_v_scroll(scroll->get_v_scroll() - dragged.y * workspace->get_scale().x);
|
scroll->set_v_scroll(scroll->get_v_scroll() - dragged.y * workspace->get_scale().x);
|
||||||
|
|
@ -1313,7 +1313,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
|
|
||||||
if (edit_mode == EDITMODE_REGION) {
|
if (edit_mode == EDITMODE_REGION) {
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (get_current_tile() >= 0 || workspace_mode != WORKSPACE_EDIT) {
|
if (get_current_tile() >= 0 || workspace_mode != WORKSPACE_EDIT) {
|
||||||
dragging = true;
|
dragging = true;
|
||||||
region_from = mb->get_position();
|
region_from = mb->get_position();
|
||||||
|
|
@ -1322,13 +1322,13 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
workspace_overlay->update();
|
workspace_overlay->update();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (dragging && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
} else if (dragging && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
dragging = false;
|
dragging = false;
|
||||||
edited_region = Rect2();
|
edited_region = Rect2();
|
||||||
workspace->update();
|
workspace->update();
|
||||||
workspace_overlay->update();
|
workspace_overlay->update();
|
||||||
return;
|
return;
|
||||||
} else if (dragging && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
} else if (dragging && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
dragging = false;
|
dragging = false;
|
||||||
update_edited_region(mb->get_position());
|
update_edited_region(mb->get_position());
|
||||||
edited_region.position -= WORKSPACE_MARGIN;
|
edited_region.position -= WORKSPACE_MARGIN;
|
||||||
|
|
@ -1428,7 +1428,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
switch (edit_mode) {
|
switch (edit_mode) {
|
||||||
case EDITMODE_ICON: {
|
case EDITMODE_ICON: {
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT && current_tile_region.has_point(mb->get_position())) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT && current_tile_region.has_point(mb->get_position())) {
|
||||||
Vector2 coord((int)((mb->get_position().x - current_tile_region.position.x) / (spacing + size.x)), (int)((mb->get_position().y - current_tile_region.position.y) / (spacing + size.y)));
|
Vector2 coord((int)((mb->get_position().x - current_tile_region.position.x) / (spacing + size.x)), (int)((mb->get_position().y - current_tile_region.position.y) / (spacing + size.y)));
|
||||||
undo_redo->create_action(TTR("Set Tile Icon"));
|
undo_redo->create_action(TTR("Set Tile Icon"));
|
||||||
undo_redo->add_do_method(tileset.ptr(), "autotile_set_icon_coordinate", get_current_tile(), coord);
|
undo_redo->add_do_method(tileset.ptr(), "autotile_set_icon_coordinate", get_current_tile(), coord);
|
||||||
|
|
@ -1445,9 +1445,9 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
if (dragging) {
|
if (dragging) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((mb->get_button_index() == BUTTON_RIGHT || mb->get_button_index() == BUTTON_LEFT) && current_tile_region.has_point(mb->get_position())) {
|
if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT || mb->get_button_index() == MOUSE_BUTTON_LEFT) && current_tile_region.has_point(mb->get_position())) {
|
||||||
dragging = true;
|
dragging = true;
|
||||||
erasing = (mb->get_button_index() == BUTTON_RIGHT);
|
erasing = (mb->get_button_index() == MOUSE_BUTTON_RIGHT);
|
||||||
alternative = Input::get_singleton()->is_key_pressed(KEY_SHIFT);
|
alternative = Input::get_singleton()->is_key_pressed(KEY_SHIFT);
|
||||||
Vector2 coord((int)((mb->get_position().x - current_tile_region.position.x) / (spacing + size.x)), (int)((mb->get_position().y - current_tile_region.position.y) / (spacing + size.y)));
|
Vector2 coord((int)((mb->get_position().x - current_tile_region.position.x) / (spacing + size.x)), (int)((mb->get_position().y - current_tile_region.position.y) / (spacing + size.y)));
|
||||||
Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
|
Vector2 pos(coord.x * (spacing + size.x), coord.y * (spacing + size.y));
|
||||||
|
|
@ -1518,7 +1518,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((erasing && mb->get_button_index() == BUTTON_RIGHT) || (!erasing && mb->get_button_index() == BUTTON_LEFT)) {
|
if ((erasing && mb->get_button_index() == MOUSE_BUTTON_RIGHT) || (!erasing && mb->get_button_index() == MOUSE_BUTTON_LEFT)) {
|
||||||
dragging = false;
|
dragging = false;
|
||||||
erasing = false;
|
erasing = false;
|
||||||
alternative = false;
|
alternative = false;
|
||||||
|
|
@ -1612,7 +1612,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
shape_anchor += current_tile_region.position;
|
shape_anchor += current_tile_region.position;
|
||||||
if (tools[TOOL_SELECT]->is_pressed()) {
|
if (tools[TOOL_SELECT]->is_pressed()) {
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (edit_mode != EDITMODE_PRIORITY && current_shape.size() > 0) {
|
if (edit_mode != EDITMODE_PRIORITY && current_shape.size() > 0) {
|
||||||
int grabbed_point = get_grabbed_point(mb->get_position(), grab_threshold);
|
int grabbed_point = get_grabbed_point(mb->get_position(), grab_threshold);
|
||||||
|
|
||||||
|
|
@ -1630,7 +1630,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
workspace->update();
|
workspace->update();
|
||||||
} else if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
} else if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (edit_mode == EDITMODE_COLLISION) {
|
if (edit_mode == EDITMODE_COLLISION) {
|
||||||
if (dragging_point >= 0) {
|
if (dragging_point >= 0) {
|
||||||
dragging_point = -1;
|
dragging_point = -1;
|
||||||
|
|
@ -1705,7 +1705,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
}
|
}
|
||||||
} else if (tools[SHAPE_NEW_POLYGON]->is_pressed()) {
|
} else if (tools[SHAPE_NEW_POLYGON]->is_pressed()) {
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Vector2 pos = mb->get_position();
|
Vector2 pos = mb->get_position();
|
||||||
pos = snap_point(pos);
|
pos = snap_point(pos);
|
||||||
if (creating_shape) {
|
if (creating_shape) {
|
||||||
|
|
@ -1725,7 +1725,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
current_shape.push_back(snap_point(pos));
|
current_shape.push_back(snap_point(pos));
|
||||||
workspace->update();
|
workspace->update();
|
||||||
}
|
}
|
||||||
} else if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
} else if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
if (creating_shape) {
|
if (creating_shape) {
|
||||||
creating_shape = false;
|
creating_shape = false;
|
||||||
_select_edited_shape_coord();
|
_select_edited_shape_coord();
|
||||||
|
|
@ -1739,7 +1739,7 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
}
|
}
|
||||||
} else if (tools[SHAPE_NEW_RECTANGLE]->is_pressed()) {
|
} else if (tools[SHAPE_NEW_RECTANGLE]->is_pressed()) {
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
_set_edited_collision_shape(Ref<ConvexPolygonShape2D>());
|
_set_edited_collision_shape(Ref<ConvexPolygonShape2D>());
|
||||||
current_shape.resize(0);
|
current_shape.resize(0);
|
||||||
Vector2 pos = mb->get_position();
|
Vector2 pos = mb->get_position();
|
||||||
|
|
@ -1751,13 +1751,13 @@ void TileSetEditor::_on_workspace_input(const Ref<InputEvent> &p_ie) {
|
||||||
creating_shape = true;
|
creating_shape = true;
|
||||||
workspace->update();
|
workspace->update();
|
||||||
return;
|
return;
|
||||||
} else if (mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
} else if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
if (creating_shape) {
|
if (creating_shape) {
|
||||||
creating_shape = false;
|
creating_shape = false;
|
||||||
_select_edited_shape_coord();
|
_select_edited_shape_coord();
|
||||||
workspace->update();
|
workspace->update();
|
||||||
}
|
}
|
||||||
} else if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
} else if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (creating_shape) {
|
if (creating_shape) {
|
||||||
// if the first two corners are within grabbing distance of one another, expand the rect to fill the tile
|
// if the first two corners are within grabbing distance of one another, expand the rect to fill the tile
|
||||||
if (is_within_grabbing_distance_of_first_point(current_shape[1], grab_threshold)) {
|
if (is_within_grabbing_distance_of_first_point(current_shape[1], grab_threshold)) {
|
||||||
|
|
|
||||||
|
|
@ -2504,7 +2504,7 @@ void VisualShaderEditor::_graph_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
VisualShader::Type type = get_current_shader_type();
|
VisualShader::Type type = get_current_shader_type();
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_RIGHT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
selected_constants.clear();
|
selected_constants.clear();
|
||||||
selected_uniforms.clear();
|
selected_uniforms.clear();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1741,7 +1741,7 @@ void ProjectList::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
|
||||||
int clicked_index = p_hb->get_index();
|
int clicked_index = p_hb->get_index();
|
||||||
const Item &clicked_project = _projects[clicked_index];
|
const Item &clicked_project = _projects[clicked_index];
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->get_shift() && _selected_project_keys.size() > 0 && _last_clicked != "" && clicked_project.project_key != _last_clicked) {
|
if (mb->get_shift() && _selected_project_keys.size() > 0 && _last_clicked != "" && clicked_project.project_key != _last_clicked) {
|
||||||
int anchor_index = -1;
|
int anchor_index = -1;
|
||||||
for (int i = 0; i < _projects.size(); ++i) {
|
for (int i = 0; i < _projects.size(); ++i) {
|
||||||
|
|
|
||||||
|
|
@ -1353,7 +1353,7 @@ void CustomPropertyEditor::_action_pressed(int p_which) {
|
||||||
void CustomPropertyEditor::_drag_easing(const Ref<InputEvent> &p_ev) {
|
void CustomPropertyEditor::_drag_easing(const Ref<InputEvent> &p_ev) {
|
||||||
Ref<InputEventMouseMotion> mm = p_ev;
|
Ref<InputEventMouseMotion> mm = p_ev;
|
||||||
|
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
float rel = mm->get_relative().x;
|
float rel = mm->get_relative().x;
|
||||||
if (rel == 0) {
|
if (rel == 0) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ void SceneTreeDock::_quick_open() {
|
||||||
void SceneTreeDock::_input(Ref<InputEvent> p_event) {
|
void SceneTreeDock::_input(Ref<InputEvent> p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
restore_script_editor_on_drag = false; //lost chance
|
restore_script_editor_on_drag = false; //lost chance
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -615,13 +615,13 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_UP && (mb->get_command() || mb->get_shift())) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && (mb->get_command() || mb->get_shift())) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
floor->set_value(floor->get_value() + mb->get_factor());
|
floor->set_value(floor->get_value() + mb->get_factor());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true; // Eaten.
|
return true; // Eaten.
|
||||||
} else if (mb->get_button_index() == BUTTON_WHEEL_DOWN && (mb->get_command() || mb->get_shift())) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && (mb->get_command() || mb->get_shift())) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
floor->set_value(floor->get_value() - mb->get_factor());
|
floor->set_value(floor->get_value() - mb->get_factor());
|
||||||
}
|
}
|
||||||
|
|
@ -632,7 +632,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
|
||||||
Node3DEditorViewport::NavigationScheme nav_scheme = (Node3DEditorViewport::NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
|
Node3DEditorViewport::NavigationScheme nav_scheme = (Node3DEditorViewport::NavigationScheme)EditorSettings::get_singleton()->get("editors/3d/navigation/navigation_scheme").operator int();
|
||||||
if ((nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA || nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) && mb->get_alt()) {
|
if ((nav_scheme == Node3DEditorViewport::NAVIGATION_MAYA || nav_scheme == Node3DEditorViewport::NAVIGATION_MODO) && mb->get_alt()) {
|
||||||
input_action = INPUT_NONE;
|
input_action = INPUT_NONE;
|
||||||
} else if (mb->get_button_index() == BUTTON_LEFT) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
bool can_edit = (node && node->get_mesh_library().is_valid());
|
bool can_edit = (node && node->get_mesh_library().is_valid());
|
||||||
if (input_action == INPUT_PASTE) {
|
if (input_action == INPUT_PASTE) {
|
||||||
_do_paste();
|
_do_paste();
|
||||||
|
|
@ -647,7 +647,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
|
||||||
input_action = INPUT_PAINT;
|
input_action = INPUT_PAINT;
|
||||||
set_items.clear();
|
set_items.clear();
|
||||||
}
|
}
|
||||||
} else if (mb->get_button_index() == BUTTON_RIGHT) {
|
} else if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
if (input_action == INPUT_PASTE) {
|
if (input_action == INPUT_PASTE) {
|
||||||
_clear_clipboard_data();
|
_clear_clipboard_data();
|
||||||
input_action = INPUT_NONE;
|
input_action = INPUT_NONE;
|
||||||
|
|
@ -666,7 +666,7 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
|
||||||
|
|
||||||
return do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true);
|
return do_input_action(p_camera, Point2(mb->get_position().x, mb->get_position().y), true);
|
||||||
} else {
|
} else {
|
||||||
if ((mb->get_button_index() == BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == BUTTON_LEFT && input_action == INPUT_PAINT)) {
|
if ((mb->get_button_index() == MOUSE_BUTTON_RIGHT && input_action == INPUT_ERASE) || (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_PAINT)) {
|
||||||
if (set_items.size()) {
|
if (set_items.size()) {
|
||||||
undo_redo->create_action(TTR("GridMap Paint"));
|
undo_redo->create_action(TTR("GridMap Paint"));
|
||||||
for (List<SetItem>::Element *E = set_items.front(); E; E = E->next()) {
|
for (List<SetItem>::Element *E = set_items.front(); E; E = E->next()) {
|
||||||
|
|
@ -685,19 +685,19 @@ bool GridMapEditor::forward_spatial_input_event(Camera3D *p_camera, const Ref<In
|
||||||
return set_items.size() > 0;
|
return set_items.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_LEFT && input_action == INPUT_SELECT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action == INPUT_SELECT) {
|
||||||
undo_redo->create_action("GridMap Selection");
|
undo_redo->create_action("GridMap Selection");
|
||||||
undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end);
|
undo_redo->add_do_method(this, "_set_selection", selection.active, selection.begin, selection.end);
|
||||||
undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end);
|
undo_redo->add_undo_method(this, "_set_selection", last_selection.active, last_selection.begin, last_selection.end);
|
||||||
undo_redo->commit_action();
|
undo_redo->commit_action();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_LEFT && input_action != INPUT_NONE) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT && input_action != INPUT_NONE) {
|
||||||
set_items.clear();
|
set_items.clear();
|
||||||
input_action = INPUT_NONE;
|
input_action = INPUT_NONE;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (mb->get_button_index() == BUTTON_RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_PASTE)) {
|
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && (input_action == INPUT_ERASE || input_action == INPUT_PASTE)) {
|
||||||
input_action = INPUT_NONE;
|
input_action = INPUT_NONE;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -811,11 +811,11 @@ void GridMapEditor::_mesh_library_palette_input(const Ref<InputEvent> &p_ie) {
|
||||||
|
|
||||||
// Zoom in/out using Ctrl + mouse wheel
|
// Zoom in/out using Ctrl + mouse wheel
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_command()) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_command()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
size_slider->set_value(size_slider->get_value() + 0.2);
|
size_slider->set_value(size_slider->get_value() + 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
size_slider->set_value(size_slider->get_value() - 0.2);
|
size_slider->set_value(size_slider->get_value() - 0.2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1837,7 +1837,7 @@ void VisualScriptEditor::_input(const Ref<InputEvent> &p_event) {
|
||||||
void VisualScriptEditor::_graph_gui_input(const Ref<InputEvent> &p_event) {
|
void VisualScriptEditor::_graph_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> key = p_event;
|
Ref<InputEventMouseButton> key = p_event;
|
||||||
|
|
||||||
if (key.is_valid() && key->is_pressed() && key->get_button_mask() == BUTTON_RIGHT) {
|
if (key.is_valid() && key->is_pressed() && key->get_button_mask() == MOUSE_BUTTON_RIGHT) {
|
||||||
saved_position = graph->get_local_mouse_position();
|
saved_position = graph->get_local_mouse_position();
|
||||||
|
|
||||||
Point2 gpos = Input::get_singleton()->get_mouse_position();
|
Point2 gpos = Input::get_singleton()->get_mouse_position();
|
||||||
|
|
|
||||||
|
|
@ -741,15 +741,15 @@ void DisplayServerAndroid::process_mouse_event(int input_device, int event_actio
|
||||||
ev->set_pressed(true);
|
ev->set_pressed(true);
|
||||||
buttons_state = event_buttons_mask;
|
buttons_state = event_buttons_mask;
|
||||||
if (event_vertical_factor > 0) {
|
if (event_vertical_factor > 0) {
|
||||||
_wheel_button_click(event_buttons_mask, ev, BUTTON_WHEEL_UP, event_vertical_factor);
|
_wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_UP, event_vertical_factor);
|
||||||
} else if (event_vertical_factor < 0) {
|
} else if (event_vertical_factor < 0) {
|
||||||
_wheel_button_click(event_buttons_mask, ev, BUTTON_WHEEL_DOWN, -event_vertical_factor);
|
_wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_DOWN, -event_vertical_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event_horizontal_factor > 0) {
|
if (event_horizontal_factor > 0) {
|
||||||
_wheel_button_click(event_buttons_mask, ev, BUTTON_WHEEL_RIGHT, event_horizontal_factor);
|
_wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_RIGHT, event_horizontal_factor);
|
||||||
} else if (event_horizontal_factor < 0) {
|
} else if (event_horizontal_factor < 0) {
|
||||||
_wheel_button_click(event_buttons_mask, ev, BUTTON_WHEEL_LEFT, -event_horizontal_factor);
|
_wheel_button_click(event_buttons_mask, ev, MOUSE_BUTTON_WHEEL_LEFT, -event_horizontal_factor);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
@ -784,16 +784,16 @@ void DisplayServerAndroid::process_double_tap(int event_android_button_mask, Poi
|
||||||
|
|
||||||
int DisplayServerAndroid::_button_index_from_mask(int button_mask) {
|
int DisplayServerAndroid::_button_index_from_mask(int button_mask) {
|
||||||
switch (button_mask) {
|
switch (button_mask) {
|
||||||
case BUTTON_MASK_LEFT:
|
case MOUSE_BUTTON_MASK_LEFT:
|
||||||
return BUTTON_LEFT;
|
return MOUSE_BUTTON_LEFT;
|
||||||
case BUTTON_MASK_RIGHT:
|
case MOUSE_BUTTON_MASK_RIGHT:
|
||||||
return BUTTON_RIGHT;
|
return MOUSE_BUTTON_RIGHT;
|
||||||
case BUTTON_MASK_MIDDLE:
|
case MOUSE_BUTTON_MASK_MIDDLE:
|
||||||
return BUTTON_MIDDLE;
|
return MOUSE_BUTTON_MIDDLE;
|
||||||
case BUTTON_MASK_XBUTTON1:
|
case MOUSE_BUTTON_MASK_XBUTTON1:
|
||||||
return BUTTON_XBUTTON1;
|
return MOUSE_BUTTON_XBUTTON1;
|
||||||
case BUTTON_MASK_XBUTTON2:
|
case MOUSE_BUTTON_MASK_XBUTTON2:
|
||||||
return BUTTON_XBUTTON2;
|
return MOUSE_BUTTON_XBUTTON2;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -854,19 +854,19 @@ int DisplayServerAndroid::mouse_get_button_state() const {
|
||||||
int DisplayServerAndroid::_android_button_mask_to_godot_button_mask(int android_button_mask) {
|
int DisplayServerAndroid::_android_button_mask_to_godot_button_mask(int android_button_mask) {
|
||||||
int godot_button_mask = 0;
|
int godot_button_mask = 0;
|
||||||
if (android_button_mask & AMOTION_EVENT_BUTTON_PRIMARY) {
|
if (android_button_mask & AMOTION_EVENT_BUTTON_PRIMARY) {
|
||||||
godot_button_mask |= BUTTON_MASK_LEFT;
|
godot_button_mask |= MOUSE_BUTTON_MASK_LEFT;
|
||||||
}
|
}
|
||||||
if (android_button_mask & AMOTION_EVENT_BUTTON_SECONDARY) {
|
if (android_button_mask & AMOTION_EVENT_BUTTON_SECONDARY) {
|
||||||
godot_button_mask |= BUTTON_MASK_RIGHT;
|
godot_button_mask |= MOUSE_BUTTON_MASK_RIGHT;
|
||||||
}
|
}
|
||||||
if (android_button_mask & AMOTION_EVENT_BUTTON_TERTIARY) {
|
if (android_button_mask & AMOTION_EVENT_BUTTON_TERTIARY) {
|
||||||
godot_button_mask |= BUTTON_MASK_MIDDLE;
|
godot_button_mask |= MOUSE_BUTTON_MASK_MIDDLE;
|
||||||
}
|
}
|
||||||
if (android_button_mask & AMOTION_EVENT_BUTTON_BACK) {
|
if (android_button_mask & AMOTION_EVENT_BUTTON_BACK) {
|
||||||
godot_button_mask |= BUTTON_MASK_XBUTTON1;
|
godot_button_mask |= MOUSE_BUTTON_MASK_XBUTTON1;
|
||||||
}
|
}
|
||||||
if (android_button_mask & AMOTION_EVENT_BUTTON_SECONDARY) {
|
if (android_button_mask & AMOTION_EVENT_BUTTON_SECONDARY) {
|
||||||
godot_button_mask |= BUTTON_MASK_XBUTTON2;
|
godot_button_mask |= MOUSE_BUTTON_MASK_XBUTTON2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return godot_button_mask;
|
return godot_button_mask;
|
||||||
|
|
|
||||||
|
|
@ -189,19 +189,19 @@ EM_BOOL DisplayServerJavaScript::mouse_button_callback(int p_event_type, const E
|
||||||
|
|
||||||
switch (p_event->button) {
|
switch (p_event->button) {
|
||||||
case DOM_BUTTON_LEFT:
|
case DOM_BUTTON_LEFT:
|
||||||
ev->set_button_index(BUTTON_LEFT);
|
ev->set_button_index(MOUSE_BUTTON_LEFT);
|
||||||
break;
|
break;
|
||||||
case DOM_BUTTON_MIDDLE:
|
case DOM_BUTTON_MIDDLE:
|
||||||
ev->set_button_index(BUTTON_MIDDLE);
|
ev->set_button_index(MOUSE_BUTTON_MIDDLE);
|
||||||
break;
|
break;
|
||||||
case DOM_BUTTON_RIGHT:
|
case DOM_BUTTON_RIGHT:
|
||||||
ev->set_button_index(BUTTON_RIGHT);
|
ev->set_button_index(MOUSE_BUTTON_RIGHT);
|
||||||
break;
|
break;
|
||||||
case DOM_BUTTON_XBUTTON1:
|
case DOM_BUTTON_XBUTTON1:
|
||||||
ev->set_button_index(BUTTON_XBUTTON1);
|
ev->set_button_index(MOUSE_BUTTON_XBUTTON1);
|
||||||
break;
|
break;
|
||||||
case DOM_BUTTON_XBUTTON2:
|
case DOM_BUTTON_XBUTTON2:
|
||||||
ev->set_button_index(BUTTON_XBUTTON2);
|
ev->set_button_index(MOUSE_BUTTON_XBUTTON2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -461,13 +461,13 @@ EM_BOOL DisplayServerJavaScript::wheel_callback(int p_event_type, const Emscript
|
||||||
ev->set_metakey(input->is_key_pressed(KEY_META));
|
ev->set_metakey(input->is_key_pressed(KEY_META));
|
||||||
|
|
||||||
if (p_event->deltaY < 0)
|
if (p_event->deltaY < 0)
|
||||||
ev->set_button_index(BUTTON_WHEEL_UP);
|
ev->set_button_index(MOUSE_BUTTON_WHEEL_UP);
|
||||||
else if (p_event->deltaY > 0)
|
else if (p_event->deltaY > 0)
|
||||||
ev->set_button_index(BUTTON_WHEEL_DOWN);
|
ev->set_button_index(MOUSE_BUTTON_WHEEL_DOWN);
|
||||||
else if (p_event->deltaX > 0)
|
else if (p_event->deltaX > 0)
|
||||||
ev->set_button_index(BUTTON_WHEEL_LEFT);
|
ev->set_button_index(MOUSE_BUTTON_WHEEL_LEFT);
|
||||||
else if (p_event->deltaX < 0)
|
else if (p_event->deltaX < 0)
|
||||||
ev->set_button_index(BUTTON_WHEEL_RIGHT);
|
ev->set_button_index(MOUSE_BUTTON_WHEEL_RIGHT);
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3298,7 +3298,7 @@ void DisplayServerX11::process_events() {
|
||||||
if (xi.pressure_supported) {
|
if (xi.pressure_supported) {
|
||||||
mm->set_pressure(xi.pressure);
|
mm->set_pressure(xi.pressure);
|
||||||
} else {
|
} else {
|
||||||
mm->set_pressure((mouse_get_button_state() & (1 << (BUTTON_LEFT - 1))) ? 1.0f : 0.0f);
|
mm->set_pressure((mouse_get_button_state() & (1 << (MOUSE_BUTTON_LEFT - 1))) ? 1.0f : 0.0f);
|
||||||
}
|
}
|
||||||
mm->set_tilt(xi.tilt);
|
mm->set_tilt(xi.tilt);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -829,7 +829,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i
|
||||||
mb->set_position(pos);
|
mb->set_position(pos);
|
||||||
mb->set_global_position(pos);
|
mb->set_global_position(pos);
|
||||||
mb->set_button_mask(DS_OSX->last_button_state);
|
mb->set_button_mask(DS_OSX->last_button_state);
|
||||||
if (index == BUTTON_LEFT && pressed) {
|
if (index == MOUSE_BUTTON_LEFT && pressed) {
|
||||||
mb->set_doubleclick([event clickCount] == 2);
|
mb->set_doubleclick([event clickCount] == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -842,10 +842,10 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i
|
||||||
|
|
||||||
if (([event modifierFlags] & NSEventModifierFlagControl)) {
|
if (([event modifierFlags] & NSEventModifierFlagControl)) {
|
||||||
wd.mouse_down_control = true;
|
wd.mouse_down_control = true;
|
||||||
_mouseDownEvent(window_id, event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, true);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MASK_RIGHT, true);
|
||||||
} else {
|
} else {
|
||||||
wd.mouse_down_control = false;
|
wd.mouse_down_control = false;
|
||||||
_mouseDownEvent(window_id, event, BUTTON_LEFT, BUTTON_MASK_LEFT, true);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MASK_LEFT, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -858,9 +858,9 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i
|
||||||
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
|
DisplayServerOSX::WindowData &wd = DS_OSX->windows[window_id];
|
||||||
|
|
||||||
if (wd.mouse_down_control) {
|
if (wd.mouse_down_control) {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, false);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MASK_RIGHT, false);
|
||||||
} else {
|
} else {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_LEFT, BUTTON_MASK_LEFT, false);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_LEFT, MOUSE_BUTTON_MASK_LEFT, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -946,7 +946,7 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)rightMouseDown:(NSEvent *)event {
|
- (void)rightMouseDown:(NSEvent *)event {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, true);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MASK_RIGHT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)rightMouseDragged:(NSEvent *)event {
|
- (void)rightMouseDragged:(NSEvent *)event {
|
||||||
|
|
@ -954,16 +954,16 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)rightMouseUp:(NSEvent *)event {
|
- (void)rightMouseUp:(NSEvent *)event {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, false);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_RIGHT, MOUSE_BUTTON_MASK_RIGHT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)otherMouseDown:(NSEvent *)event {
|
- (void)otherMouseDown:(NSEvent *)event {
|
||||||
if ((int)[event buttonNumber] == 2) {
|
if ((int)[event buttonNumber] == 2) {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_MIDDLE, BUTTON_MASK_MIDDLE, true);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_MIDDLE, MOUSE_BUTTON_MASK_MIDDLE, true);
|
||||||
} else if ((int)[event buttonNumber] == 3) {
|
} else if ((int)[event buttonNumber] == 3) {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_XBUTTON1, BUTTON_MASK_XBUTTON1, true);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_XBUTTON1, MOUSE_BUTTON_MASK_XBUTTON1, true);
|
||||||
} else if ((int)[event buttonNumber] == 4) {
|
} else if ((int)[event buttonNumber] == 4) {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_XBUTTON2, BUTTON_MASK_XBUTTON2, true);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_XBUTTON2, MOUSE_BUTTON_MASK_XBUTTON2, true);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -975,11 +975,11 @@ static void _mouseDownEvent(DisplayServer::WindowID window_id, NSEvent *event, i
|
||||||
|
|
||||||
- (void)otherMouseUp:(NSEvent *)event {
|
- (void)otherMouseUp:(NSEvent *)event {
|
||||||
if ((int)[event buttonNumber] == 2) {
|
if ((int)[event buttonNumber] == 2) {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_MIDDLE, BUTTON_MASK_MIDDLE, false);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_MIDDLE, MOUSE_BUTTON_MASK_MIDDLE, false);
|
||||||
} else if ((int)[event buttonNumber] == 3) {
|
} else if ((int)[event buttonNumber] == 3) {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_XBUTTON1, BUTTON_MASK_XBUTTON1, false);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_XBUTTON1, MOUSE_BUTTON_MASK_XBUTTON1, false);
|
||||||
} else if ((int)[event buttonNumber] == 4) {
|
} else if ((int)[event buttonNumber] == 4) {
|
||||||
_mouseDownEvent(window_id, event, BUTTON_XBUTTON2, BUTTON_MASK_XBUTTON2, false);
|
_mouseDownEvent(window_id, event, MOUSE_BUTTON_XBUTTON2, MOUSE_BUTTON_MASK_XBUTTON2, false);
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -1558,10 +1558,10 @@ inline void sendPanEvent(DisplayServer::WindowID window_id, double dx, double dy
|
||||||
sendPanEvent(window_id, deltaX, deltaY, [event modifierFlags]);
|
sendPanEvent(window_id, deltaX, deltaY, [event modifierFlags]);
|
||||||
} else {
|
} else {
|
||||||
if (fabs(deltaX)) {
|
if (fabs(deltaX)) {
|
||||||
sendScrollEvent(window_id, 0 > deltaX ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_LEFT, fabs(deltaX * 0.3), [event modifierFlags]);
|
sendScrollEvent(window_id, 0 > deltaX ? MOUSE_BUTTON_WHEEL_RIGHT : MOUSE_BUTTON_WHEEL_LEFT, fabs(deltaX * 0.3), [event modifierFlags]);
|
||||||
}
|
}
|
||||||
if (fabs(deltaY)) {
|
if (fabs(deltaY)) {
|
||||||
sendScrollEvent(window_id, 0 < deltaY ? BUTTON_WHEEL_UP : BUTTON_WHEEL_DOWN, fabs(deltaY * 0.3), [event modifierFlags]);
|
sendScrollEvent(window_id, 0 < deltaY ? MOUSE_BUTTON_WHEEL_UP : MOUSE_BUTTON_WHEEL_DOWN, fabs(deltaY * 0.3), [event modifierFlags]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -149,28 +149,28 @@ static int _get_button(Windows::UI::Input::PointerPoint ^ pt) {
|
||||||
using namespace Windows::UI::Input;
|
using namespace Windows::UI::Input;
|
||||||
|
|
||||||
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
|
||||||
return BUTTON_LEFT;
|
return MOUSE_BUTTON_LEFT;
|
||||||
#else
|
#else
|
||||||
switch (pt->Properties->PointerUpdateKind) {
|
switch (pt->Properties->PointerUpdateKind) {
|
||||||
case PointerUpdateKind::LeftButtonPressed:
|
case PointerUpdateKind::LeftButtonPressed:
|
||||||
case PointerUpdateKind::LeftButtonReleased:
|
case PointerUpdateKind::LeftButtonReleased:
|
||||||
return BUTTON_LEFT;
|
return MOUSE_BUTTON_LEFT;
|
||||||
|
|
||||||
case PointerUpdateKind::RightButtonPressed:
|
case PointerUpdateKind::RightButtonPressed:
|
||||||
case PointerUpdateKind::RightButtonReleased:
|
case PointerUpdateKind::RightButtonReleased:
|
||||||
return BUTTON_RIGHT;
|
return MOUSE_BUTTON_RIGHT;
|
||||||
|
|
||||||
case PointerUpdateKind::MiddleButtonPressed:
|
case PointerUpdateKind::MiddleButtonPressed:
|
||||||
case PointerUpdateKind::MiddleButtonReleased:
|
case PointerUpdateKind::MiddleButtonReleased:
|
||||||
return BUTTON_MIDDLE;
|
return MOUSE_BUTTON_MIDDLE;
|
||||||
|
|
||||||
case PointerUpdateKind::XButton1Pressed:
|
case PointerUpdateKind::XButton1Pressed:
|
||||||
case PointerUpdateKind::XButton1Released:
|
case PointerUpdateKind::XButton1Released:
|
||||||
return BUTTON_WHEEL_UP;
|
return MOUSE_BUTTON_WHEEL_UP;
|
||||||
|
|
||||||
case PointerUpdateKind::XButton2Pressed:
|
case PointerUpdateKind::XButton2Pressed:
|
||||||
case PointerUpdateKind::XButton2Released:
|
case PointerUpdateKind::XButton2Released:
|
||||||
return BUTTON_WHEEL_DOWN;
|
return MOUSE_BUTTON_WHEEL_DOWN;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -265,9 +265,9 @@ void App::pointer_event(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Cor
|
||||||
|
|
||||||
if (p_is_wheel) {
|
if (p_is_wheel) {
|
||||||
if (point->Properties->MouseWheelDelta > 0) {
|
if (point->Properties->MouseWheelDelta > 0) {
|
||||||
mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_UP);
|
mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? MOUSE_BUTTON_WHEEL_RIGHT : MOUSE_BUTTON_WHEEL_UP);
|
||||||
} else if (point->Properties->MouseWheelDelta < 0) {
|
} else if (point->Properties->MouseWheelDelta < 0) {
|
||||||
mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_LEFT : BUTTON_WHEEL_DOWN);
|
mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? MOUSE_BUTTON_WHEEL_LEFT : MOUSE_BUTTON_WHEEL_DOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2431,9 +2431,9 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (motion > 0)
|
if (motion > 0)
|
||||||
mb->set_button_index(BUTTON_WHEEL_UP);
|
mb->set_button_index(MOUSE_BUTTON_WHEEL_UP);
|
||||||
else
|
else
|
||||||
mb->set_button_index(BUTTON_WHEEL_DOWN);
|
mb->set_button_index(MOUSE_BUTTON_WHEEL_DOWN);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case WM_MOUSEHWHEEL: {
|
case WM_MOUSEHWHEEL: {
|
||||||
|
|
@ -2443,33 +2443,33 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (motion < 0) {
|
if (motion < 0) {
|
||||||
mb->set_button_index(BUTTON_WHEEL_LEFT);
|
mb->set_button_index(MOUSE_BUTTON_WHEEL_LEFT);
|
||||||
mb->set_factor(fabs((double)motion / (double)WHEEL_DELTA));
|
mb->set_factor(fabs((double)motion / (double)WHEEL_DELTA));
|
||||||
} else {
|
} else {
|
||||||
mb->set_button_index(BUTTON_WHEEL_RIGHT);
|
mb->set_button_index(MOUSE_BUTTON_WHEEL_RIGHT);
|
||||||
mb->set_factor(fabs((double)motion / (double)WHEEL_DELTA));
|
mb->set_factor(fabs((double)motion / (double)WHEEL_DELTA));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case WM_XBUTTONDOWN: {
|
case WM_XBUTTONDOWN: {
|
||||||
mb->set_pressed(true);
|
mb->set_pressed(true);
|
||||||
if (HIWORD(wParam) == XBUTTON1)
|
if (HIWORD(wParam) == XBUTTON1)
|
||||||
mb->set_button_index(BUTTON_XBUTTON1);
|
mb->set_button_index(MOUSE_BUTTON_XBUTTON1);
|
||||||
else
|
else
|
||||||
mb->set_button_index(BUTTON_XBUTTON2);
|
mb->set_button_index(MOUSE_BUTTON_XBUTTON2);
|
||||||
} break;
|
} break;
|
||||||
case WM_XBUTTONUP: {
|
case WM_XBUTTONUP: {
|
||||||
mb->set_pressed(false);
|
mb->set_pressed(false);
|
||||||
if (HIWORD(wParam) == XBUTTON1)
|
if (HIWORD(wParam) == XBUTTON1)
|
||||||
mb->set_button_index(BUTTON_XBUTTON1);
|
mb->set_button_index(MOUSE_BUTTON_XBUTTON1);
|
||||||
else
|
else
|
||||||
mb->set_button_index(BUTTON_XBUTTON2);
|
mb->set_button_index(MOUSE_BUTTON_XBUTTON2);
|
||||||
} break;
|
} break;
|
||||||
case WM_XBUTTONDBLCLK: {
|
case WM_XBUTTONDBLCLK: {
|
||||||
mb->set_pressed(true);
|
mb->set_pressed(true);
|
||||||
if (HIWORD(wParam) == XBUTTON1)
|
if (HIWORD(wParam) == XBUTTON1)
|
||||||
mb->set_button_index(BUTTON_XBUTTON1);
|
mb->set_button_index(MOUSE_BUTTON_XBUTTON1);
|
||||||
else
|
else
|
||||||
mb->set_button_index(BUTTON_XBUTTON2);
|
mb->set_button_index(MOUSE_BUTTON_XBUTTON2);
|
||||||
mb->set_doubleclick(true);
|
mb->set_doubleclick(true);
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int button_mask = BUTTON_MASK_LEFT;
|
int button_mask = MOUSE_BUTTON_MASK_LEFT;
|
||||||
bool toggle_mode = false;
|
bool toggle_mode = false;
|
||||||
bool shortcut_in_tooltip = true;
|
bool shortcut_in_tooltip = true;
|
||||||
bool keep_pressed_outside = false;
|
bool keep_pressed_outside = false;
|
||||||
|
|
|
||||||
|
|
@ -544,7 +544,7 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> bev = p_event;
|
Ref<InputEventMouseButton> bev = p_event;
|
||||||
|
|
||||||
if (bev.is_valid()) {
|
if (bev.is_valid()) {
|
||||||
if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
|
if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
changing_color = true;
|
changing_color = true;
|
||||||
float x = CLAMP((float)bev->get_position().x, 0, uv_edit->get_size().width);
|
float x = CLAMP((float)bev->get_position().x, 0, uv_edit->get_size().width);
|
||||||
float y = CLAMP((float)bev->get_position().y, 0, uv_edit->get_size().height);
|
float y = CLAMP((float)bev->get_position().y, 0, uv_edit->get_size().height);
|
||||||
|
|
@ -557,7 +557,7 @@ void ColorPicker::_uv_input(const Ref<InputEvent> &p_event) {
|
||||||
if (!deferred_mode_enabled) {
|
if (!deferred_mode_enabled) {
|
||||||
emit_signal("color_changed", color);
|
emit_signal("color_changed", color);
|
||||||
}
|
}
|
||||||
} else if (deferred_mode_enabled && !bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
|
} else if (deferred_mode_enabled && !bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
emit_signal("color_changed", color);
|
emit_signal("color_changed", color);
|
||||||
changing_color = false;
|
changing_color = false;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -589,7 +589,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> bev = p_event;
|
Ref<InputEventMouseButton> bev = p_event;
|
||||||
|
|
||||||
if (bev.is_valid()) {
|
if (bev.is_valid()) {
|
||||||
if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
|
if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
changing_color = true;
|
changing_color = true;
|
||||||
float y = CLAMP((float)bev->get_position().y, 0, w_edit->get_size().height);
|
float y = CLAMP((float)bev->get_position().y, 0, w_edit->get_size().height);
|
||||||
h = y / w_edit->get_size().height;
|
h = y / w_edit->get_size().height;
|
||||||
|
|
@ -602,7 +602,7 @@ void ColorPicker::_w_input(const Ref<InputEvent> &p_event) {
|
||||||
_update_color();
|
_update_color();
|
||||||
if (!deferred_mode_enabled) {
|
if (!deferred_mode_enabled) {
|
||||||
emit_signal("color_changed", color);
|
emit_signal("color_changed", color);
|
||||||
} else if (!bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
|
} else if (!bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
emit_signal("color_changed", color);
|
emit_signal("color_changed", color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -630,7 +630,7 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
if (bev.is_valid()) {
|
if (bev.is_valid()) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if (bev->is_pressed() && bev->get_button_index() == BUTTON_LEFT) {
|
if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
for (int i = 0; i < presets.size(); i++) {
|
for (int i = 0; i < presets.size(); i++) {
|
||||||
int x = (i % presets_per_row) * bt_add_preset->get_size().x;
|
int x = (i % presets_per_row) * bt_add_preset->get_size().x;
|
||||||
int y = (Math::floor((float)i / presets_per_row)) * bt_add_preset->get_size().y;
|
int y = (Math::floor((float)i / presets_per_row)) * bt_add_preset->get_size().y;
|
||||||
|
|
@ -641,7 +641,7 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
|
||||||
set_pick_color(presets[index]);
|
set_pick_color(presets[index]);
|
||||||
_update_color();
|
_update_color();
|
||||||
emit_signal("color_changed", color);
|
emit_signal("color_changed", color);
|
||||||
} else if (bev->is_pressed() && bev->get_button_index() == BUTTON_RIGHT && presets_enabled) {
|
} else if (bev->is_pressed() && bev->get_button_index() == MOUSE_BUTTON_RIGHT && presets_enabled) {
|
||||||
index = bev->get_position().x / (preset->get_size().x / presets.size());
|
index = bev->get_position().x / (preset->get_size().x / presets.size());
|
||||||
Color clicked_preset = presets[index];
|
Color clicked_preset = presets[index];
|
||||||
erase_preset(clicked_preset);
|
erase_preset(clicked_preset);
|
||||||
|
|
@ -670,7 +670,7 @@ void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseButton> bev = p_event;
|
Ref<InputEventMouseButton> bev = p_event;
|
||||||
if (bev.is_valid() && bev->get_button_index() == BUTTON_LEFT && !bev->is_pressed()) {
|
if (bev.is_valid() && bev->get_button_index() == MOUSE_BUTTON_LEFT && !bev->is_pressed()) {
|
||||||
emit_signal("color_changed", color);
|
emit_signal("color_changed", color);
|
||||||
screen->hide();
|
screen->hide();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ void GraphEditMinimap::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
Ref<InputEventMouseButton> mb = p_ev;
|
Ref<InputEventMouseButton> mb = p_ev;
|
||||||
Ref<InputEventMouseMotion> mm = p_ev;
|
Ref<InputEventMouseMotion> mm = p_ev;
|
||||||
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
is_pressing = true;
|
is_pressing = true;
|
||||||
|
|
||||||
|
|
@ -553,7 +553,7 @@ bool GraphEdit::_filter_input(const Point2 &p_point) {
|
||||||
|
|
||||||
void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
|
void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
|
||||||
Ref<InputEventMouseButton> mb = p_ev;
|
Ref<InputEventMouseButton> mb = p_ev;
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && mb->is_pressed()) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && mb->is_pressed()) {
|
||||||
connecting_valid = false;
|
connecting_valid = false;
|
||||||
Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
|
Ref<Texture2D> port = get_theme_icon("port", "GraphNode");
|
||||||
click_pos = mb->get_position() / zoom;
|
click_pos = mb->get_position() / zoom;
|
||||||
|
|
@ -696,7 +696,7 @@ void GraphEdit::_top_layer_input(const Ref<InputEvent> &p_ev) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
|
||||||
if (connecting_valid) {
|
if (connecting_valid) {
|
||||||
if (connecting && connecting_target) {
|
if (connecting && connecting_target) {
|
||||||
String from = connecting_from;
|
String from = connecting_from;
|
||||||
|
|
@ -1067,7 +1067,7 @@ void GraphEdit::set_selected(Node *p_child) {
|
||||||
|
|
||||||
void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
Ref<InputEventMouseMotion> mm = p_ev;
|
Ref<InputEventMouseMotion> mm = p_ev;
|
||||||
if (mm.is_valid() && (mm->get_button_mask() & BUTTON_MASK_MIDDLE || (mm->get_button_mask() & BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) {
|
if (mm.is_valid() && (mm->get_button_mask() & MOUSE_BUTTON_MASK_MIDDLE || (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && Input::get_singleton()->is_key_pressed(KEY_SPACE)))) {
|
||||||
h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x);
|
h_scroll->set_value(h_scroll->get_value() - mm->get_relative().x);
|
||||||
v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y);
|
v_scroll->set_value(v_scroll->get_value() - mm->get_relative().y);
|
||||||
}
|
}
|
||||||
|
|
@ -1139,7 +1139,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
|
|
||||||
Ref<InputEventMouseButton> b = p_ev;
|
Ref<InputEventMouseButton> b = p_ev;
|
||||||
if (b.is_valid()) {
|
if (b.is_valid()) {
|
||||||
if (b->get_button_index() == BUTTON_RIGHT && b->is_pressed()) {
|
if (b->get_button_index() == MOUSE_BUTTON_RIGHT && b->is_pressed()) {
|
||||||
if (box_selecting) {
|
if (box_selecting) {
|
||||||
box_selecting = false;
|
box_selecting = false;
|
||||||
for (int i = get_child_count() - 1; i >= 0; i--) {
|
for (int i = get_child_count() - 1; i >= 0; i--) {
|
||||||
|
|
@ -1169,7 +1169,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_LEFT && !b->is_pressed() && dragging) {
|
if (b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed() && dragging) {
|
||||||
if (!just_selected && drag_accum == Vector2() && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
if (!just_selected && drag_accum == Vector2() && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
||||||
//deselect current node
|
//deselect current node
|
||||||
for (int i = get_child_count() - 1; i >= 0; i--) {
|
for (int i = get_child_count() - 1; i >= 0; i--) {
|
||||||
|
|
@ -1208,7 +1208,7 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
connections_layer->update();
|
connections_layer->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_LEFT && b->is_pressed()) {
|
if (b->get_button_index() == MOUSE_BUTTON_LEFT && b->is_pressed()) {
|
||||||
GraphNode *gn = nullptr;
|
GraphNode *gn = nullptr;
|
||||||
|
|
||||||
for (int i = get_child_count() - 1; i >= 0; i--) {
|
for (int i = get_child_count() - 1; i >= 0; i--) {
|
||||||
|
|
@ -1310,24 +1310,24 @@ void GraphEdit::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_LEFT && !b->is_pressed() && box_selecting) {
|
if (b->get_button_index() == MOUSE_BUTTON_LEFT && !b->is_pressed() && box_selecting) {
|
||||||
box_selecting = false;
|
box_selecting = false;
|
||||||
previus_selected.clear();
|
previus_selected.clear();
|
||||||
top_layer->update();
|
top_layer->update();
|
||||||
minimap->update();
|
minimap->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
||||||
set_zoom(zoom * ZOOM_SCALE);
|
set_zoom(zoom * ZOOM_SCALE);
|
||||||
} else if (b->get_button_index() == BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
} else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
|
||||||
set_zoom(zoom / ZOOM_SCALE);
|
set_zoom(zoom / ZOOM_SCALE);
|
||||||
} else if (b->get_button_index() == BUTTON_WHEEL_UP && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
} else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||||
v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8);
|
v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8);
|
||||||
} else if (b->get_button_index() == BUTTON_WHEEL_DOWN && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
} else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && !Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
|
||||||
v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * b->get_factor() / 8);
|
v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * b->get_factor() / 8);
|
||||||
} else if (b->get_button_index() == BUTTON_WHEEL_RIGHT || (b->get_button_index() == BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
|
} else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT || (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
|
||||||
h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * b->get_factor() / 8);
|
h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * b->get_factor() / 8);
|
||||||
} else if (b->get_button_index() == BUTTON_WHEEL_LEFT || (b->get_button_index() == BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
|
} else if (b->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT || (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && Input::get_singleton()->is_key_pressed(KEY_SHIFT))) {
|
||||||
h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * b->get_factor() / 8);
|
h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * b->get_factor() / 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -808,7 +808,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node.");
|
ERR_FAIL_COND_MSG(get_parent_control() == nullptr, "GraphNode must be the child of a GraphEdit node.");
|
||||||
|
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Vector2 mpos = Vector2(mb->get_position().x, mb->get_position().y);
|
Vector2 mpos = Vector2(mb->get_position().x, mb->get_position().y);
|
||||||
if (close_rect.size != Size2() && close_rect.has_point(mpos)) {
|
if (close_rect.size != Size2() && close_rect.has_point(mpos)) {
|
||||||
//send focus to parent
|
//send focus to parent
|
||||||
|
|
@ -831,7 +831,7 @@ void GraphNode::_gui_input(const Ref<InputEvent> &p_ev) {
|
||||||
emit_signal("raise_request");
|
emit_signal("raise_request");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (!mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
resizing = false;
|
resizing = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -540,7 +540,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (defer_select_single >= 0 && mb.is_valid() && mb->get_button_index() == BUTTON_LEFT && !mb->is_pressed()) {
|
if (defer_select_single >= 0 && mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_LEFT && !mb->is_pressed()) {
|
||||||
select(defer_select_single, true);
|
select(defer_select_single, true);
|
||||||
|
|
||||||
emit_signal("multi_selected", defer_select_single, true);
|
emit_signal("multi_selected", defer_select_single, true);
|
||||||
|
|
@ -548,7 +548,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && (mb->get_button_index() == BUTTON_LEFT || (allow_rmb_select && mb->get_button_index() == BUTTON_RIGHT)) && mb->is_pressed()) {
|
if (mb.is_valid() && (mb->get_button_index() == MOUSE_BUTTON_LEFT || (allow_rmb_select && mb->get_button_index() == MOUSE_BUTTON_RIGHT)) && mb->is_pressed()) {
|
||||||
search_string = ""; //any mousepress cancels
|
search_string = ""; //any mousepress cancels
|
||||||
Vector2 pos = mb->get_position();
|
Vector2 pos = mb->get_position();
|
||||||
Ref<StyleBox> bg = get_theme_stylebox("bg");
|
Ref<StyleBox> bg = get_theme_stylebox("bg");
|
||||||
|
|
@ -594,16 +594,16 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_RIGHT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
emit_signal("item_rmb_selected", i, get_local_mouse_position());
|
emit_signal("item_rmb_selected", i, get_local_mouse_position());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!mb->is_doubleclick() && !mb->get_command() && select_mode == SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && mb->get_button_index() == BUTTON_LEFT) {
|
if (!mb->is_doubleclick() && !mb->get_command() && select_mode == SELECT_MULTI && items[i].selectable && !items[i].disabled && items[i].selected && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
defer_select_single = i;
|
defer_select_single = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items[i].selected && mb->get_button_index() == BUTTON_RIGHT) {
|
if (items[i].selected && mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
emit_signal("item_rmb_selected", i, get_local_mouse_position());
|
emit_signal("item_rmb_selected", i, get_local_mouse_position());
|
||||||
} else {
|
} else {
|
||||||
bool selected = items[i].selected;
|
bool selected = items[i].selected;
|
||||||
|
|
@ -618,7 +618,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_RIGHT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
emit_signal("item_rmb_selected", i, get_local_mouse_position());
|
emit_signal("item_rmb_selected", i, get_local_mouse_position());
|
||||||
} else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_doubleclick()) {
|
} else if (/*select_mode==SELECT_SINGLE &&*/ mb->is_doubleclick()) {
|
||||||
emit_signal("item_activated", i);
|
emit_signal("item_activated", i);
|
||||||
|
|
@ -628,7 +628,7 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mb->get_button_index() == BUTTON_RIGHT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
emit_signal("rmb_clicked", mb->get_position());
|
emit_signal("rmb_clicked", mb->get_position());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -637,10 +637,10 @@ void ItemList::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
// Since closest is null, more likely we clicked on empty space, so send signal to interested controls. Allows, for example, implement items deselecting.
|
// Since closest is null, more likely we clicked on empty space, so send signal to interested controls. Allows, for example, implement items deselecting.
|
||||||
emit_signal("nothing_selected");
|
emit_signal("nothing_selected");
|
||||||
}
|
}
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) {
|
||||||
scroll_bar->set_value(scroll_bar->get_value() - scroll_bar->get_page() * mb->get_factor() / 8);
|
scroll_bar->set_value(scroll_bar->get_value() - scroll_bar->get_page() * mb->get_factor() / 8);
|
||||||
}
|
}
|
||||||
if (mb.is_valid() && mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
|
if (mb.is_valid() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) {
|
||||||
scroll_bar->set_value(scroll_bar->get_value() + scroll_bar->get_page() * mb->get_factor() / 8);
|
scroll_bar->set_value(scroll_bar->get_value() + scroll_bar->get_page() * mb->get_factor() / 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||||
// Ignore mouse clicks in IME input mode.
|
// Ignore mouse clicks in IME input mode.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (b->is_pressed() && b->get_button_index() == BUTTON_RIGHT && context_menu_enabled) {
|
if (b->is_pressed() && b->get_button_index() == MOUSE_BUTTON_RIGHT && context_menu_enabled) {
|
||||||
menu->set_position(get_screen_transform().xform(get_local_mouse_position()));
|
menu->set_position(get_screen_transform().xform(get_local_mouse_position()));
|
||||||
menu->set_size(Vector2(1, 1));
|
menu->set_size(Vector2(1, 1));
|
||||||
_generate_context_menu();
|
_generate_context_menu();
|
||||||
|
|
@ -232,7 +232,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() != BUTTON_LEFT) {
|
if (b->get_button_index() != MOUSE_BUTTON_LEFT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -327,7 +327,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->get_button_mask() & BUTTON_LEFT) {
|
if (m->get_button_mask() & MOUSE_BUTTON_LEFT) {
|
||||||
if (selection.creating) {
|
if (selection.creating) {
|
||||||
set_cursor_at_pixel_pos(m->get_position().x);
|
set_cursor_at_pixel_pos(m->get_position().x);
|
||||||
selection_fill_at_cursor();
|
selection_fill_at_cursor();
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
if (b->is_pressed() || (!b->is_pressed() && during_grabbed_click)) {
|
if (b->is_pressed() || (!b->is_pressed() && during_grabbed_click)) {
|
||||||
// Allow activating item by releasing the LMB or any that was down when the popup appeared.
|
// Allow activating item by releasing the LMB or any that was down when the popup appeared.
|
||||||
// However, if button was not held when opening menu, do not allow release to activate item.
|
// However, if button was not held when opening menu, do not allow release to activate item.
|
||||||
if (button_idx == BUTTON_LEFT || (initial_button_mask & (1 << (button_idx - 1)))) {
|
if (button_idx == MOUSE_BUTTON_LEFT || (initial_button_mask & (1 << (button_idx - 1)))) {
|
||||||
bool was_during_grabbed_click = during_grabbed_click;
|
bool was_during_grabbed_click = during_grabbed_click;
|
||||||
during_grabbed_click = false;
|
during_grabbed_click = false;
|
||||||
initial_button_mask = 0;
|
initial_button_mask = 0;
|
||||||
|
|
|
||||||
|
|
@ -1479,7 +1479,7 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_LEFT) {
|
if (b->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (b->is_pressed() && !b->is_doubleclick()) {
|
if (b->is_pressed() && !b->is_doubleclick()) {
|
||||||
scroll_updated = false;
|
scroll_updated = false;
|
||||||
ItemFrame *c_frame = nullptr;
|
ItemFrame *c_frame = nullptr;
|
||||||
|
|
@ -1564,12 +1564,12 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_WHEEL_UP) {
|
if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
if (scroll_active) {
|
if (scroll_active) {
|
||||||
vscroll->set_value(vscroll->get_value() - vscroll->get_page() * b->get_factor() * 0.5 / 8);
|
vscroll->set_value(vscroll->get_value() - vscroll->get_page() * b->get_factor() * 0.5 / 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (b->get_button_index() == BUTTON_WHEEL_DOWN) {
|
if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
if (scroll_active) {
|
if (scroll_active) {
|
||||||
vscroll->set_value(vscroll->get_value() + vscroll->get_page() * b->get_factor() * 0.5 / 8);
|
vscroll->set_value(vscroll->get_value() + vscroll->get_page() * b->get_factor() * 0.5 / 8);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,17 +52,17 @@ void ScrollBar::_gui_input(Ref<InputEvent> p_event) {
|
||||||
if (b.is_valid()) {
|
if (b.is_valid()) {
|
||||||
accept_event();
|
accept_event();
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_WHEEL_DOWN && b->is_pressed()) {
|
if (b->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && b->is_pressed()) {
|
||||||
set_value(get_value() + get_page() / 4.0);
|
set_value(get_value() + get_page() / 4.0);
|
||||||
accept_event();
|
accept_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_WHEEL_UP && b->is_pressed()) {
|
if (b->get_button_index() == MOUSE_BUTTON_WHEEL_UP && b->is_pressed()) {
|
||||||
set_value(get_value() - get_page() / 4.0);
|
set_value(get_value() - get_page() / 4.0);
|
||||||
accept_event();
|
accept_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() != BUTTON_LEFT) {
|
if (b->get_button_index() != MOUSE_BUTTON_LEFT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
Ref<InputEventMouseButton> mb = p_gui_input;
|
Ref<InputEventMouseButton> mb = p_gui_input;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_UP && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && mb->is_pressed()) {
|
||||||
// only horizontal is enabled, scroll horizontally
|
// only horizontal is enabled, scroll horizontally
|
||||||
if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) {
|
if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) {
|
||||||
h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() / 8 * mb->get_factor());
|
h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() / 8 * mb->get_factor());
|
||||||
|
|
@ -103,7 +103,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_DOWN && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && mb->is_pressed()) {
|
||||||
// only horizontal is enabled, scroll horizontally
|
// only horizontal is enabled, scroll horizontally
|
||||||
if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) {
|
if (h_scroll->is_visible() && (!v_scroll->is_visible() || mb->get_shift())) {
|
||||||
h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() / 8 * mb->get_factor());
|
h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() / 8 * mb->get_factor());
|
||||||
|
|
@ -112,13 +112,13 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_LEFT && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT && mb->is_pressed()) {
|
||||||
if (h_scroll->is_visible_in_tree()) {
|
if (h_scroll->is_visible_in_tree()) {
|
||||||
h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * mb->get_factor() / 8);
|
h_scroll->set_value(h_scroll->get_value() - h_scroll->get_page() * mb->get_factor() / 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_RIGHT && mb->is_pressed()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT && mb->is_pressed()) {
|
||||||
if (h_scroll->is_visible_in_tree()) {
|
if (h_scroll->is_visible_in_tree()) {
|
||||||
h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * mb->get_factor() / 8);
|
h_scroll->set_value(h_scroll->get_value() + h_scroll->get_page() * mb->get_factor() / 8);
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +132,7 @@ void ScrollContainer::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() != BUTTON_LEFT) {
|
if (mb->get_button_index() != MOUSE_BUTTON_LEFT) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
Ref<Texture2D> grabber = get_theme_icon(mouse_inside || has_focus() ? "grabber_highlight" : "grabber");
|
Ref<Texture2D> grabber = get_theme_icon(mouse_inside || has_focus() ? "grabber_highlight" : "grabber");
|
||||||
grab.pos = orientation == VERTICAL ? mb->get_position().y : mb->get_position().x;
|
grab.pos = orientation == VERTICAL ? mb->get_position().y : mb->get_position().x;
|
||||||
|
|
@ -72,10 +72,10 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
|
||||||
grab.active = false;
|
grab.active = false;
|
||||||
}
|
}
|
||||||
} else if (scrollable) {
|
} else if (scrollable) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
grab_focus();
|
grab_focus();
|
||||||
set_value(get_value() + get_step());
|
set_value(get_value() + get_step());
|
||||||
} else if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
} else if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
grab_focus();
|
grab_focus();
|
||||||
set_value(get_value() - get_step());
|
set_value(get_value() - get_step());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ void SpinBox::_line_edit_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpinBox::_range_click_timeout() {
|
void SpinBox::_range_click_timeout() {
|
||||||
if (!drag.enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
|
if (!drag.enabled && Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT)) {
|
||||||
bool up = get_local_mouse_position().y < (get_size().height / 2);
|
bool up = get_local_mouse_position().y < (get_size().height / 2);
|
||||||
set_value(get_value() + (up ? get_step() : -get_step()));
|
set_value(get_value() + (up ? get_step() : -get_step()));
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
bool up = mb->get_position().y < (get_size().height / 2);
|
bool up = mb->get_position().y < (get_size().height / 2);
|
||||||
|
|
||||||
switch (mb->get_button_index()) {
|
switch (mb->get_button_index()) {
|
||||||
case BUTTON_LEFT: {
|
case MOUSE_BUTTON_LEFT: {
|
||||||
line_edit->grab_focus();
|
line_edit->grab_focus();
|
||||||
|
|
||||||
set_value(get_value() + (up ? get_step() : -get_step()));
|
set_value(get_value() + (up ? get_step() : -get_step()));
|
||||||
|
|
@ -122,17 +122,17 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
drag.allowed = true;
|
drag.allowed = true;
|
||||||
drag.capture_pos = mb->get_position();
|
drag.capture_pos = mb->get_position();
|
||||||
} break;
|
} break;
|
||||||
case BUTTON_RIGHT: {
|
case MOUSE_BUTTON_RIGHT: {
|
||||||
line_edit->grab_focus();
|
line_edit->grab_focus();
|
||||||
set_value((up ? get_max() : get_min()));
|
set_value((up ? get_max() : get_min()));
|
||||||
} break;
|
} break;
|
||||||
case BUTTON_WHEEL_UP: {
|
case MOUSE_BUTTON_WHEEL_UP: {
|
||||||
if (line_edit->has_focus()) {
|
if (line_edit->has_focus()) {
|
||||||
set_value(get_value() + get_step() * mb->get_factor());
|
set_value(get_value() + get_step() * mb->get_factor());
|
||||||
accept_event();
|
accept_event();
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case BUTTON_WHEEL_DOWN: {
|
case MOUSE_BUTTON_WHEEL_DOWN: {
|
||||||
if (line_edit->has_focus()) {
|
if (line_edit->has_focus()) {
|
||||||
set_value(get_value() - get_step() * mb->get_factor());
|
set_value(get_value() - get_step() * mb->get_factor());
|
||||||
accept_event();
|
accept_event();
|
||||||
|
|
@ -141,7 +141,7 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
//set_default_cursor_shape(CURSOR_ARROW);
|
//set_default_cursor_shape(CURSOR_ARROW);
|
||||||
range_click_timer->stop();
|
range_click_timer->stop();
|
||||||
_release_mouse();
|
_release_mouse();
|
||||||
|
|
@ -150,7 +150,7 @@ void SpinBox::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
Ref<InputEventMouseMotion> mm = p_event;
|
Ref<InputEventMouseMotion> mm = p_event;
|
||||||
|
|
||||||
if (mm.is_valid() && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm.is_valid() && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
if (drag.enabled) {
|
if (drag.enabled) {
|
||||||
drag.diff_y += mm->get_relative().y;
|
drag.diff_y += mm->get_relative().y;
|
||||||
float diff_y = -0.01 * Math::pow(ABS(drag.diff_y), 1.8f) * SGN(drag.diff_y);
|
float diff_y = -0.01 * Math::pow(ABS(drag.diff_y), 1.8f) * SGN(drag.diff_y);
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ void SplitContainer::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
int sep = get_theme_constant("separation");
|
int sep = get_theme_constant("separation");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ void TabContainer::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
|
||||||
Popup *popup = get_popup();
|
Popup *popup = get_popup();
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Point2 pos(mb->get_position().x, mb->get_position().y);
|
Point2 pos(mb->get_position().x, mb->get_position().y);
|
||||||
Size2 size = get_size();
|
Size2 size = get_size();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
|
|
||||||
if (mb.is_valid()) {
|
if (mb.is_valid()) {
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && !mb->get_command()) {
|
||||||
if (scrolling_enabled && buttons_visible) {
|
if (scrolling_enabled && buttons_visible) {
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
offset--;
|
offset--;
|
||||||
|
|
@ -131,7 +131,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->is_pressed() && mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) {
|
if (mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && !mb->get_command()) {
|
||||||
if (scrolling_enabled && buttons_visible) {
|
if (scrolling_enabled && buttons_visible) {
|
||||||
if (missing_right) {
|
if (missing_right) {
|
||||||
offset++;
|
offset++;
|
||||||
|
|
@ -140,7 +140,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rb_pressing && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (rb_pressing && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (rb_hover != -1) {
|
if (rb_hover != -1) {
|
||||||
//pressed
|
//pressed
|
||||||
emit_signal("right_button_pressed", rb_hover);
|
emit_signal("right_button_pressed", rb_hover);
|
||||||
|
|
@ -150,7 +150,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cb_pressing && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (cb_pressing && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (cb_hover != -1) {
|
if (cb_hover != -1) {
|
||||||
//pressed
|
//pressed
|
||||||
emit_signal("tab_closed", cb_hover);
|
emit_signal("tab_closed", cb_hover);
|
||||||
|
|
@ -160,7 +160,7 @@ void Tabs::_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->is_pressed() && (mb->get_button_index() == BUTTON_LEFT || (select_with_rmb && mb->get_button_index() == BUTTON_RIGHT))) {
|
if (mb->is_pressed() && (mb->get_button_index() == MOUSE_BUTTON_LEFT || (select_with_rmb && mb->get_button_index() == MOUSE_BUTTON_RIGHT))) {
|
||||||
// clicks
|
// clicks
|
||||||
Point2 pos(mb->get_position().x, mb->get_position().y);
|
Point2 pos(mb->get_position().x, mb->get_position().y);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -357,10 +357,10 @@ void TextEdit::_update_scrollbars() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextEdit::_click_selection_held() {
|
void TextEdit::_click_selection_held() {
|
||||||
// Warning: is_mouse_button_pressed(BUTTON_LEFT) returns false for double+ clicks, so this doesn't work for MODE_WORD
|
// Warning: is_mouse_button_pressed(MOUSE_BUTTON_LEFT) returns false for double+ clicks, so this doesn't work for MODE_WORD
|
||||||
// and MODE_LINE. However, moving the mouse triggers _gui_input, which calls these functions too, so that's not a huge problem.
|
// and MODE_LINE. However, moving the mouse triggers _gui_input, which calls these functions too, so that's not a huge problem.
|
||||||
// I'm unsure if there's an actual fix that doesn't have a ton of side effects.
|
// I'm unsure if there's an actual fix that doesn't have a ton of side effects.
|
||||||
if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && selection.selecting_mode != SelectionMode::SELECTION_MODE_NONE) {
|
if (Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT) && selection.selecting_mode != SelectionMode::SELECTION_MODE_NONE) {
|
||||||
switch (selection.selecting_mode) {
|
switch (selection.selecting_mode) {
|
||||||
case SelectionMode::SELECTION_MODE_POINTER: {
|
case SelectionMode::SELECTION_MODE_POINTER: {
|
||||||
_update_selection_mode_pointer();
|
_update_selection_mode_pointer();
|
||||||
|
|
@ -2873,14 +2873,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_UP) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
if (completion_index > 0) {
|
if (completion_index > 0) {
|
||||||
completion_index--;
|
completion_index--;
|
||||||
completion_current = completion_options[completion_index];
|
completion_current = completion_options[completion_index];
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_DOWN) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
if (completion_index < completion_options.size() - 1) {
|
if (completion_index < completion_options.size() - 1) {
|
||||||
completion_index++;
|
completion_index++;
|
||||||
completion_current = completion_options[completion_index];
|
completion_current = completion_options[completion_index];
|
||||||
|
|
@ -2888,7 +2888,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
completion_index = CLAMP(completion_line_ofs + (mpos.y - completion_rect.position.y) / get_row_height(), 0, completion_options.size() - 1);
|
completion_index = CLAMP(completion_line_ofs + (mpos.y - completion_rect.position.y) / get_row_height(), 0, completion_options.size() - 1);
|
||||||
|
|
||||||
completion_current = completion_options[completion_index];
|
completion_current = completion_options[completion_index];
|
||||||
|
|
@ -2904,27 +2904,27 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->is_pressed()) {
|
if (mb->is_pressed()) {
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP && !mb->get_command()) {
|
||||||
if (mb->get_shift()) {
|
if (mb->get_shift()) {
|
||||||
h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor()));
|
h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor()));
|
||||||
} else if (v_scroll->is_visible()) {
|
} else if (v_scroll->is_visible()) {
|
||||||
_scroll_up(3 * mb->get_factor());
|
_scroll_up(3 * mb->get_factor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN && !mb->get_command()) {
|
||||||
if (mb->get_shift()) {
|
if (mb->get_shift()) {
|
||||||
h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor()));
|
h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor()));
|
||||||
} else if (v_scroll->is_visible()) {
|
} else if (v_scroll->is_visible()) {
|
||||||
_scroll_down(3 * mb->get_factor());
|
_scroll_down(3 * mb->get_factor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT) {
|
||||||
h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor()));
|
h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor()));
|
||||||
}
|
}
|
||||||
if (mb->get_button_index() == BUTTON_WHEEL_RIGHT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT) {
|
||||||
h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor()));
|
h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor()));
|
||||||
}
|
}
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
_reset_caret_blink_timer();
|
_reset_caret_blink_timer();
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
@ -3031,7 +3031,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_RIGHT && context_menu_enabled) {
|
if (mb->get_button_index() == MOUSE_BUTTON_RIGHT && context_menu_enabled) {
|
||||||
_reset_caret_blink_timer();
|
_reset_caret_blink_timer();
|
||||||
|
|
||||||
int row, col;
|
int row, col;
|
||||||
|
|
@ -3062,7 +3062,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
grab_focus();
|
grab_focus();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (mb->get_command() && highlighted_word != String()) {
|
if (mb->get_command() && highlighted_word != String()) {
|
||||||
int row, col;
|
int row, col;
|
||||||
_get_mouse_pos(Point2i(mpos.x, mpos.y), row, col);
|
_get_mouse_pos(Point2i(mpos.x, mpos.y), row, col);
|
||||||
|
|
@ -3118,7 +3118,7 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mm->get_button_mask() & BUTTON_MASK_LEFT && get_viewport()->gui_get_drag_data() == Variant()) { // Ignore if dragging.
|
if (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT && get_viewport()->gui_get_drag_data() == Variant()) { // Ignore if dragging.
|
||||||
_reset_caret_blink_timer();
|
_reset_caret_blink_timer();
|
||||||
|
|
||||||
if (draw_minimap && !dragging_selection) {
|
if (draw_minimap && !dragging_selection) {
|
||||||
|
|
|
||||||
|
|
@ -1588,7 +1588,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2
|
||||||
|
|
||||||
if (p_item->cells[i].custom_button) {
|
if (p_item->cells[i].custom_button) {
|
||||||
if (cache.hover_item == p_item && cache.hover_cell == i) {
|
if (cache.hover_item == p_item && cache.hover_cell == i) {
|
||||||
if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
|
if (Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT)) {
|
||||||
draw_style_box(cache.custom_button_pressed, ir);
|
draw_style_box(cache.custom_button_pressed, ir);
|
||||||
} else {
|
} else {
|
||||||
draw_style_box(cache.custom_button_hover, ir);
|
draw_style_box(cache.custom_button_hover, ir);
|
||||||
|
|
@ -1825,7 +1825,7 @@ Rect2 Tree::search_item_rect(TreeItem *p_from, TreeItem *p_item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tree::_range_click_timeout() {
|
void Tree::_range_click_timeout() {
|
||||||
if (range_item_last && !range_drag_enabled && Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT)) {
|
if (range_item_last && !range_drag_enabled && Input::get_singleton()->is_mouse_button_pressed(MOUSE_BUTTON_LEFT)) {
|
||||||
Point2 pos = get_local_mouse_position() - cache.bg->get_offset();
|
Point2 pos = get_local_mouse_position() - cache.bg->get_offset();
|
||||||
if (show_column_titles) {
|
if (show_column_titles) {
|
||||||
pos.y -= _get_title_button_height();
|
pos.y -= _get_title_button_height();
|
||||||
|
|
@ -1843,7 +1843,7 @@ void Tree::_range_click_timeout() {
|
||||||
|
|
||||||
propagate_mouse_activated = false; // done from outside, so signal handler can't clear the tree in the middle of emit (which is a common case)
|
propagate_mouse_activated = false; // done from outside, so signal handler can't clear the tree in the middle of emit (which is a common case)
|
||||||
blocked++;
|
blocked++;
|
||||||
propagate_mouse_event(pos + cache.offset, 0, 0, false, root, BUTTON_LEFT, mb);
|
propagate_mouse_event(pos + cache.offset, 0, 0, false, root, MOUSE_BUTTON_LEFT, mb);
|
||||||
blocked--;
|
blocked--;
|
||||||
|
|
||||||
if (range_click_timer->is_one_shot()) {
|
if (range_click_timer->is_one_shot()) {
|
||||||
|
|
@ -1960,7 +1960,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
|
||||||
col_width -= w + cache.button_margin;
|
col_width -= w + cache.button_margin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_button == BUTTON_LEFT || (p_button == BUTTON_RIGHT && allow_rmb_select)) {
|
if (p_button == MOUSE_BUTTON_LEFT || (p_button == MOUSE_BUTTON_RIGHT && allow_rmb_select)) {
|
||||||
/* process selection */
|
/* process selection */
|
||||||
|
|
||||||
if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it's confusing for check
|
if (p_doubleclick && (!c.editable || c.mode == TreeItem::CELL_MODE_CUSTOM || c.mode == TreeItem::CELL_MODE_ICON /*|| c.mode==TreeItem::CELL_MODE_CHECK*/)) { //it's confusing for check
|
||||||
|
|
@ -1972,10 +1972,10 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
if (select_mode == SELECT_MULTI && p_mod->get_command() && c.selectable) {
|
if (select_mode == SELECT_MULTI && p_mod->get_command() && c.selectable) {
|
||||||
if (!c.selected || p_button == BUTTON_RIGHT) {
|
if (!c.selected || p_button == MOUSE_BUTTON_RIGHT) {
|
||||||
p_item->select(col);
|
p_item->select(col);
|
||||||
emit_signal("multi_selected", p_item, col, true);
|
emit_signal("multi_selected", p_item, col, true);
|
||||||
if (p_button == BUTTON_RIGHT) {
|
if (p_button == MOUSE_BUTTON_RIGHT) {
|
||||||
emit_signal("item_rmb_selected", get_local_mouse_position());
|
emit_signal("item_rmb_selected", get_local_mouse_position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1992,21 +1992,21 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
|
||||||
bool inrange = false;
|
bool inrange = false;
|
||||||
|
|
||||||
select_single_item(p_item, root, col, selected_item, &inrange);
|
select_single_item(p_item, root, col, selected_item, &inrange);
|
||||||
if (p_button == BUTTON_RIGHT) {
|
if (p_button == MOUSE_BUTTON_RIGHT) {
|
||||||
emit_signal("item_rmb_selected", get_local_mouse_position());
|
emit_signal("item_rmb_selected", get_local_mouse_position());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int icount = _count_selected_items(root);
|
int icount = _count_selected_items(root);
|
||||||
|
|
||||||
if (select_mode == SELECT_MULTI && icount > 1 && p_button != BUTTON_RIGHT) {
|
if (select_mode == SELECT_MULTI && icount > 1 && p_button != MOUSE_BUTTON_RIGHT) {
|
||||||
single_select_defer = p_item;
|
single_select_defer = p_item;
|
||||||
single_select_defer_column = col;
|
single_select_defer_column = col;
|
||||||
} else {
|
} else {
|
||||||
if (p_button != BUTTON_RIGHT || !c.selected) {
|
if (p_button != MOUSE_BUTTON_RIGHT || !c.selected) {
|
||||||
select_single_item(p_item, root, col);
|
select_single_item(p_item, root, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_button == BUTTON_RIGHT) {
|
if (p_button == MOUSE_BUTTON_RIGHT) {
|
||||||
emit_signal("item_rmb_selected", get_local_mouse_position());
|
emit_signal("item_rmb_selected", get_local_mouse_position());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2076,7 +2076,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
|
||||||
/* touching the combo */
|
/* touching the combo */
|
||||||
bool up = p_pos.y < (item_h / 2);
|
bool up = p_pos.y < (item_h / 2);
|
||||||
|
|
||||||
if (p_button == BUTTON_LEFT) {
|
if (p_button == MOUSE_BUTTON_LEFT) {
|
||||||
if (range_click_timer->get_time_left() == 0) {
|
if (range_click_timer->get_time_left() == 0) {
|
||||||
range_item_last = p_item;
|
range_item_last = p_item;
|
||||||
range_up_last = up;
|
range_up_last = up;
|
||||||
|
|
@ -2093,13 +2093,13 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
|
||||||
|
|
||||||
item_edited(col, p_item);
|
item_edited(col, p_item);
|
||||||
|
|
||||||
} else if (p_button == BUTTON_RIGHT) {
|
} else if (p_button == MOUSE_BUTTON_RIGHT) {
|
||||||
p_item->set_range(col, (up ? c.max : c.min));
|
p_item->set_range(col, (up ? c.max : c.min));
|
||||||
item_edited(col, p_item);
|
item_edited(col, p_item);
|
||||||
} else if (p_button == BUTTON_WHEEL_UP) {
|
} else if (p_button == MOUSE_BUTTON_WHEEL_UP) {
|
||||||
p_item->set_range(col, c.val + c.step);
|
p_item->set_range(col, c.val + c.step);
|
||||||
item_edited(col, p_item);
|
item_edited(col, p_item);
|
||||||
} else if (p_button == BUTTON_WHEEL_DOWN) {
|
} else if (p_button == MOUSE_BUTTON_WHEEL_DOWN) {
|
||||||
p_item->set_range(col, c.val - c.step);
|
p_item->set_range(col, c.val - c.step);
|
||||||
item_edited(col, p_item);
|
item_edited(col, p_item);
|
||||||
}
|
}
|
||||||
|
|
@ -2132,14 +2132,14 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p_item->cells[col].custom_button || !on_arrow) {
|
if (!p_item->cells[col].custom_button || !on_arrow) {
|
||||||
item_edited(col, p_item, p_button == BUTTON_LEFT);
|
item_edited(col, p_item, p_button == MOUSE_BUTTON_LEFT);
|
||||||
}
|
}
|
||||||
click_handled = true;
|
click_handled = true;
|
||||||
return -1;
|
return -1;
|
||||||
} break;
|
} break;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!bring_up_editor || p_button != BUTTON_LEFT) {
|
if (!bring_up_editor || p_button != MOUSE_BUTTON_LEFT) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2179,7 +2179,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool
|
||||||
item_h += child_h;
|
item_h += child_h;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (p_item == root && p_button == BUTTON_RIGHT) {
|
if (p_item == root && p_button == MOUSE_BUTTON_RIGHT) {
|
||||||
emit_signal("empty_rmb", get_local_mouse_position());
|
emit_signal("empty_rmb", get_local_mouse_position());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2720,7 +2720,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
|
||||||
bool rtl = is_layout_rtl();
|
bool rtl = is_layout_rtl();
|
||||||
|
|
||||||
if (!b->is_pressed()) {
|
if (!b->is_pressed()) {
|
||||||
if (b->get_button_index() == BUTTON_LEFT) {
|
if (b->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
Point2 pos = b->get_position();
|
Point2 pos = b->get_position();
|
||||||
if (rtl) {
|
if (rtl) {
|
||||||
pos.x = get_size().width - pos.x;
|
pos.x = get_size().width - pos.x;
|
||||||
|
|
@ -2801,8 +2801,8 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (b->get_button_index()) {
|
switch (b->get_button_index()) {
|
||||||
case BUTTON_RIGHT:
|
case MOUSE_BUTTON_RIGHT:
|
||||||
case BUTTON_LEFT: {
|
case MOUSE_BUTTON_LEFT: {
|
||||||
Ref<StyleBox> bg = cache.bg;
|
Ref<StyleBox> bg = cache.bg;
|
||||||
|
|
||||||
Point2 pos = b->get_position();
|
Point2 pos = b->get_position();
|
||||||
|
|
@ -2815,7 +2815,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
|
||||||
pos.y -= _get_title_button_height();
|
pos.y -= _get_title_button_height();
|
||||||
|
|
||||||
if (pos.y < 0) {
|
if (pos.y < 0) {
|
||||||
if (b->get_button_index() == BUTTON_LEFT) {
|
if (b->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
pos.x += cache.offset.x;
|
pos.x += cache.offset.x;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
for (int i = 0; i < columns.size(); i++) {
|
for (int i = 0; i < columns.size(); i++) {
|
||||||
|
|
@ -2833,7 +2833,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!root || (!root->get_children() && hide_root)) {
|
if (!root || (!root->get_children() && hide_root)) {
|
||||||
if (b->get_button_index() == BUTTON_RIGHT && allow_rmb_select) {
|
if (b->get_button_index() == MOUSE_BUTTON_RIGHT && allow_rmb_select) {
|
||||||
emit_signal("empty_tree_rmb_selected", get_local_mouse_position());
|
emit_signal("empty_tree_rmb_selected", get_local_mouse_position());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -2854,7 +2854,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_RIGHT) {
|
if (b->get_button_index() == MOUSE_BUTTON_RIGHT) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2877,7 +2877,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
|
||||||
set_physics_process_internal(true);
|
set_physics_process_internal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->get_button_index() == BUTTON_LEFT) {
|
if (b->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (get_item_at_position(b->get_position()) == nullptr && !b->get_shift() && !b->get_control() && !b->get_command()) {
|
if (get_item_at_position(b->get_position()) == nullptr && !b->get_shift() && !b->get_control() && !b->get_command()) {
|
||||||
emit_signal("nothing_selected");
|
emit_signal("nothing_selected");
|
||||||
}
|
}
|
||||||
|
|
@ -2890,7 +2890,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case BUTTON_WHEEL_UP: {
|
case MOUSE_BUTTON_WHEEL_UP: {
|
||||||
double prev_value = v_scroll->get_value();
|
double prev_value = v_scroll->get_value();
|
||||||
v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8);
|
v_scroll->set_value(v_scroll->get_value() - v_scroll->get_page() * b->get_factor() / 8);
|
||||||
if (v_scroll->get_value() != prev_value) {
|
if (v_scroll->get_value() != prev_value) {
|
||||||
|
|
@ -2898,7 +2898,7 @@ void Tree::_gui_input(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case BUTTON_WHEEL_DOWN: {
|
case MOUSE_BUTTON_WHEEL_DOWN: {
|
||||||
double prev_value = v_scroll->get_value();
|
double prev_value = v_scroll->get_value();
|
||||||
v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * b->get_factor() / 8);
|
v_scroll->set_value(v_scroll->get_value() + v_scroll->get_page() * b->get_factor() / 8);
|
||||||
if (v_scroll->get_value() != prev_value) {
|
if (v_scroll->get_value() != prev_value) {
|
||||||
|
|
|
||||||
|
|
@ -1621,10 +1621,10 @@ void Viewport::_gui_call_input(Control *p_control, const Ref<InputEvent> &p_inpu
|
||||||
Ref<InputEventMouseButton> mb = p_input;
|
Ref<InputEventMouseButton> mb = p_input;
|
||||||
|
|
||||||
bool cant_stop_me_now = (mb.is_valid() &&
|
bool cant_stop_me_now = (mb.is_valid() &&
|
||||||
(mb->get_button_index() == BUTTON_WHEEL_DOWN ||
|
(mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN ||
|
||||||
mb->get_button_index() == BUTTON_WHEEL_UP ||
|
mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP ||
|
||||||
mb->get_button_index() == BUTTON_WHEEL_LEFT ||
|
mb->get_button_index() == MOUSE_BUTTON_WHEEL_LEFT ||
|
||||||
mb->get_button_index() == BUTTON_WHEEL_RIGHT));
|
mb->get_button_index() == MOUSE_BUTTON_WHEEL_RIGHT));
|
||||||
Ref<InputEventPanGesture> pn = p_input;
|
Ref<InputEventPanGesture> pn = p_input;
|
||||||
cant_stop_me_now = pn.is_valid() || cant_stop_me_now;
|
cant_stop_me_now = pn.is_valid() || cant_stop_me_now;
|
||||||
|
|
||||||
|
|
@ -1860,7 +1860,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
|
|
||||||
gui.mouse_focus_mask = 1 << (mb->get_button_index() - 1);
|
gui.mouse_focus_mask = 1 << (mb->get_button_index() - 1);
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) {
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
gui.drag_accum = Vector2();
|
gui.drag_accum = Vector2();
|
||||||
gui.drag_attempted = false;
|
gui.drag_attempted = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1883,7 +1883,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mb->get_button_index() == BUTTON_LEFT) { //assign focus
|
if (mb->get_button_index() == MOUSE_BUTTON_LEFT) { //assign focus
|
||||||
CanvasItem *ci = gui.mouse_focus;
|
CanvasItem *ci = gui.mouse_focus;
|
||||||
while (ci) {
|
while (ci) {
|
||||||
Control *control = Object::cast_to<Control>(ci);
|
Control *control = Object::cast_to<Control>(ci);
|
||||||
|
|
@ -1914,7 +1914,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
|
|
||||||
set_input_as_handled();
|
set_input_as_handled();
|
||||||
|
|
||||||
if (gui.drag_data.get_type() != Variant::NIL && mb->get_button_index() == BUTTON_LEFT) {
|
if (gui.drag_data.get_type() != Variant::NIL && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
//alternate drop use (when using force_drag(), as proposed by #5342
|
//alternate drop use (when using force_drag(), as proposed by #5342
|
||||||
if (gui.mouse_focus) {
|
if (gui.mouse_focus) {
|
||||||
_gui_drop(gui.mouse_focus, pos, false);
|
_gui_drop(gui.mouse_focus, pos, false);
|
||||||
|
|
@ -1934,7 +1934,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
|
|
||||||
_gui_cancel_tooltip();
|
_gui_cancel_tooltip();
|
||||||
} else {
|
} else {
|
||||||
if (gui.drag_data.get_type() != Variant::NIL && mb->get_button_index() == BUTTON_LEFT) {
|
if (gui.drag_data.get_type() != Variant::NIL && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (gui.drag_mouse_over) {
|
if (gui.drag_mouse_over) {
|
||||||
_gui_drop(gui.drag_mouse_over, gui.drag_mouse_over_pos, false);
|
_gui_drop(gui.drag_mouse_over, gui.drag_mouse_over_pos, false);
|
||||||
}
|
}
|
||||||
|
|
@ -1978,7 +1978,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
_gui_call_input(mouse_focus, mb);
|
_gui_call_input(mouse_focus, mb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (gui.drag_data.get_type()!=Variant::NIL && mb->get_button_index()==BUTTON_LEFT) {
|
/*if (gui.drag_data.get_type()!=Variant::NIL && mb->get_button_index()==MOUSE_BUTTON_LEFT) {
|
||||||
_propagate_viewport_notification(this,NOTIFICATION_DRAG_END);
|
_propagate_viewport_notification(this,NOTIFICATION_DRAG_END);
|
||||||
gui.drag_data=Variant(); //always clear
|
gui.drag_data=Variant(); //always clear
|
||||||
}*/
|
}*/
|
||||||
|
|
@ -2022,7 +2022,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
Control *over = nullptr;
|
Control *over = nullptr;
|
||||||
|
|
||||||
// D&D
|
// D&D
|
||||||
if (!gui.drag_attempted && gui.mouse_focus && mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (!gui.drag_attempted && gui.mouse_focus && mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
gui.drag_accum += mm->get_relative();
|
gui.drag_accum += mm->get_relative();
|
||||||
float len = gui.drag_accum.length();
|
float len = gui.drag_accum.length();
|
||||||
if (len > 10) {
|
if (len > 10) {
|
||||||
|
|
@ -2266,7 +2266,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
Transform2D localizer = gui.drag_mouse_over->get_global_transform_with_canvas().affine_inverse();
|
Transform2D localizer = gui.drag_mouse_over->get_global_transform_with_canvas().affine_inverse();
|
||||||
gui.drag_mouse_over_pos = localizer.xform(viewport_pos);
|
gui.drag_mouse_over_pos = localizer.xform(viewport_pos);
|
||||||
|
|
||||||
if (mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
bool can_drop = _gui_drop(gui.drag_mouse_over, gui.drag_mouse_over_pos, true);
|
bool can_drop = _gui_drop(gui.drag_mouse_over, gui.drag_mouse_over_pos, true);
|
||||||
|
|
||||||
if (!can_drop) {
|
if (!can_drop) {
|
||||||
|
|
@ -2783,7 +2783,7 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) {
|
||||||
ERR_FAIL_COND_V(gui.subwindow_focused == nullptr, false);
|
ERR_FAIL_COND_V(gui.subwindow_focused == nullptr, false);
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && !mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
if (gui.subwindow_drag == SUB_WINDOW_DRAG_CLOSE) {
|
if (gui.subwindow_drag == SUB_WINDOW_DRAG_CLOSE) {
|
||||||
if (gui.subwindow_drag_close_rect.has_point(mb->get_position())) {
|
if (gui.subwindow_drag_close_rect.has_point(mb->get_position())) {
|
||||||
//close window
|
//close window
|
||||||
|
|
@ -2908,7 +2908,7 @@ bool Viewport::_sub_windows_forward_input(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventMouseButton> mb = p_event;
|
Ref<InputEventMouseButton> mb = p_event;
|
||||||
//if the event is a mouse button, we need to check whether another window was clicked
|
//if the event is a mouse button, we need to check whether another window was clicked
|
||||||
|
|
||||||
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
|
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
|
||||||
bool click_on_window = false;
|
bool click_on_window = false;
|
||||||
for (int i = gui.sub_windows.size() - 1; i >= 0; i--) {
|
for (int i = gui.sub_windows.size() - 1; i >= 0; i--) {
|
||||||
SubWindow &sw = gui.sub_windows.write[i];
|
SubWindow &sw = gui.sub_windows.write[i];
|
||||||
|
|
|
||||||
|
|
@ -216,10 +216,10 @@ protected:
|
||||||
if (mm.is_valid()) {
|
if (mm.is_valid()) {
|
||||||
Point2 p = mm->get_position();
|
Point2 p = mm->get_position();
|
||||||
|
|
||||||
if (mm->get_button_mask() & BUTTON_MASK_LEFT) {
|
if (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) {
|
||||||
ray_to = p;
|
ray_to = p;
|
||||||
_do_ray_query();
|
_do_ray_query();
|
||||||
} else if (mm->get_button_mask() & BUTTON_MASK_RIGHT) {
|
} else if (mm->get_button_mask() & MOUSE_BUTTON_MASK_RIGHT) {
|
||||||
ray_from = p;
|
ray_from = p;
|
||||||
_do_ray_query();
|
_do_ray_query();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue