Skip to content

Commit

Permalink
Leave the conditional decision on _calculate_clickpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
lruzicka committed Aug 24, 2020
1 parent 4cbb3d8 commit 75aae2b
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions testapi.pm
Original file line number Diff line number Diff line change
Expand Up @@ -557,25 +557,8 @@ sub click_lastmatch {
}

my ($x, $y);
# If no relevant area has been found, then use _calculate_clickpoint to
# find the last used area and calculate the point as the center of that
# area.
if (!$relevant_area and !$relative_click_point) {
# calculate the click point from the needle itself
($x, $y) = _calculate_clickpoint($last_matched_needle);
}
# when there is a relative area which click point has been defined
# as 'center', then we need to calculate the the actual center of
# the area
elsif ($relative_click_point eq 'center') {
($x, $y) = _calculate_clickpoint($last_matched_needle, $relevant_area, $relative_click_point);
}
else {
# With both the relevant area and the relative click point defined, just calculate
# the absolute position of the click
$x = int($relevant_area->{x} + $relative_click_point->{xpos});
$y = int($relevant_area->{y} + $relative_click_point->{ypos});
}
# Calculate the absolute click point.
($x, $y) = _calculate_clickpoint($last_matched_needle, $relevant_area, $relative_click_point);
bmwqemu::diag("clicking at $x/$y");
mouse_set($x, $y);
if ($args{dclick}) {
Expand Down

0 comments on commit 75aae2b

Please sign in to comment.