Button click area problems
indra-uolles opened this issue · comments
I'm making a splash screen. It has a background image and a button on it. Background image is jpg (1200x520) and button image is png (105x75). Code looks like this:
splash = g.group();
bg = g.sprite("background.jpg");
bg.x = 0;
bg.y = 0;
splash.addChild(bg);
var buttonFrames = g.frames(
"assets/images/howtobtn2.png",
[[0,0],[0,50],[0,75]],
105, 25
);
howtoBtn = g.button(buttonFrames);
howtoBtn.x = 100;
howtoBtn.y = 207;
splash.addChild(howtoBtn);
howtoBtn.release = function(){
g.state = howto;
};
I don't understand why click area (where pointer appears) is above the button image, not right over it. If I don't assert howtoBtn coordinates then click area position is ok.
The problem was in
g.scaleToWindow();
I commented it and click area was fixed.
@indra-uolles PR #80 should fix this issue without a need to remove screen scaling. 😃