PDA

View Full Version : Button click hotspots



BigBMan
03-17-2011, 09:42 PM
I'm noticing that (specifically in Windows) when two buttons are near each other, clicking on the edge of one causes both to activate. Is there any way to control this, or increase the 'touch sensitivity' for components?

Seth
03-18-2011, 01:45 AM
The TouchHandlerComponent automatically adds space around a button to make it more sensitive:

In its OnAdd it changes the "touchPadding" var of the parent entity:


m_pTouchPadding = &GetParent()->GetVarWithDefault(string("touchPadding"), Variant(CL_Rectf(20.0f, 5.0f, 20.0f, 15.0f)))->GetRect();


To disable this extra sensitivity padding, do this to your button entity:


pButtonEnt->GetVar("touchPadding")->Set(CL_Rectf(0,0,0,0));

I think you can also set negative values if you don't want the whole text/bitmap area to be touchable as well.

But on a side note, with recent finger tracking additions it would be pretty simple for me to let buttons "claim" a click and not allow one touch to trigger two buttons at once.. hrm, might add that.