1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-12 01:38:21 +08:00

Fix: Scroll disappear when trying to drag it

A random issue in commission scanning
This commit is contained in:
LmeSzinc
2022-03-01 23:20:24 +08:00
parent 1bb2f48b0a
commit 3bfa8d00ed

View File

@@ -64,7 +64,7 @@ class Scroll:
position = (middle - self.length / 2) / (self.total - self.length)
position = position if position > 0 else 0.0
position = position if position < 1 else 1.0
logger.attr(self.name, f'{position:.2f}')
logger.attr(self.name, f'{position:.2f} ({middle}-{self.length / 2})/({self.total}-{self.length})')
return position
def position_to_screen(self, position, random_range=(-0.05, 0.05)):
@@ -132,6 +132,9 @@ class Scroll:
current = self.cal_position(main)
if abs(position - current) < self.drag_threshold:
break
if not self.length:
logger.warning('Scroll disappeared, assume scroll set')
break
if self.drag_interval.reached():
p1 = random_rectangle_point(self.position_to_screen(current), n=1)