Author Topic: Positioning of UIScrollbar widgets and nine-slicing  (Read 5562 times)

ryan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 90
    • View Profile
Positioning of UIScrollbar widgets and nine-slicing
« on: July 16, 2012, 04:01:45 PM »
Would it be possible to get some sort of option in UIScrollbar so that when it positions the foreground sprite, it ignores the sprites' borders?  I have a scrollbar with a sliced foreground and a non-sliced background, and the foreground ends up extending past the ends of the background.  I can also have an artist adjust my background sprite so I can specify matching borders, but the flexibility would be nice.

JRoch

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
Re: Positioning of UIScrollbar widgets and nine-slicing
« Reply #1 on: July 16, 2012, 04:08:09 PM »
Things I found that help with that:

  • Make sure the sprites for both the backdrop and the thumb have no padding on any edge
  • Only have a border edge on the tips of the thumb that shouldn't be stretched, so 3-sliced instead of 9-sliced
  • Don't fight with the scrollbar logic and try to resize/reposition the sprites to compensate, you will lose and be frustrated

ryan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 90
    • View Profile
Re: Positioning of UIScrollbar widgets and nine-slicing
« Reply #2 on: July 16, 2012, 04:27:47 PM »
Yeah, there's no padding involved, and my foreground is 3-sliced.  My problem is that the top and bottom borders of the sprite make up about 90% of the sprite's original height.  With no borders at all on the background, the thumb ends up extending about 20 pixels above or below the edge of the background.  In this case the art can be modified to work more as the code intended, but assuming that won't always be an option, I thought I'd make the request.