2D Toolkit Forum
2D Toolkit => Support => Topic started by: play-i on April 21, 2014, 05:08:00 pm
-
Hi -
unity & 2dtk noob here, so apologies if this is covered ground.
I'd like to be able to get an event on a button when a touch that is already down moves into the button.
Eg: touch down in empty space, then slide into the button.
Another example would be touching down in the button (we get OnDownUIItem), then slide out into empty space (we get OnUpUIItem), then slide back in (we get nothing).
Without this, it's impossible to build say a piano keyboard UI which allows the user to do a glissando.
These events would maybe be named "OnEnter" and "OnExit" or something.
this may be similar to this post: http://2dtoolkit.com/forum/index.php/topic,3515.msg16836.html .
cheers,
Orion
-
I tried adding an UpdateTouch() method, but it doesn't seem to be be getting fired (either in Unity or on iOS simulator).
The class is structured like this:
public class KeyboardButton : tk2dUIBaseItemControl {
...
public void UpdateTouch(tk2dUITouch touch) {
Debug.Log("touch");
}
...
}
I guess an approach could be to go through tk2dUIManager:CheckInputs() and track an additional item called "enteredUIItem" or similar,
and a bool in tk2dUIItem called "isEntered", etc. Would need to modify CurrentOverUIItem() as well. Seems like a fair bit of patching.
-
This isn't officially supported and yes it'll need a bit of patching in. This has been requested in the past and is in the roadmap (https://trello.com/c/GtTCPbJq/45-hover-support-with-multitouch-finger-dragged-into-a-control-without-being-tapped) but hasn't really received very many votes.
It can be handled the same way hover is handled right now.
-
hey - thanks for the reply.
I voted for the trello card. Meanwhile if our need is strong enough I'll try patching it in myself.
cheers,
Orion