public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) { Console.WriteLine("touch"); var touch = (UITouch)touches.AnyObject; var point = touch.LocationInView(this); var distance = CalculateDistanceFromCenter(point); System.Diagnostics.Debug.WriteLine(point); System.Diagnostics.Debug.WriteLine(distance); Console.WriteLine("console"); Console.WriteLine(point); Console.WriteLine(distance); if (distance < 20 || distance > 200) { return; } _startTransform = _container.Transform; var label = GetLabelByValue(_currentSliceValue); label.Alpha = _minAlphaValue; var dx = point.X - _container.Center.X; var dy = point.Y - _container.Center.Y; _deltaAngle = (float)Math.Atan2(dx, dy); }
public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt) { base.TouchesMoved(touches, evt); UITouch touch = touches.AnyObject as UITouch; if (touch != null) { // Create a new "complicated" data object var data = new ImageMotionData() { ImageCoordinate = touch.LocationInView(this), ParentCoordinate = touch.LocationInView(this.Superview), PreviousImageCoordinate = touch.PreviousLocationInView(this), PreviousParentCoordinate = touch.PreviousLocationInView(this.Superview) }; // Broadcast another data element is available _movementSubject.OnNext(data); } else { // Broadcast an exception has occurred _movementSubject.OnError(new Exception("Could not find a touch event")); } }
public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); // Touch to recognize immediately State = UIGestureRecognizerState.Recognized; }
/// <summary> /// Manages what happens while the user is mid-slide /// </summary> /// <param name="touches">Touches.</param> /// <param name="evt">Evt.</param> public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt) { base.TouchesMoved(touches, evt); if (CurrentActivePanelContainer == null) { return; } CGPoint touchPt; UITouch touch = touches.AnyObject as UITouch; if (touch != null) { touchPt = touch.LocationInView(this.View); } else { return; } CGRect newFrame = CurrentActivePanelContainer.Sliding(touchPt, SlidingController.View.Frame); SlidingController.View.Frame = newFrame; }
public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); this.View.EndEditing(true); }
public override void TouchesBegan(Foundation.NSSet touches, UIKit.UIEvent evt) { swiped = false; UITouch touch = touches.AnyObject as UITouch; lastPoint = touch.LocationInView(this); }
/// <summary> /// Called when the touches are cancelled due to a phone call, etc. /// </summary> public override void TouchesCancelled(Foundation.NSSet touches, UIEvent evt) { base.TouchesCancelled(touches, evt); // we fail the recognizer so that there isn't unexpected behavior // if the application comes back into view base.State = UIGestureRecognizerState.Failed; }
private void HandleTouches(Foundation.NSSet touches, UIEvent evt) { var touch = (UITouch)evt.TouchesForView(this).AnyObject; CGPoint pos; pos = touch.LocationInView(this); nfloat p = pos.X; nfloat b = Frame.Size.Width; if (p < 0) { Hue = 0; } else if (p > b) { Hue = 1; } else { Hue = p / b; } if (HueChanged != null) { HueChanged(); } }
public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt) { swiped = true; UITouch touch = touches.AnyObject as UITouch; CGPoint currentPoint = touch.LocationInView(this); UIGraphics.BeginImageContext(Frame.Size); tempDrawImage.Image.Draw(new CGRect(0, 0, Frame.Size.Width, Frame.Size.Height)); using (var context = UIGraphics.GetCurrentContext()) { context.MoveTo(lastPoint.X, lastPoint.Y); context.AddLineToPoint(currentPoint.X, currentPoint.Y); context.SetLineCap(CGLineCap.Round); context.SetLineWidth(brush); context.SetStrokeColor(PaintColor.CGColor); context.SetBlendMode(CGBlendMode.Normal); context.StrokePath(); } tempDrawImage.Image = UIGraphics.GetImageFromCurrentImageContext(); tempDrawImage.Alpha = opacity; UIGraphics.EndImageContext(); lastPoint = currentPoint; }
public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt) { base.TouchesMoved(touches, evt); UITouch currTouch = touches.AnyObject as UITouch; var view = currTouch.View as UIView; var point = currTouch.LocationInView(view); if (dragMightStart && currentDraggable != null) { var deltaX = Math.Abs(point.X - lastTouchX); var deltaY = Math.Abs(point.Y - lastTouchY); // if no movement at all if (deltaX < DRAG_THRESHOLD && deltaY < DRAG_THRESHOLD) { dragMightStart = true; } else if (deltaX > DRAG_THRESHOLD || deltaY > DRAG_THRESHOLD) { currentDraggable.OnDragStarted(); element.Dragging = true; dragMightStart = false; // it's started } } if (LayoutElement.Dragging) { LayoutElement.HandleTouch((double)point.X, (double)point.Y); } }
public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); Image = DrawingImage; PreviousImages.Add(Image); LineAdded(); }
public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); if (touchingImage == null || touchingImageRect == RectangleF.Empty) { touchingImage = null; touchingImageRect = RectangleF.Empty; touchingImageIndex = -1; //base.TouchesEnded(touches, evt); return; } var touchLocation = ((UITouch)evt.TouchesForView(this).AnyObject).LocationInView(this); var touchFrame = new RectangleF(touchLocation.X, touchLocation.Y, 1, 1); if (touchFrame.IntersectsWith(touchingImageRect)) { int touchedImageIndex = touchingImageIndex; touchingImage = null; touchingImageRect = RectangleF.Empty; touchingImageIndex = -1; //Fire off delegate if (this.ImageTapped != null) { this.ImageTapped(touchedImageIndex); } } SetNeedsDisplay(); }
public async override void TouchesEnded(Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); AddPoint(touches); // Start the recognition var item = recognizer.Recognize(allPoints); string display = string.Format("{0} - {1}, {2}", item.Name, item.Score, item.IndicativeAngleInDegrees); NavigationItem.Prompt = display; UILabel lbl = new UILabel(); lbl.Frame = new CGRect(item.BoundingRectangle.X, item.BoundingRectangle.Y, item.BoundingRectangle.Width, item.BoundingRectangle.Height); lbl.BackgroundColor = UIColor.FromRGBA(0, 0, 255, 100); lbl.Lines = 0; lbl.LineBreakMode = UILineBreakMode.CharacterWrap; lbl.Text = display; Add(lbl); await Task.Delay(4000); await UIView.AnimateAsync(0.4, () => { lbl.Alpha = 0; }); lbl.RemoveFromSuperview(); }
public override void TouchesMoved(Foundation.NSSet touches, UIEvent evt) { base.TouchesMoved(touches, evt); if (!IsEnabled) { return; } UITouch touch = touches.AnyObject as UITouch; CGPoint location = touch.LocationInView(this); if (location.X < Frame.Left) { location.X = 0; } else if (location.X > Frame.Right) { location.X = Frame.Right; } CalculateCurrentStep((location.X) / Frame.Width, NumSteps); FirePositionChanged(); SetNeedsDisplay(); }
public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); UITouch touch = touches.AnyObject as UITouch; Animation.pulseExpandAnimation(layer: Layer, visualLayer: VisualLayer, point: Layer.ConvertPointToLayer(point: touch.LocationInView(this), layer: Layer), width: this.Width(), height: this.Height(), pulse: Pulse); }
public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt) { if (!swiped) { UIGraphics.BeginImageContext(Frame.Size); tempDrawImage.Image.Draw(new CGRect(0, 0, Frame.Size.Width, Frame.Size.Height)); using (var context = UIGraphics.GetCurrentContext()) { context.SetLineCap(CGLineCap.Round); context.SetLineWidth(brush); context.SetStrokeColor(PaintColor.CGColor); context.MoveTo(lastPoint.X, lastPoint.Y); context.AddLineToPoint(lastPoint.X, lastPoint.Y); context.StrokePath(); context.Flush(); tempDrawImage.Image = UIGraphics.GetImageFromCurrentImageContext(); UIGraphics.EndImageContext(); } } UIGraphics.BeginImageContext(mainImage.Frame.Size); mainImage.Image.Draw(new CGRect(0, 0, Frame.Size.Width, Frame.Size.Height), CGBlendMode.Normal, 1.0f); tempDrawImage.Image.Draw(new CGRect(0, 0, Frame.Size.Width, Frame.Size.Height), CGBlendMode.Normal, opacity); mainImage.Image = UIGraphics.GetImageFromCurrentImageContext(); //tempDrawImage.Image = CreateImageFromColor (); UIGraphics.EndImageContext(); }
/// <summary> /// Toucheses the cancelled. /// </summary> /// <param name="touches">Touches.</param> /// <param name="evt">Evt.</param> public override void TouchesCancelled(Foundation.NSSet touches, UIEvent evt) { base.TouchesCancelled(touches, evt); this._element.TouchesCancelled(GetTouchPoints(touches)); this.State = UIGestureRecognizerState.Cancelled; }
public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); // Reset the table to its original position //tableView.SetContentOffset(new CGPoint(0, -offset), true) }
public override void TouchesCancelled(Foundation.NSSet touches, UIEvent evt) { Animate(0.1, delegate { Alpha = 1.0f; }); }
public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) { Animate(0.1, delegate { Alpha = 0.7f; }); }
public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); allPoints.Clear(); AddPoint(touches); }
public override void TouchesCancelled(Foundation.NSSet touches, UIEvent evt) { base.TouchesCancelled(touches, evt); _recognizer.OnTouchCancel(CreateTouchEventArgs()); this.State = UIGestureRecognizerState.Cancelled; }
public override void DidFinish(RPPreviewViewController previewController, Foundation.NSSet <Foundation.NSString> activityTypes) { Debug.WriteLine("!!" + activityTypes + "!!"); if (activityTypes.Equals("com.apple.UIKit.activity.SaveToCameraRoll")) { } }
public override void TouchesCancelled(Foundation.NSSet touches, UIEvent evt) { base.TouchesCancelled(touches, evt); if (Parent != null) { Parent.BackgroundColor = UIColor.Yellow; } }
public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); if (Parent != null) { Parent.BackgroundColor = UIColor.Red; } }
public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); _recognizer.OnTouchBegin(CreateTouchEventArgs()); this.State = UIGestureRecognizerState.Began; }
public override void TouchesMoved(Foundation.NSSet touches, UIKit.UIEvent evt) { if (this.Element is FrameApp) { (this.Self as UIKit.UIView).BackgroundColor = (this.Element as FrameApp).TouchBackgroundColor.ToUIColor(); } base.TouchesMoved(touches, evt); }
public override void TouchesCancelled(Foundation.NSSet touches, UIEvent evt) { if (!IsEnabled) { return; } Alpha = 1.0f; }
public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); linePathCollection.Add(new LinePath() { PenColor = penColor, Path = path, LineWidth = lineWidth }); path.ClosePath(); }
public override void TouchesBegan(Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); if (touches.Count != 1) { TouchesCancelled(touches, evt); } }