int PPVertualKey::nearTouch(PPPoint pos,PPPoint* outPos)
{
	int r=-1;
	if (touchCount() > 0) {
		PPGameState st=world()->projector->st;
		float len=0;
		for (int i=0;i<touchCount();i++) {
			PPPoint p = touchPosition(i);
			p=p-st.offset;
			p=p/st.scale;
			if (i==0) {
				len = p.length(pos);
				*outPos=p;
				r=i;
			} else {
				float l=p.length(pos);
				if (l<len) {
					len=l;
					*outPos=p;
					r=i;
				}
			}
		}
	}
	return r;
}
bool ScrollViewSlideEffect::OnScrollTouched(Actor actor, const TouchEvent& event)
{
  // Ignore events with multiple-touch points
  if (event.GetPointCount() != 1)
  {
    return false;
  }

  if (event.GetPoint(0).state == TouchPoint::Down)
  {
    const TouchPoint& point = event.GetPoint(0);
    Vector3 touchPosition(point.local - Stage::GetCurrent().GetSize() * 0.5f);

    Vector3 scrollPosition = GetScrollView().GetCurrentScrollPosition();
    GetScrollView().SetProperty(mPropertyReference, scrollPosition + touchPosition + mDelayReferenceOffset);
  }

  return false;
}