Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setScrollSensitivity for ofEasyCam #8272

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libs/openFrameworks/3d/ofEasyCam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ofEasyCam::ofEasyCam(){
reset();
sensitivityTranslate = {1,1,1};
sensitivityRot = {1,1,1};
sensitivityScroll = 1.0f;

addInteraction(TRANSFORM_TRANSLATE_XY, OF_MOUSE_BUTTON_LEFT,doTranslationKey);
addInteraction(TRANSFORM_ROTATE, OF_MOUSE_BUTTON_LEFT);
Expand Down Expand Up @@ -212,6 +213,10 @@ void ofEasyCam::setTranslationSensitivity(const glm::vec3& sensitivity){
void ofEasyCam::setTranslationSensitivity(float x, float y, float z){
sensitivityTranslate = {x,y,z};
}
//----------------------------------------
void ofEasyCam::setScrollSensitivity(float sensitivity){
sensitivityScroll = sensitivity;
}

//----------------------------------------
void ofEasyCam::enableMouseMiddleButton(){
Expand Down
9 changes: 7 additions & 2 deletions libs/openFrameworks/3d/ofEasyCam.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ class ofEasyCam : public ofCamera {
/// \param x , y z Scales the xyz axes translation factor by these values.
void setTranslationSensitivity(float x, float y, float z);
void setTranslationSensitivity(const glm::vec3 & sensitivity);

/// \brief Sets the scroll sensitivity of the mouse scroll wheel.
/// \param sensitivity Scales the mouse scroll wheel values by factor.
void setScrollSensitivity(float sensitivity);

/// \brief Set the key used to switch between camera rotation and translation.
///
/// Translation will only happen when the translation key is pressed.
Expand Down Expand Up @@ -211,12 +216,12 @@ class ofEasyCam : public ofCamera {
glm::vec3 translate;

/// \brief Sensitivity
/// These varibles determine how sensitive is the interaction.
/// These variables determine how sensitive the interaction is.
/// High values mean faster and bigger movements/rotations.
/// Low Values mean more presicion.
glm::vec3 sensitivityTranslate;
glm::vec3 sensitivityRot;
float sensitivityScroll = 1.0f;
float sensitivityScroll;

/// \brief The previous mouse position.
glm::vec2 prevMouse;
Expand Down