Skip to content
This repository has been archived by the owner on Dec 10, 2017. It is now read-only.

Commit

Permalink
Merge pull request #405 from mrmin123/revise_pattern_generator
Browse files Browse the repository at this point in the history
Revise pattern generator
  • Loading branch information
mrmin123 authored Oct 14, 2017
2 parents 919774c + 12f1c4e commit 6f416ff
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions kancolle_auto.sikuli/util.sikuli/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,14 +580,13 @@ def pattern_generator(kc_region, pic, expand=[], mod=''):
# This slows down the click actions, but it looks for the pattern and
# finds the size of the image from the resulting Pattern object.
if mod == 'prematched':
m = match(r'M\[\d+\,\d+ (\d+)x(\d+)\]', str(kc_region.getLastMatch()))
m = kc_region.getLastMatch()
else:
m = match(r'M\[\d+\,\d+ (\d+)x(\d+)\]', str(find(pic)))
m = find(pic)
if m:
# If a match is found and the x,y sizes can be ascertained, generate
# the random offsets. Otherwise, just click the damn middle.
x_width = int(m.group(1)) / 2
y_height = int(m.group(2)) / 2
# If a match is found, generate the random offsets. Otherwise, just click the damn middle.
x_width = m.w / 2
y_height = m.h / 2
expand = [-x_width, x_width, -y_height, y_height]
if len(expand) == 4:
if isinstance(pic, str):
Expand Down

0 comments on commit 6f416ff

Please sign in to comment.