Skip to content

Commit

Permalink
manipulating clipping plane is only possible when it is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
LiangliangNan committed Dec 29, 2024
1 parent a182734 commit 884d406
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions easy3d/viewer/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,14 @@ namespace easy3d {
return false;

if (modifiers == MODIF_ALT) {
ManipulatedFrame* frame = ClippingPlane::instance()->manipulator()->frame();
if (pressed_button_ == BUTTON_LEFT)
frame->action_rotate(x, y, dx, dy, camera(), ManipulatedFrame::NONE);
else if (pressed_button_ == BUTTON_RIGHT)
frame->action_translate(x, y, dx, dy, camera(), ManipulatedFrame::NONE);
// the clipping plane can be manipulated only when it is enabled
if (ClippingPlane::instance()->is_enabled()) {
ManipulatedFrame *frame = ClippingPlane::instance()->manipulator()->frame();
if (pressed_button_ == BUTTON_LEFT)
frame->action_rotate(x, y, dx, dy, camera(), ManipulatedFrame::NONE);
else if (pressed_button_ == BUTTON_RIGHT)
frame->action_translate(x, y, dx, dy, camera(), ManipulatedFrame::NONE);
}
}
else { // axis-constrained rotation of a model
auto axis = ManipulatedFrame::NONE;
Expand Down

0 comments on commit 884d406

Please sign in to comment.