Skip to content

Commit 7f32b03

Browse files
authored
give viewport to calculate correct world position (#8026)
1 parent 8c255fe commit 7f32b03

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libs/openFrameworks/3d/ofEasyCam.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,16 @@ void ofEasyCam::updateTranslation(){
296296
if(getOrtho()){
297297
//In ortho mode moving along the z axis has no effect besides clipping.
298298
// Instead, scale is applied to achieve the effect of getting near or far from the target.
299-
glm::vec3 mousePre ;
299+
glm::vec3 mousePre;
300300
bool bDoScale = (currentTransformType == TRANSFORM_SCALE || currentTransformType == TRANSFORM_TRANSLATE_Z);
301301
if (bDoScale) {
302-
mousePre = screenToWorld(glm::vec3((bIsScrolling?mouseAtScroll:lastPressMouse),0));
302+
mousePre = screenToWorld(glm::vec3((bIsScrolling?mouseAtScroll:lastPressMouse),0), viewport);
303303
}
304304
move(glm::vec3(lastPressAxisX * translate.x) + (lastPressAxisY * translate.y));
305305
if (bDoScale) {
306306
setScale(getScale() + translate.z);
307307
// this move call is to keep the scaling centered below the mouse.
308-
move(mousePre - screenToWorld(glm::vec3((bIsScrolling?mouseAtScroll:lastPressMouse),0)));
308+
move(mousePre - screenToWorld(glm::vec3((bIsScrolling?mouseAtScroll:lastPressMouse),0), viewport));
309309
}
310310
}else{
311311
move(glm::vec3(lastPressAxisX * translate.x) + (lastPressAxisY * translate.y) + (lastPressAxisZ * translate.z));

0 commit comments

Comments
 (0)