Page 1 of 1

Weird behaviour from GraphicsContext.button

Posted: Sat Dec 20, 2014 8:39 am
by minmay
I'm making a custom skill system, and I'm noticing some very weird behaviour from the GraphicsContext.button() method. Specifically, the button's position seems to be offset up and to the right. For example, if I have the following code:

Code: Select all

context.drawRect(300,300,50,50)
if context.button("rectButton",300,300,50,50) then
  print("pressed")
end
clicking on the rectangle does nothing. To hit the button, I have to click about 100 pixels to the right and 50 pixels up. This behaviour doesn't change when I'm actually drawing inside the skills area, either. If I put this code in onDrawGui, it works as expected and puts the button directly over the rectangle.