Resizing leads to artifacts

Hello,



I am using Nifty on a JMECanvas with the default styles and controls. There are several issues:

  • After the application starts, the button targets are a little off, i.e. one has to click slightly beneath the buttons to register a click. This stops after the canvas is resized.
  • When I resize the canvas, Nifty scales it’s buttons nicely except the button selection overlay. That is, for example (with default styles) I have several grey buttons. After I clicked a button, it is overlayed red. Now this red overlay does not scale when the canvas is resized.



    Is there some nifty.update() I have to call?

Have you tried just doing a layoutElements on the while nifty screen?

@zarch said:
Have you tried just doing a layoutElements on the while nifty screen?


Just tried calling it from simpleUpdate each frame as a test, but it does nothing. What makes me suspicious is that
After the application starts, the button targets are a little off, i.e. one has to click slightly beneath the buttons to register a click. This stops after the canvas is resized.
hints that there actually is such an update method. Only it is neither layoutElements() nor update().

All I can suggest is a search on the nifty API. I do vaguely remember seeing something along these lines but I can’t remember what/where.



It might even be on the main nifty object.

Well, after messing around a bit on the nifty object to no avail, I just issued a reshape manually. :stuck_out_tongue:

Anything about the 2nd problem?


When I resize the canvas, Nifty scales it’s buttons nicely *except* the button selection overlay. That is, for example (with default styles) I have several grey buttons. After I clicked a button, it is overlayed red. Now this red overlay does not scale when the canvas is resized.

In nifty there a method that you have to call after resolution has changed, I don’t remember the name of it and I’m about to leave so I can’t take the time to look for it, but it’s definitively there.



Calling it will most likely fix your problem.