图标升级
This commit is contained in:
@@ -223,14 +223,11 @@ class GCodeViewerWidget(QOpenGLWidget):
|
||||
"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
|
||||
|
||||
|
||||
# 请求 OpenGL ES 2.0 上下文
|
||||
fmt = QSurfaceFormat()
|
||||
fmt.setRenderableType(QSurfaceFormat.RenderableType.OpenGLES)
|
||||
fmt.setVersion(2, 0)
|
||||
|
||||
|
||||
super().__init__(parent)
|
||||
self.setMinimumSize(400, 300)
|
||||
self.setAttribute(Qt.WidgetAttribute.WA_AcceptTouchEvents, True)
|
||||
@@ -276,6 +273,7 @@ class GCodeViewerWidget(QOpenGLWidget):
|
||||
self._pinch_start_center = None
|
||||
self._pinch_start_trans = (0.0, 0.0)
|
||||
self._ignore_wheel = False
|
||||
self._rot_sensitivity = 0.1
|
||||
|
||||
# 着色器程序
|
||||
self.shader_program = None
|
||||
@@ -491,9 +489,9 @@ class GCodeViewerWidget(QOpenGLWidget):
|
||||
dx = event.position().x() - self.last_mouse_pos.x()
|
||||
dy = event.position().y() - self.last_mouse_pos.y()
|
||||
if event.buttons() & Qt.MouseButton.LeftButton:
|
||||
self.view_rot_x += dy * 0.5
|
||||
self.view_rot_x += dy * self._rot_sensitivity
|
||||
self.view_rot_x = max(-90.0, min(0.0, self.view_rot_x)) # 限制垂直视角的翻转
|
||||
self.view_rot_z += dx * 0.5
|
||||
self.view_rot_z += dx * self._rot_sensitivity
|
||||
self.last_mouse_pos = event.position()
|
||||
self.update()
|
||||
|
||||
@@ -536,9 +534,9 @@ class GCodeViewerWidget(QOpenGLWidget):
|
||||
last = self._touch_points[p.id()]
|
||||
dx = p.position().x() - last.x()
|
||||
dy = p.position().y() - last.y()
|
||||
self.view_rot_x += dy * 0.5
|
||||
self.view_rot_x += dy * self._rot_sensitivity
|
||||
self.view_rot_x = max(-90.0, min(0.0, self.view_rot_x)) # 限制垂直视角的翻转
|
||||
self.view_rot_z += dx * 0.5
|
||||
self.view_rot_z += dx * self._rot_sensitivity
|
||||
self._touch_points[p.id()] = p.position()
|
||||
self.update()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user