mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Fix: Handle camera position offset in full_scan
This commit is contained in:
parent
39c4f62052
commit
14f6e51f20
@ -52,14 +52,19 @@ class Camera(InfoHandler):
|
||||
vector = np.array([0.5, 0.5]) - self.view.center_offset + vector
|
||||
self._map_swipe(vector)
|
||||
|
||||
def focus_to_grid_center(self):
|
||||
def focus_to_grid_center(self, tolerance=None):
|
||||
"""
|
||||
Re-focus to the center of a grid.
|
||||
|
||||
Args:
|
||||
tolerance (float): 0 to 0.5. If None, use MAP_GRID_CENTER_TOLERANCE
|
||||
|
||||
Returns:
|
||||
bool: Map swiped.
|
||||
"""
|
||||
if np.any(np.abs(self.view.center_offset - 0.5) > self.config.MAP_GRID_CENTER_TOLERANCE):
|
||||
if not tolerance:
|
||||
tolerance = self.config.MAP_GRID_CENTER_TOLERANCE
|
||||
if np.any(np.abs(self.view.center_offset - 0.5) > tolerance):
|
||||
logger.info('Re-focus to grid center.')
|
||||
self.map_swipe((0, 0))
|
||||
return True
|
||||
@ -222,6 +227,7 @@ class Camera(InfoHandler):
|
||||
|
||||
queue = queue.sort_by_camera_distance(self.camera)
|
||||
self.focus_to(queue[0])
|
||||
self.focus_to_grid_center(0.25)
|
||||
self.view.predict()
|
||||
success = self.map.update(grids=self.view, camera=self.camera, mode=mode)
|
||||
if not success:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user