Align AVA2 Windows behavior and improve mobile touch interactions
This commit is contained in:
@@ -25,13 +25,8 @@ class MobileJoystick(ui.Window):
|
||||
self.base_bar = widgets.MakeDisc(self, 0, 0, radius * 2, widgets.STYLE_JOY_BASE)
|
||||
self.knob = widgets.MakeDisc(self, 0, 0, knob_radius * 2, widgets.STYLE_JOY_KNOB)
|
||||
|
||||
# 未按下时停在默认位置,提示摇杆区
|
||||
if base_y is None:
|
||||
import wndMgr
|
||||
base_y = wndMgr.GetScreenHeight() - 180
|
||||
self.rest_x = base_x
|
||||
self.rest_y = base_y
|
||||
self.__Place(base_x, base_y, base_x, base_y)
|
||||
self.base_bar.Hide()
|
||||
self.knob.Hide()
|
||||
|
||||
def __del__(self):
|
||||
ui.Window.__del__(self)
|
||||
@@ -45,5 +40,8 @@ class MobileJoystick(ui.Window):
|
||||
active, base_x, base_y, knob_x, knob_y = touch.GetJoystick()
|
||||
if active:
|
||||
self.__Place(base_x, base_y, knob_x, knob_y)
|
||||
self.base_bar.Show()
|
||||
self.knob.Show()
|
||||
else:
|
||||
self.__Place(self.rest_x, self.rest_y, self.rest_x, self.rest_y)
|
||||
self.base_bar.Hide()
|
||||
self.knob.Hide()
|
||||
|
||||
Reference in New Issue
Block a user