Author Topic: Repositioning widgets to be visible after a resolution change  (Read 11749 times)

Wumpee

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 53
    • View Profile
Repositioning widgets to be visible after a resolution change
« on: November 28, 2014, 04:52:10 AM »
How should I best go about getting widgets to keep themselves visible (i.e. fully on-screen) when a user quits out and loads back in with a different screen resolution?

e.g. User places their character info widget in the top left corner of the screen while running the game at a 16:9 resolution, they exit the game, which saves the position and size of the widget. Then they reload the game in 4:3 - the widget now gets re-positioned to be off-screen, and is potentially irretrievable unless they change resolutions back.

Is there any functionality in place to snap a UIWidget based widget so that it is fully visible?

Or is there another way to be looking at this issue that I'm not considering? Obviously anchoring everything in place prevents this, but when you want the user to be able to move a widget / panel such as a chat window and have it remember the position, achoring doesn't appear to be ideal, except when they run the client the first time.

Is UIDragObject the only component with this functionality?

Also, why doesn't UIDragResize have a flag to prevent resizing past the screen bounds?
« Last Edit: November 30, 2014, 11:57:51 PM by Wumpee »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Repositioning widgets to be visible after a resolution change
« Reply #1 on: November 30, 2014, 05:16:54 AM »
You'd need to store not pixel values, but rather relative position instead. Either that, or do your own checks on startup that would see if the widget is within visible bounds or not.

Not sure what you mean about dragresize? You can specify the min/max values on it.

Wumpee

  • Jr. Member
  • **
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Repositioning widgets to be visible after a resolution change
« Reply #2 on: November 30, 2014, 11:56:38 PM »
Yes you can specify the min / max values for DragResize, but what I was getting at is that it can be resized so that the bottom of the widget is below the bottom of the screen (easy to do if running the app in windowed mode, or in the editor). It would be nice if there were an option to prevent this.