summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-09-16 12:12:11 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-09-16 12:12:41 -0300
commit844c5e12e664e3212feacc9ee3200e116556fbc7 (patch)
treee7c95622c35ad2aab693526c9bbf892f0b1fbc1f /main
parent61e9623ced62d73bf26453e2fc64799e0ee60aa2 (diff)
Fixed to InputDefault, button mask was wrong. Fixes to editor camera interpolation.
Diffstat (limited to 'main')
-rw-r--r--main/input_default.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/main/input_default.cpp b/main/input_default.cpp
index b4c9a6207f..902d3168d8 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -80,7 +80,7 @@ bool InputDefault::is_key_pressed(int p_scancode) const {
bool InputDefault::is_mouse_button_pressed(int p_button) const {
_THREAD_SAFE_METHOD_
- return (mouse_button_mask & (1 << p_button)) != 0;
+ return (mouse_button_mask & (1 << (p_button - 1))) != 0;
}
static int _combine_device(int p_value, int p_device) {
@@ -265,10 +265,11 @@ void InputDefault::parse_input_event(const Ref<InputEvent> &p_event) {
if (mb.is_valid() && !mb->is_doubleclick()) {
- if (mb->is_pressed())
- mouse_button_mask |= (1 << mb->get_button_index());
- else
- mouse_button_mask &= ~(1 << mb->get_button_index());
+ if (mb->is_pressed()) {
+ mouse_button_mask |= (1 << (mb->get_button_index() - 1));
+ } else {
+ mouse_button_mask &= ~(1 << (mb->get_button_index() - 1));
+ }
if (main_loop && emulate_touch && mb->get_button_index() == 1) {
Ref<InputEventScreenTouch> touch_event;