solarSystemMapCameraController.py (2306B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\camera\solarSystemMapCameraController.py 2 import math 3 import evecamera 4 from carbonui.uianimations import animations 5 from eve.client.script.ui.camera.cameraUtil import CheckInvertZoom 6 from eve.client.script.ui.camera.mapCameraController import MapCameraController 7 from eve.client.script.ui.inflight.scannerFiles.directionalScanUtil import SetScanModeTarget, IsDscanShortcutPressed 8 from carbonui.uicore import uicore 9 10 class SolarSystemMapCameraController(MapCameraController): 11 cameraID = evecamera.CAM_SOLARSYSTEMMAP 12 kPan = 2.0 13 14 def SetTopView(self): 15 camera = self.GetCamera() 16 camera.StopUpdateThreads() 17 duration = max(0.1, math.fabs(camera.pitch - camera.kMinPitch) * 0.2) 18 animations.MorphScalar(camera, 'pitch', camera.pitch, camera.kMinPitch, duration=duration) 19 20 def SetSideView(self): 21 camera = self.GetCamera() 22 camera.StopUpdateThreads() 23 duration = max(0.1, math.fabs(camera.pitch - math.pi / 2) * 0.2) 24 animations.MorphScalar(camera, 'pitch', camera.pitch, math.pi / 2, duration=duration) 25 26 def ToggleCameraView(self): 27 camera = self.GetCamera() 28 if camera.pitch < math.pi / 4: 29 self.SetSideView() 30 else: 31 self.SetTopView() 32 33 def OnMouseMove(self, *args): 34 if uicore.uilib.leftbtn and not uicore.uilib.rightbtn and IsDscanShortcutPressed(): 35 self.OrbitPrimarySpaceCamera() 36 else: 37 camera = self.GetCamera() 38 if uicore.uilib.leftbtn and uicore.uilib.rightbtn: 39 camera.Zoom(-CheckInvertZoom(uicore.uilib.dy) * 0.005) 40 elif uicore.uilib.leftbtn: 41 k = 0.01 42 camera.Orbit(k * self.GetMouseDX(), k * self.GetMouseDY()) 43 elif uicore.uilib.rightbtn: 44 self.Pan(camera) 45 if uicore.uilib.rightbtn and not uicore.uilib.leftbtn: 46 SetScanModeTarget() 47 48 def OrbitPrimarySpaceCamera(self): 49 camera = sm.GetService('sceneManager').GetActivePrimaryCamera() 50 k = 0.005 51 camera.Orbit(k * self.GetMouseDX(), k * self.GetMouseDY()) 52 53 def OnMouseWheel(self, *args): 54 MapCameraController.OnMouseWheel(self, *args)