def onMouseEventsBoatPlot( self, event ):
self.BoatPlot.SetFocus()
pos = event.GetPosition()
if event.LeftDown():
self.lastmouse = pos
if event.Dragging():
dx, dy = pos[0] - self.lastmouse[0], pos[1] - self.lastmouse[1]
q = pypilot.quaternion.angvec2quat((dx**2 + dy**2)**.4/180*math.pi, [dy, dx, 0])
self.boat_plot.Q = pypilot.quaternion.multiply(q, self.boat_plot.Q)
self.BoatPlot.Refresh()
self.lastmouse = pos
rotation = event.GetWheelRotation() / 60
if rotation:
self.BoatPlot.Refresh()
while rotation > 0:
self.boat_plot.Scale /= .9
rotation -= 1
while rotation < 0:
self.boat_plot.Scale *= .9
rotation += 1
评论列表
文章目录