本文整理汇总了C#中UIEvent.GetCoalescedTouches方法的典型用法代码示例。如果您正苦于以下问题:C# UIEvent.GetCoalescedTouches方法的具体用法?C# UIEvent.GetCoalescedTouches怎么用?C# UIEvent.GetCoalescedTouches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIEvent
的用法示例。
在下文中一共展示了UIEvent.GetCoalescedTouches方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTouches
public void DrawTouches (NSSet touches, UIEvent evt)
{
var updateRect = CGRectNull ();
foreach (var touch in touches.Cast<UITouch> ()) {
Line line;
// Retrieve a line from activeLines. If no line exists, create one.
if (!activeLines.TryGetValue (touch, out line))
line = AddActiveLineForTouch (touch);
// Remove prior predicted points and update the updateRect based on the removals. The touches
// used to create these points are predictions provided to offer additional data. They are stale
// by the time of the next event for this touch.
updateRect = updateRect.UnionWith (line.RemovePointsWithType (PointType.Predicted));
// Incorporate coalesced touch data. The data in the last touch in the returned array will match
// the data of the touch supplied to GetCoalescedTouches
var coalescedTouches = evt.GetCoalescedTouches (touch) ?? new UITouch[0];
var coalescedRect = AddPointsOfType (PointType.Coalesced, coalescedTouches, line);
updateRect = updateRect.UnionWith (coalescedRect);
// Incorporate predicted touch data. This sample draws predicted touches differently; however,
// you may want to use them as inputs to smoothing algorithms rather than directly drawing them.
// Points derived from predicted touches should be removed from the line at the next event for this touch.
if (isPredictionEnabled) {
var predictedTouches = evt.GetPredictedTouches (touch) ?? new UITouch[0];
var predictedRect = AddPointsOfType (PointType.Predicted, predictedTouches, line);
updateRect = updateRect.UnionWith (predictedRect);
}
}
SetNeedsDisplayInRect (updateRect);
}
示例2: Append
bool Append (HashSet<UITouch> touches, UIEvent uievent)
{
var touchToAppend = trackedTouch;
if (touchToAppend == null)
return false;
// Cancel the stroke recognition if we get a second touch during cancellation period.
foreach (var touch in touches) {
if (touch != touchToAppend && (touch.Timestamp - initialTimestamp < cancellationTimeInterval)) {
State = (State == Possible) ? Failed : Cancelled;
return false;
}
}
// See if those touches contain our tracked touch. If not, ignore gracefully.
if (!touches.Contains (touchToAppend))
return false;
var coalescedTouches = uievent.GetCoalescedTouches (touchToAppend);
var lastIndex = coalescedTouches.Length - 1;
for (var index = 0; index <= lastIndex; index++)
Collect (Stroke, coalescedTouches [index], CoordinateSpaceView, (index != lastIndex), false);
if (Stroke.State == StrokeState.Active) {
var predictedTouches = uievent.GetPredictedTouches (touchToAppend);
foreach (var touch in predictedTouches)
Collect (Stroke, touch, CoordinateSpaceView, false, true);
}
return true;
}
示例3: DrawTouches
public void DrawTouches (NSSet touches, UIEvent evt)
{
var updateRect = CGRect.Empty;
foreach (var touch in touches.Cast<UITouch> ()) {
Line line;
// Retrieve a line from `activeLines`. If no line exists, create one.
if (!activeLines.TryGetValue (touch, out line))
line = AddActiveLineForTouch (touch);
updateRect = updateRect.UnionWith (line.RemovePointsWithType (PointType.Predicted));
var coalescedTouches = evt.GetCoalescedTouches (touch) ?? new UITouch[0];
var coalescedRect = AddPointsOfType (PointType.Coalesced, coalescedTouches, line, updateRect);
updateRect = updateRect.UnionWith (coalescedRect);
if (isPredictionEnabled) {
var predictedTouches = evt.GetPredictedTouches (touch) ?? new UITouch[0];
var predictedRect = AddPointsOfType (PointType.Predicted, predictedTouches, line, updateRect);
updateRect = updateRect.UnionWith (predictedRect);
}
}
SetNeedsDisplay ();
// SetNeedsDisplayInRect (updateRect);
}