本文整理汇总了C#中Stroke.Update方法的典型用法代码示例。如果您正苦于以下问题:C# Stroke.Update方法的具体用法?C# Stroke.Update怎么用?C# Stroke.Update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stroke
的用法示例。
在下文中一共展示了Stroke.Update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Collect
void Collect (Stroke stroke, UITouch touch, UIView view, bool coalesced, bool predicted)
{
if (view == null)
throw new ArgumentNullException ();
// Only collect samples that actually moved in 2D space.
var location = touch.GetPreciseLocation (view);
var previousSample = stroke.Samples.LastOrDefault ();
if (Distance (previousSample?.Location, location) < 0.003)
return;
var sample = new StrokeSample {
Timestamp = touch.Timestamp,
Location = location,
Coalesced = coalesced,
Predicted = predicted
};
bool collectForce = touch.Type == UITouchType.Stylus || view.TraitCollection.ForceTouchCapability == UIForceTouchCapability.Available;
if (collectForce)
sample.Force = touch.Force;
if (touch.Type == UITouchType.Stylus) {
var estimatedProperties = touch.EstimatedProperties;
sample.EstimatedProperties = estimatedProperties;
sample.EstimatedPropertiesExpectingUpdates = touch.EstimatedPropertiesExpectingUpdates;
sample.Altitude = touch.AltitudeAngle;
sample.Azimuth = touch.GetAzimuthAngle (view);
if (stroke.Samples.Count == 0 && estimatedProperties.HasFlag (UITouchProperties.Azimuth)) {
stroke.ExpectsAltitudeAzimuthBackfill = true;
} else if (stroke.ExpectsAltitudeAzimuthBackfill &&
!estimatedProperties.HasFlag (UITouchProperties.Azimuth)) {
for (int index = 0; index < stroke.Samples.Count; index++) {
var priorSample = stroke.Samples [index];
var updatedSample = priorSample;
if (updatedSample.EstimatedProperties.HasFlag (UITouchProperties.Altitude)) {
updatedSample.EstimatedProperties &= ~UITouchProperties.Altitude;
updatedSample.Altitude = sample.Altitude;
}
if (updatedSample.EstimatedProperties.HasFlag (UITouchProperties.Azimuth)) {
updatedSample.EstimatedProperties &= ~UITouchProperties.Azimuth;
updatedSample.Azimuth = sample.Azimuth;
}
stroke.Update (updatedSample, index);
}
stroke.ExpectsAltitudeAzimuthBackfill = false;
}
}
if (predicted) {
stroke.AddPredicted (sample);
} else {
var index = stroke.Add (sample);
if (touch.EstimatedPropertiesExpectingUpdates != 0) {
outstandingUpdateIndexes [touch.EstimationUpdateIndex] = new StrokeIndex {
Stroke = stroke,
Index = index
};
}
}
}