本文整理汇总了C#中UITouch.LocationInView方法的典型用法代码示例。如果您正苦于以下问题:C# UITouch.LocationInView方法的具体用法?C# UITouch.LocationInView怎么用?C# UITouch.LocationInView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UITouch
的用法示例。
在下文中一共展示了UITouch.LocationInView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ContinueTracking
public override bool ContinueTracking(UITouch uitouch, UIEvent uievent)
{
if (!minThumbOn && !maxThumbOn)
return true;
var touchPoint = uitouch.LocationInView (this);
if (minThumbOn)
{
minThumb.Center = new PointF(Math.Max (
XForValue(MinValue), Math.Min(touchPoint.X - distanceFromCenter, XForValue(SelectedMaxValue - MinRange))), minThumb.Center.Y - Frame.Top);
SelectedMinValue = ValueForX (minThumb.Center.X);
}
if (maxThumbOn)
{
maxThumb.Center = new PointF(Math.Min (
XForValue(MaxValue),
Math.Max(
touchPoint.X - distanceFromCenter,
XForValue(SelectedMinValue + MinRange)
)
), maxThumb.Center.Y - Frame.Top);
SelectedMaxValue = ValueForX (maxThumb.Center.X);
}
UpdateTrackHighlight();
this.SetNeedsLayout();
if (ThumbChanged != null) ThumbChanged(this);
return true;
}
示例2: AddSpot
protected void AddSpot (UITouch touch)
{
// create a random color spot at the point of touch, then add it to the others
Spot spot = Spot.CreateNewRandomColor (touch.LocationInView (this));
touchSpots.Add (spot);
// tell the OS to redraw
SetNeedsDisplay ();
}
示例3: BeginTracking
public override bool BeginTracking(UITouch uitouch, UIEvent uievent)
{
var touchPoint = uitouch.LocationInView (this);
if (minThumb.Frame.Contains (touchPoint)) {
minThumbOn = true;
distanceFromCenter = touchPoint.X - minThumb.Center.X;
} else if (maxThumb.Frame.Contains (touchPoint)) {
maxThumbOn = true;
distanceFromCenter = touchPoint.X - maxThumb.Center.X;
}
return true;
}
示例4: BeginTracking
public override bool BeginTracking(UITouch uitouch, UIEvent uievent)
{
var TouchPoint = uitouch.LocationInView (this);
if (_leftKnobLayer.Frame.Contains (TouchPoint)) {
_leftTouchPoint = TouchPoint;
_leftKnobLayer.Highlighted = true;
_leftKnobLayer.SetNeedsDisplay ();
}
else if (_rightKnobLayer.Frame.Contains (TouchPoint)) {
_rightTouchPoint = TouchPoint;
_rightKnobLayer.Highlighted = true;
_rightKnobLayer.SetNeedsDisplay ();
}
return _leftKnobLayer.Highlighted || _rightKnobLayer.Highlighted;
}
示例5: ContinueTracking
public override bool ContinueTracking(UITouch uitouch, UIEvent uievent)
{
var TouchPoint = uitouch.LocationInView (this);
if (_leftKnobLayer.Highlighted) {
_leftTouchPoint = TouchPoint;
} else if (_rightKnobLayer.Highlighted) {
_rightTouchPoint = TouchPoint;
}
CATransaction.Begin ();
CATransaction.DisableActions = true;
SetLayerFrames ();
CATransaction.Commit ();
return _leftKnobLayer.Highlighted || _rightKnobLayer.Highlighted;
}
示例6: LinePoint
public LinePoint (UITouch touch, int sequenceNumber, PointType pointType)
{
SequenceNumber = sequenceNumber;
Type = touch.Type;
PointType = pointType;
Timestamp = touch.Timestamp;
var view = touch.View;
Location = touch.LocationInView (view);
PreciseLocation = touch.GetPreciseLocation (view);
AzimuthAngle = touch.GetAzimuthAngle (view);
EstimatedProperties = touch.EstimatedProperties;
EstimatedPropertiesExpectingUpdates = touch.EstimatedPropertiesExpectingUpdates;
AltitudeAngle = touch.AltitudeAngle;
Force = (Type == UITouchType.Stylus || touch.Force > 0) ? touch.Force : 1f;
if (EstimatedPropertiesExpectingUpdates != 0)
PointType = this.PointType.Add (PointType.NeedsUpdate);
EstimationUpdateIndex = touch.EstimationUpdateIndex;
}
示例7: BeginTracking
public override bool BeginTracking(UITouch touch, UIEvent uievent)
{
_previousTouchPoint = (CGPoint)touch.LocationInView((UIView)this);
// hit test the knob layers
if (_lowerKnobLayer.PaintFrame.Contains(_previousTouchPoint))
{
_lowerKnobLayer.Highlighted = true;
_lowerKnobLayer.SetNeedsDisplay();
}
else if (_upperKnobLayer.PaintFrame.Contains(_previousTouchPoint))
{
_upperKnobLayer.Highlighted = true;
_upperKnobLayer.SetNeedsDisplay();
}
RawHighValue = HighValue;
RawLowValue = LowValue;
return _upperKnobLayer.Highlighted || _lowerKnobLayer.Highlighted;
}
示例8: ShouldReceiveTouch
public override bool ShouldReceiveTouch (UIGestureRecognizer recognizer, UITouch touch)
{
return (_controller.Visible ||
(touch.LocationInView (_controller._internalTopView.View).Y <= _controller.SlideHeight)) && (_controller.LeftMenuEnabled || _controller.RightMenuEnabled);
}
示例9: ItemForTouch
private MenuItem ItemForTouch(UITouch touch)
{
PointF touchLocation = touch.LocationInView(touch.View);
touchLocation = Director.Instance.ConvertCoordinate(touchLocation);
foreach (MenuItem item in Children) {
PointF local = item.ConvertToNodeSpace(touchLocation);
RectangleF r = item.Rect;
r.X = 0;
r.Y = 0;
if (r.Contains(local) && item.IsEnabled) {
return item;
}
}
return null;
}
示例10: GetPosition
private System.Drawing.PointF GetPosition(UITouch touch)
{
var p = touch.LocationInView(touch.View);
// convert point to pixels
var scale = touch.View.ContentScaleFactor;
p.X *= scale;
p.Y *= scale;
return p;
}
示例11: GetGestureDirectionWithTouch
UISwipeGestureRecognizerDirection GetGestureDirectionWithTouch(UITouch touch)
{
CGPoint gestureEndPoint = touch.LocationInView(this);
double dx = Math.Abs(this.GestureStartPoint.X - gestureEndPoint.X);
nfloat dy = -1 * (gestureEndPoint.Y - this.GestureStartPoint.Y);
if (dx > 20)
{
return UISwipeGestureRecognizerDirection.Right;
}
if (dy < 0)
{
return UISwipeGestureRecognizerDirection.Down;
}
else if (dy > 0)
{
return UISwipeGestureRecognizerDirection.Up;
}
return UISwipeGestureRecognizerDirection.Down;
}
示例12: GetTouchPoint
private float GetTouchPoint(UITouch touch)
{
var location = touch.LocationInView(this);
var x = location.X;
var y = location.Y;
if (x < _bounds.Left)
x = _bounds.Left;
if (x > _bounds.Right)
x = _bounds.Right;
if (y < _bounds.Top)
y = _bounds.Top;
if (y > _bounds.Bottom)
y = _bounds.Bottom;
_sliderPositionRaw = new CGPoint(x, _bounds.GetMidY());
var scaleX = _bounds.Width / 2f;
x = (x - scaleX) * 100f / scaleX;
System.Diagnostics.Debug.WriteLine($"GetTouchPoint: x={x}");
return (float)x;
}
示例13: ShouldReceiveTouch
public bool ShouldReceiveTouch (UIGestureRecognizer recognizer, UITouch touch)
{
if (leftRingControl.HitTest (touch.LocationInView (leftRingControl), null) != null)
return false;
foreach(var button in buttons) {
if (button.HitTest (touch.LocationInView (clearButton), null) != null)
return false;
}
return true;
}
示例14: GestureRecognizerShouldReceiveTouch
bool GestureRecognizerShouldReceiveTouch(UIGestureRecognizer gestureRecognizer, UITouch touch)
{
if (_ios7) {
if (_interactivePopGestureRecognizerEnabled && (_contentViewController is UINavigationController)) {
UINavigationController navigationController = _contentViewController as UINavigationController;
if (navigationController.ViewControllers.Length > 1 && navigationController.InteractivePopGestureRecognizer.Enabled) {
return false;
}
}
}
if (_panFromEdge && gestureRecognizer is UIPanGestureRecognizer && !Visible) {
var point = touch.LocationInView(gestureRecognizer.View);
if (point.X < 20.0 || point.X > View.Frame.Size.Width - 20.0) {
return true;
} else {
return false;
}
}
return true;
}
示例15: GetTouchingCrayon
Crayon GetTouchingCrayon(UITouch touch)
{
var location = touch.LocationInView (this);
var pos = CRAYON_START - CRAYON_SPACING;
foreach (var crayon in Crayons) {
switch (Orientation) {
case UIInterfaceOrientation.Portrait:
case UIInterfaceOrientation.PortraitUpsideDown:
if ((location.X > Frame.Width - crayon.Length)
&& (location.Y > pos)
&& (location.Y < pos + CRAYON_SPACING / 2 + crayon.Width + CRAYON_SPACING / 2))
return crayon;
break;
case UIInterfaceOrientation.LandscapeLeft:
case UIInterfaceOrientation.LandscapeRight:
if ((location.Y > Frame.Height - crayon.Length)
&& (location.X < Frame.Width - pos)
&& (location.X > Frame.Width - pos - CRAYON_SPACING / 2 - crayon.Width - CRAYON_SPACING / 2))
return crayon;
break;
}
pos += crayon.Width + CRAYON_SPACING;
}
return null;
}