Support => NGUI 3 Support => Topic started by: FredericRP on March 27, 2013, 10:15:20 AM
Title: [SOLVED] Drag and Drop with FixedSize UIRoot
Post by: FredericRP on March 27, 2013, 10:15:20 AM
Hello there,
I'm using drag and drop items in my scene with a UIRoot that is set to FixedSize. The issue I encounter is that the items are not displayed at the mouse position (they appear to move slower than mouse when the actual screen resolution is lesser than the manual height of UIRoot), but when dropping it, it's correct : it uses the mouse position and not the displayed position (the lastHit of UICamera is correct). It behaves as if it did not use the manuel height from the UIRoot but I don't know how to fix this: should I make another DragDropItem class that update the DragDropItem position using some ratio from UIRoot, or anything else ?
I haven't seen anything on the forum regarding my specific issue, but if there's one, feel free to post a link ! Thanks for anyone that can help me fix this and happy GDC to ArenMook !
FredericRP.
Title: Re: Drag and Drop with FixedSize UIRoot
Post by: ArenMook on March 27, 2013, 08:39:31 PM
Make sure to take UIRoot.pixelSizeAdjustment into account when dragging.
Title: Re: Drag and Drop with FixedSize UIRoot
Post by: FredericRP on March 28, 2013, 04:16:44 AM
I was investigating that way but didn't manage to solve it. Thanks to you, its' fixed now ! I was wondering if I had to use it for the initial position also, but that would be a no.
The solution, if someone wants to know, is to update the position within OnDrag using :
For test purpose, I changed the DragDropItem class included within NGUI, but I will make a new class to avoir losing that fix with the next release. BTW, is there any reason why it couldn't be included by default ?