Merge pull request #627 from LmeSzinc/dev

Bug fix
This commit is contained in:
LmeSzinc 2024-09-11 00:59:26 +08:00 committed by GitHub
commit 461e037fd3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 5 deletions

View File

@ -2,7 +2,23 @@ import itertools
from pponnxcr.predict_system import BoxedResult
from module.base.utils import area_in_area, area_offset
from module.base.utils import area_center, area_in_area, area_offset
def area_distance(area1, area2):
"""
Get the distance of 2 area center
Args:
area1: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y)
area2: (upper_left_x, upper_left_y, bottom_right_x, bottom_right_y)
Returns:
float:
"""
x1, y1 = area_center(area1)
x2, y2 = area_center(area2)
return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5
def area_cross_area(area1, area2, thres_x=20, thres_y=20):
@ -83,8 +99,9 @@ def pair_buttons(group1, group2, relative_area):
"""
for button1 in group1:
area = area_offset(relative_area, offset=button1.area[:2])
for button2 in group2:
if area_in_area(button2.area, area, threshold=0):
combine = [(area_distance(area, b.area), b) for b in group2 if area_in_area(b.area, area, threshold=0)]
combine = sorted(combine, key=lambda x: x[0])
for _, button2 in combine[:1]:
yield button1, button2

View File

@ -15,7 +15,7 @@ from tasks.assignment.assets.assets_assignment_ui import *
from tasks.assignment.keywords import *
from tasks.base.assets.assets_base_page import ASSIGNMENT_CHECK
from tasks.base.ui import UI
from tasks.dungeon.ui import DungeonTabSwitch
from tasks.dungeon.ui.nav import DungeonTabSwitch
class AssignmentStatus(Enum):

View File

@ -21,6 +21,8 @@ class OcrPlaneName(OcrWhiteLetterOnComplexBackground):
result = re.sub(r'Y/?$', '', result)
# Stargazer Navatia -> Stargazer Navalia
result = result.replace('avatia', 'avalia')
# 苏乐达™热砂海选会场
result = re.sub(r'(苏乐达|蘇樂達|SoulGlad|スラーダ|FelizAlma)[rtT]*M*', r'\1', result)
# DomainiRespite
result = result.replace('omaini', 'omain')
# Domain=Combat