Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button click area problems #65

Open
indra-uolles opened this issue Sep 19, 2017 · 2 comments · May be fixed by #80
Open

Button click area problems #65

indra-uolles opened this issue Sep 19, 2017 · 2 comments · May be fixed by #80

Comments

@indra-uolles
Copy link

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.

@indra-uolles
Copy link
Author

The problem was in

g.scaleToWindow();

I commented it and click area was fixed.

@cdrch
Copy link

cdrch commented Jul 31, 2021

@indra-uolles PR #80 should fix this issue without a need to remove screen scaling. 😃

@cdrch cdrch linked a pull request Jul 31, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants