Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: kamil.slawicki on January 20, 2014, 11:37:15 AM
-
Hi there.
I am writing an extension tool for NGUI that will let you manipulate the four corners of the widget in order to make quadrilateral widgets of any shape. I am making a new widget type deriving from UIWidget. I would like to know if there is any sort of callback that would let me know that the pivot of a widget has changed. I noticed that all the processing is done inside the pivot property. What I need to do is to change the position of the vertexes that describe the mesh so they would match the new pivot point. I would like to get the tool working without altering NGUI source code. Any information would be much appreciated. Thanks.
-
I would strongly advise you against modifying the 4 corners of the widget. The 4 corners define the widget's area, and are meant to be a rectangle (which is why UIWidget derives from UIRect!).
If you want an irregular widget, that's fine -- it's up to you what's drawn after all. Have your custom widget define other (internal) points that reside inside the rectangle which you will then use to draw the widget in some fashion.
I recommend keeping them in 0 to 1 range as well, 0 being the bottom/left, and 1 being top/right. This way it will work properly when the widget's dimensions get resized.