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 suport for mouse event modifiers in occt_widget (Shift/Ctrl + Left Mouse Button) #355

Open
wants to merge 1 commit 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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ Note that `show_object` works for `Shape` and `TopoDS_Shape` objects too. In ord
The following mouse controls can be used to alter the view of the 3D object, and should be familiar to CAD users, even if the mouse buttons used may differ.

* _Left Mouse Button_ + _Drag_ = Rotate
* _Middle Mouse Button_ + _Drag_ = Pan
* _Right Mouse Button_ + _Drag_ = Zoom
* _Middle Mouse Button_ + _Drag_ (or _Left Mouse Button_ + _Ctrl_) = Pan
* _Right Mouse Button_ + _Drag_ (or _Left Mouse Button_ + _Shift_) = Zoom
* _Mouse Wheel_ = Zoom

### Debugging Objects
Expand Down
6 changes: 3 additions & 3 deletions cq_editor/widgets/occt_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ def mouseMoveEvent(self,event):
pos = event.pos()
x,y = pos.x(),pos.y()

if event.buttons() == Qt.LeftButton:
if event.buttons() == Qt.LeftButton and event.modifiers() not in (Qt.ShiftModifier, Qt.ControlModifier):
self.view.Rotation(x,y)

elif event.buttons() == Qt.MiddleButton:
elif event.buttons() == Qt.MiddleButton or (event.buttons() == Qt.LeftButton and event.modifiers() == Qt.ControlModifier):
self.view.Pan(x - self.old_pos.x(),
self.old_pos.y() - y, theToStart=True)

elif event.buttons() == Qt.RightButton:
elif event.buttons() == Qt.RightButton or (event.buttons() == Qt.LeftButton and event.modifiers() == Qt.ShiftModifier):
self.view.ZoomAtPoint(self.old_pos.x(), y,
x, self.old_pos.y())

Expand Down