private void ListCover_Touch(UIControl sender, TouchData e, ref bool handled) { switch (e.Action) { case TouchData.ActionEnum.Down: if (VisibleInHierarchy && EnabledInHierarchy) //&& !ReadOnlyInHierarchy && touchDown == null ) { var list = GetDownList(); if (list != null && !list.GetScreenRectangle().Contains(e.Position)) { var item = new TouchData.TouchDownRequestToProcessTouch(this, 10, 0, null, delegate(UIControl sender2, TouchData touchData, object anyData) { list.Visible = false; }); e.TouchDownRequestToControlActions.Add(item); } } break; //case TouchData.ActionEnum.Up: // break; //case TouchData.ActionEnum.Move: // break; //case TouchData.ActionEnum.Cancel: // break; //case TouchData.ActionEnum.Outside: // break; } }
protected override bool OnTouch(TouchData e) { switch (e.Action) { case TouchData.ActionEnum.Down: if (VisibleInHierarchy && EnabledInHierarchy && !ReadOnlyInHierarchy && touchDown == null) { GetScreenRectangle(out var rect); var rectInPixels = rect * ParentContainer.Viewport.SizeInPixels.ToVector2(); var distanceInPixels = rectInPixels.GetPointDistance(e.PositionInPixels.ToVector2()); var item = new TouchData.TouchDownRequestToProcessTouch(this, 1, distanceInPixels, null, delegate(UIControl sender, TouchData touchData, object anyData) { //start touch touchDown = e.PointerIdentifier; var index = GetListItemIndexByScreenPosition(e.Position); if (index != -1) { SelectedIndex = index; } }); e.TouchDownRequestToControlActions.Add(item); } break; case TouchData.ActionEnum.Up: if (touchDown != null && ReferenceEquals(e.PointerIdentifier, touchDown)) { touchDown = null; } break; case TouchData.ActionEnum.Move: if (touchDown != null && ReferenceEquals(e.PointerIdentifier, touchDown)) { var index = GetListItemIndexByScreenPosition(e.Position); if (index != -1) { SelectedIndex = index; } } break; //case TouchData.ActionEnum.Cancel: // break; //case TouchData.ActionEnum.Outside: // break; } return(base.OnTouch(e)); }
protected override bool OnTouch(TouchData e) { switch (e.Action) { case TouchData.ActionEnum.Down: if (VisibleInHierarchy && EnabledInHierarchy && !ReadOnlyInHierarchy && touchDown == null) { GetScreenRectangle(out var rect); var rectInPixels = rect * ParentContainer.Viewport.SizeInPixels.ToVector2(); var distanceInPixels = rectInPixels.GetPointDistance(e.PositionInPixels.ToVector2()); var item = new TouchData.TouchDownRequestToProcessTouch(this, 0, distanceInPixels, null, delegate(UIControl sender, TouchData touchData, object anyData) { //start touch touchDown = e.PointerIdentifier; touchDownPointerInside = true; }); e.TouchDownRequestToControlActions.Add(item); } break; case TouchData.ActionEnum.Up: if (touchDown != null && ReferenceEquals(e.PointerIdentifier, touchDown)) { if (VisibleInHierarchy && EnabledInHierarchy && !ReadOnlyInHierarchy && touchDownPointerInside) { PerformClick(); } touchDown = null; touchDownPointerInside = false; } break; case TouchData.ActionEnum.Move: if (touchDown != null && ReferenceEquals(e.PointerIdentifier, touchDown)) { touchDownPointerInside = CheckTouchPointerInside(e.PositionInPixels); } break; } return(base.OnTouch(e)); }
private void TextControl_Touch(UIControl sender, TouchData e, ref bool handled) { switch (e.Action) { case TouchData.ActionEnum.Down: if (VisibleInHierarchy && EnabledInHierarchy) //&& !ReadOnlyInHierarchy )//&& touchDown == null ) { GetScreenRectangle(out var rect); var rectInPixels = rect * ParentContainer.Viewport.SizeInPixels.ToVector2(); var distanceInPixels = rectInPixels.GetPointDistance(e.PositionInPixels.ToVector2()); var item = new TouchData.TouchDownRequestToProcessTouch(this, 0, distanceInPixels, null, delegate(UIControl sender2, TouchData touchData, object anyData) { //touch var list = GetDownList(); if (list != null) { var show = !list.Visible; list.Visible = show; //list.Capture = show; } }); e.TouchDownRequestToControlActions.Add(item); } break; //case TouchData.ActionEnum.Up: // break; //case TouchData.ActionEnum.Move: // break; //case TouchData.ActionEnum.Cancel: // break; //case TouchData.ActionEnum.Outside: // break; } }