本文整理汇总了C#中UITouch类的典型用法代码示例。如果您正苦于以下问题:C# UITouch类的具体用法?C# UITouch怎么用?C# UITouch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UITouch类属于命名空间,在下文中一共展示了UITouch类的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: EndTracking
public override void EndTracking(UITouch uitouch, UIEvent uievent)
{
_leftKnobLayer.Highlighted = false;
_rightKnobLayer.Highlighted = false;
_leftKnobLayer.SetNeedsDisplay ();
_rightKnobLayer.SetNeedsDisplay ();
}
示例4: BeginTracking
public override bool BeginTracking(UITouch uitouch, UIEvent uievent)
{
if (uievent.Type == UIEventType.Touches)
{
SetNeedsDisplay();
}
return base.BeginTracking(uitouch, uievent);
}
示例5: ContinueTracking
public override bool ContinueTracking (UITouch uitouch, UIEvent uievent)
{
var touch = uievent.AllTouches.AnyObject as UITouch;
if (Bounds.Contains (touch.LocationInView (this)))
isPressed = true;
else
isPressed = false;
return base.ContinueTracking (uitouch, uievent);
}
示例6: EndTracking
public override void EndTracking (UITouch uitouch, UIEvent uievent)
{
if (isPressed && Enabled){
if (Tapped != null)
Tapped (this);
}
isPressed = false;
SetNeedsDisplay ();
base.EndTracking (uitouch, uievent);
}
示例7: EndTracking
public override void EndTracking(UITouch uitouch, UIEvent uievent)
{
if (pressed && Enabled)
{
Tapped?.Invoke(this);
}
pressed = false;
SetNeedsDisplay();
base.EndTracking(uitouch, uievent);
}
示例8: UpdateWithTouch
public bool UpdateWithTouch (UITouch touch)
{
NSNumber estimationUpdateIndex = touch.EstimationUpdateIndex;
if (estimationUpdateIndex != EstimationUpdateIndex)
return false;
// An array of the touch properties that may be of interest.
UITouchProperties[] touchProperties = {
UITouchProperties.Location,
UITouchProperties.Force,
UITouchProperties.Altitude,
UITouchProperties.Azimuth
};
// Iterate through possible properties.
foreach (var expectedProperty in touchProperties) {
// If an update to this property is not expected, continue to the next property.
if (EstimatedPropertiesExpectingUpdates.Has (expectedProperty))
continue;
switch (expectedProperty) {
case UITouchProperties.Force:
Force = touch.Force;
break;
case UITouchProperties.Azimuth:
AzimuthAngle = touch.GetAzimuthAngle (touch.View);
break;
case UITouchProperties.Altitude:
AltitudeAngle = touch.AltitudeAngle;
break;
case UITouchProperties.Location:
Location = touch.LocationInView (touch.View);
PreciseLocation = touch.PreviousLocationInView (touch.View);
break;
}
if (!touch.EstimatedProperties.Has (expectedProperty)) {
// Flag that this point now has a 'final' value for this property.
EstimatedProperties = EstimatedProperties.Remove (expectedProperty);
}
if (!touch.EstimatedPropertiesExpectingUpdates.Has (expectedProperty)) {
// Flag that this point is no longer expecting updates for this property.
EstimatedPropertiesExpectingUpdates = EstimatedPropertiesExpectingUpdates.Remove (expectedProperty);
if (EstimatedPropertiesExpectingUpdates == 0) {
PointType = this.PointType.Remove (PointType.NeedsUpdate);
PointType = this.PointType.Add (PointType.Updated);
}
}
}
return true;
}
示例9: AddPointOfType
public CGRect AddPointOfType(PointType pointType, UITouch touch)
{
var previousPoint = Points.LastOrDefault ();
var previousSequenceNumber = previousPoint != null ? previousPoint.SequenceNumber : -1;
var point = new LinePoint (touch, previousSequenceNumber + 1, pointType);
if (point.EstimationUpdateIndex != null && point.EstimatedPropertiesExpectingUpdates != 0)
pointsWaitingForUpdatesByEstimationIndex [point.EstimationUpdateIndex] = point;
Points.Add (point);
return UpdateRectForLinePoint (point, previousPoint);
}
示例10: 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;
}
示例11: 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;
}
示例12: GetState
private PointerState GetState(UITouch touch)
{
switch (touch.Phase)
{
case UITouchPhase.Began:
return PointerState.Down;
case UITouchPhase.Moved:
case UITouchPhase.Stationary:
return PointerState.Move;
case UITouchPhase.Ended:
return PointerState.Up;
case UITouchPhase.Cancelled:
return PointerState.Cancel;
}
throw new ArgumentException("Got an invalid Touch event in GetState");
}
示例13: 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;
}
示例14: 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;
}
示例15: UpdateReticleView
void UpdateReticleView (UITouch touch, bool predicated = false)
{
if (touch == null)
return;
ReticleView.PredictedDotLayer.Hidden = !predicated;
ReticleView.PredictedLineLayer.Hidden = !predicated;
ReticleView.Center = touch.LocationInView (touch.View);
var azimuthAngle = touch.GetAzimuthAngle (touch.View);
var azimuthUnitVector = touch.GetAzimuthUnitVector (touch.View);
var altitudeAngle = touch.AltitudeAngle;
if (predicated) {
ReticleView.PredictedAzimuthAngle = azimuthAngle;
ReticleView.PredictedAzimuthUnitVector = azimuthUnitVector;
ReticleView.PredictedAzimuthAngle = altitudeAngle;
} else {
ReticleView.ActualAzimuthAngle = azimuthAngle;
ReticleView.ActualAzimuthUnitVector = azimuthUnitVector;
ReticleView.ActualAzimuthAngle = altitudeAngle;
}
}