X 1.0rc1: [Java] using setROI() a match's region is reported relative to ROI top left, not screen's top left

Asked by someotherperson432423423

This took me a while to debug, but whenever I try to set a rectangle on my screen object in Java code, it will skew where it finds the match/where it clicks.

For example: Here's some sikuli script code with equivalent Java code.

Screen(1).setROI(Region(-1300,81,924,784))
Screen(1).click(Pattern("lowerLeftHUD.png").targetOffset(70,0))

currentScreen.setROI(-1300,81,924,784); //Same thing happens with setRect, though I doubt this matters
currentScreen.click("/lowerLeftHUD.png", 0); //The offset in the java code has already been set.

Here's what they both find.

IDE:
[info] click on (-893,686), MOD: 0
[debug] showTarget -933 646 80 80

Java
[info] click on (-753,766), MOD: 0
[debug] showTarget -793 726 80 80

It seems if I mess with the Region in Java slightly, I was able to get it to click a little bit elsewhere. Which seems to me that the Region is affecting the match/click point which is kinda scary. The current work-around is to just not restrict the search area in Java. The bug seems to not occur when I just search the whole screen but this sorta takes away a very helpful feature for Java Sikuli.

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
someotherperson432423423 (someotherperson432423423-deactivatedaccount) said :
#1

Checked again, this does seem to be what's happening. Thanks Raiman!

Revision history for this message
RaiMan (raimund-hocke) said :
#2

bug reported