From 29b4d63875bb30fe14b51a8afd7a37ad4cabb6a5 Mon Sep 17 00:00:00 2001 From: Theodore Watson Date: Sat, 27 Apr 2019 07:49:18 -0700 Subject: [PATCH] Bugfix ofEasyCam (#6284) ofEasyCam stopped working for translate with mouse buttons - this fixes and makes sure left / middle / right and key modifiers all work for ofEasyCam #changelog #3d --- libs/openFrameworks/3d/ofEasyCam.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/openFrameworks/3d/ofEasyCam.cpp b/libs/openFrameworks/3d/ofEasyCam.cpp index 7544d91a457..4fa070bd84f 100644 --- a/libs/openFrameworks/3d/ofEasyCam.cpp +++ b/libs/openFrameworks/3d/ofEasyCam.cpp @@ -20,8 +20,8 @@ ofEasyCam::ofEasyCam(){ sensitivityTranslate = {1,1,1}; sensitivityRot = {1,1,1}; + addInteraction(TRANSFORM_TRANSLATE_XY, OF_MOUSE_BUTTON_LEFT,doTranslationKey); addInteraction(TRANSFORM_ROTATE, OF_MOUSE_BUTTON_LEFT); - addInteraction(TRANSFORM_TRANSLATE_XY, OF_MOUSE_BUTTON_LEFT,doTranslationKey); addInteraction(TRANSFORM_TRANSLATE_Z, OF_MOUSE_BUTTON_RIGHT); addInteraction(TRANSFORM_TRANSLATE_XY, OF_MOUSE_BUTTON_MIDDLE); @@ -69,10 +69,10 @@ void ofEasyCam::reset(){ rot = {0,0,0}; translate = {0,0,0}; - - if(bAutoDistance){ - bDistanceSet = false; - } + + if(bAutoDistance){ + bDistanceSet = false; + } bApplyInertia = false; currentTransformType = TRANSFORM_NONE; } @@ -377,7 +377,7 @@ void ofEasyCam::mousePressed(ofMouseEventArgs & mouse){ currentTransformType = TRANSFORM_NONE; if (events) { for (const auto& i: interactions) { - if (i.mouseButton == mouse.button && ((i.key == -1) ^ events->getKeyPressed(i.key))) { + if (i.mouseButton == mouse.button && ((i.key == -1) || events->getKeyPressed(i.key)) ) { currentTransformType = i.transformType; break; }