示例#1
0
    def OnMouseWheel(self, event: wx.MouseEvent):
        if self.selection_mode:
            return

        self.camera_interactor.mouse_wheel(event.GetWheelRotation(),
                                           event.GetWheelDelta(),
                                           event.ShiftDown(), event.AltDown(),
                                           event.ControlDown())
        self._x = self._y = -1
        self.Sync()
        self.Refresh()
示例#2
0
    def OnMotion(self, event: wx.MouseEvent):
        x = event.GetX()
        y = event.GetY()
        if event.LeftIsDown():

            # Normal scene movement without selection
            if not self.selection_mode and self._x > -1 and self._y > -1:
                self.camera_interactor.mouse_motion(x - self._x, y - self._y,
                                                    event.ShiftDown(),
                                                    event.AltDown(),
                                                    event.ControlDown())
            self._x = x
            self._y = y

            # Left-mouse drag selection, movement disabled
            if self.selection_mode and self.selection_mode is GLSelectionControls.BOX and \
                    not self.selection_mode_depressed:
                if self.start_x == -1 and self.start_y == -1:
                    self.start_x = self._x
                    self.start_y = self._y
                self.camera.box_select.from_screen_coords(
                    (self.start_x, self.start_y), (self._x, self._y))

            self.Sync()
            self.Refresh()

        # Scene movement with selection enabled
        elif event.RightIsDown() and self.selection_mode:
            if self._x > -1 and self._y > -1:
                self.camera_interactor.mouse_motion(x - self._x, y - self._y,
                                                    event.ShiftDown(),
                                                    event.AltDown(),
                                                    event.ControlDown())
            self._x = x
            self._y = y

        # Reset mouse coordinates
        else:
            self._x = self._y = self.start_x = self.start_y = -1
        event.Skip()