/// <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(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesMoved(touches, evt); if (CurrentActivePanelContainer == null) { return; } PointF touchPt; UITouch touch = touches.AnyObject as UITouch; if (touch != null) { touchPt = touch.LocationInView(this.View); } else { return; } RectangleF newFrame = CurrentActivePanelContainer.Sliding(touchPt, SlidingController.View.Frame); SlidingController.View.Frame = newFrame; }
public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt) { if (selectedCoverView == null) { return; } var startPoint = ((UITouch)touches.AnyObject).LocationInView(this); isDraggingACover = false; // Which cover did the user tap? var targetLayer = scrollView.Layer.HitTest(startPoint); var targetCover = FindCoversOnScreen(targetLayer); isDraggingACover = targetCover != null; beginningCover = selectedCoverView.Number; // Make sure the user is tapping on a cover. startPosition = (float)((startPoint.X / 1.5) + scrollView.ContentOffset.X); if (isSingleTap) { isDoubleTap = true; } isSingleTap = touches.Count == 1; }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { if (selectedCoverView == null) { return; } if (isSingleTap) { var targetPoint = ((UITouch)touches.AnyObject).LocationInView(this); var targetLayer = scrollView.Layer.HitTest(targetPoint); var targetCover = FindCoversOnScreen(targetLayer); if (targetCover != null && (targetCover.Number != selectedCoverView.Number)) { SetSelectedCover(targetCover.Number); } } CenterOnSelectedCover(true); // Raise the event if (beginningCover != selectedCoverView.Number) { EventHandler h = Changed; if (h != null) { h(this, EventArgs.Empty); } } }
internal void TouchesEnded(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e) { UITouch [] touchesArray = touches.ToArray <UITouch>(); foreach (UITouch touch in touchesArray) { Vector2 location = new Vector2(touch.LocationInView(touch.View).X, touch.LocationInView(touch.View).Y); // Check where is the touch if (Visible) { foreach (ButtonDefinition button in _buttonsDefinitions) { if (CheckButtonHit(button, location)) { _buttons &= ~(int)button.Type; } } if ((_leftThumbDefinition != null) && (CheckThumbStickHit(_leftThumbDefinition, location))) { LeftThumbStickDefinition.Offset = Vector2.Zero; _leftStick = Vector2.Zero; } if ((_rightThumbDefinition != null) && (CheckThumbStickHit(_rightThumbDefinition, location))) { _rightThumbDefinition.Offset = Vector2.Zero; _rightStick = Vector2.Zero; } } } }
/// <summary> /// Called when the touches are cancelled due to a phone call, etc. /// </summary> public override void TouchesCancelled(MonoTouch.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(MonoTouch.Foundation.NSSet touches, UIEvent evt) { var touch = (UITouch)evt.TouchesForView(this).AnyObject; PointF pos; pos = touch.LocationInView(this); float p = pos.X; float 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 TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt) { currentView++; currentView %= totalViews; //Console.WriteLine("Current View: {0}", currentView); MarkDirty(); //this.NeedsDisplay = true; SetNeedsDisplay(); }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent evt) { base.TouchesEnded(touches, evt); if (OnTouchesEnded != null) { OnTouchesEnded(touches, evt); } }
public static void OnTouchUp(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent evt) { var handler = TouchUp; if (handler != null) { handler(touches, evt); } }
public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt) { this.Highlighted = true; if (this.Touched != null) { this.Touched(this, new EventArgs()); } }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); if (OnTouch != null) { OnTouch(this, EventArgs.Empty); } }
public override void TouchesMoved(MonoTouch.Foundation.NSSet touches, UIEvent evt) { // if move out of 2x rect, cancel highlighted. var location = new PointF(0, 0);//todo: touches.AnyObject.LocationInView(this); if (!ScaleRect(this.Bounds, 2.0f).Contains(location)) { this.Highlighted = false; } }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { var previousSelected = SelectedSegment; base.TouchesEnded(touches, evt); if (previousSelected == SelectedSegment && SelectedSegment == _multipleTouchIndex) { SendActionForControlEvents(UIControlEvent.ValueChanged); } }
public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt) { foreach (var touch in touches) { PointF location = (touch as UITouch).LocationInNode(this); if (doneButton.ContainsPoint(location)) { PresentScene(new MainMenu(View.Bounds.Size)); } } }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { if (!Enabled) { return; } Editing = false; this.SetNeedsDisplay(); }
/// <summary> /// Called when the fingers lift off the screen /// </summary> public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); // if (base.State == UIGestureRecognizerState.Possible && strokeUp) { base.State = UIGestureRecognizerState.Recognized; } Console.WriteLine(base.State.ToString()); }
public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); UITouch touch = touches.AnyObject as UITouch; if (touch != null) { initialPoint = touch.LocationInView(this); } }
/// <summary> /// Is called when the fingers touch the screen. /// </summary> public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); // we want one and only one finger if (touches.Count != 1) { base.State = UIGestureRecognizerState.Failed; } Console.WriteLine(base.State.ToString()); }
public override void TouchesMoved(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesMoved(touches, evt); UITouch touch = touches.AnyObject as UITouch; if (touch != null) { latestPoint = touch.LocationInView(this); SetNeedsDisplay(); } }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { if (Bounds.Contains((touches.AnyObject as UITouch).LocationInView(this))) { base.TouchesEnded(touches, evt); if (Callback != null) { Callback(Id, this); } } }
public override void TouchesMoved(MonoTouch.Foundation.NSSet touches, UIEvent evt) { var touch = (UITouch)touches.AnyObject; var point = touch.LocationInView(this); var dx = point.X - _container.Center.X; var dy = point.Y - _container.Center.Y; var angle = Math.Atan2(dy, dx); var angleDiff = (float)(_deltaAngle - angle); _startTransform.Rotate(-angleDiff); _container.Transform = CGAffineTransform.MakeRotation(-angleDiff); }
public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); var touch = touches.AnyObject as UITouch; if (touch != null) { if (touch.LocationInView(this).Y < _innerView.Frame.Y) { Dismiss(); } } }
public override void TouchesMoved(MonoTouch.Foundation.NSSet touches, UIEvent evt) { if (!Enabled) { return; } Editing = true; var touch = touches.AnyObject as UITouch; locations[locations.Count - 1] = touch.LocationInView(this); this.SetNeedsDisplay(); }
internal void TouchesBegan(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent e, iOSGameView view) { // Reset State //Reset(); // Check where is the touch UITouch [] touchesArray = touches.ToArray <UITouch>(); foreach (UITouch touch in touchesArray) { var point = touch.LocationInView(touch.View); Vector2 location = new Vector2(point.X, point.Y); location = view.GetOffsetPosition(location, true); // Check where is the touch bool hitInButton = false; if (Visible) { foreach (ButtonDefinition button in _buttonsDefinitions) { hitInButton |= UpdateButton(button, location); UpdateTouch(touch, button); } } if (!hitInButton) { // check the left thumbstick if (Visible && (_leftThumbDefinition != null) && (CheckThumbStickHit(_leftThumbDefinition, location))) { _leftThumbDefinition.InitialHit = location; UpdateTouch(touch, _leftThumbDefinition); } else { // check the right thumbstick if (Visible && (_rightThumbDefinition != null) && (CheckThumbStickHit(_rightThumbDefinition, location))) { _rightThumbDefinition.InitialHit = location; UpdateTouch(touch, _rightThumbDefinition); } else // Handle mouse { Mouse.State.X = (int)location.X; Mouse.State.Y = (int)location.Y; } } } } }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { UITableViewCell cell = this.Superview as UITableViewCell; if (cell != null) { cell.SetHighlighted(false, false); } if (Clicked != null) { Clicked(this, new EventArgs()); } //base.TouchesEnded(touches, evt); }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { this.Highlighted = false; // if stop in the area of 2x rect, response to the touches event. var location = new PointF(0, 0);// todo: touches.AnyObject.LocationInView(this); if (ScaleRect(this.Bounds, 2.0f).Contains(location)) { if (this.Selected != null) { this.Selected(this, new EventArgs()); } } }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { // flip the state Value = !Value; // if this is a child of a UITableViewCell, flip the ImageView image as well UITableViewCell cell = this.Superview as UITableViewCell; if (cell != null) { cell.ImageView.Image = Value ? trueImage : falseImage; } // call the superclass handler (which will invoke the Clicked event handler) base.TouchesEnded(touches, evt); }
public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, MonoTouch.UIKit.UIEvent evt) { foreach (UITouch touch in touches) { var location = touch.LocationInNode(this); var sprite = new SKSpriteNode("Spaceship") { Position = location, }; var action = SKAction.RotateByAngle((float)Math.PI, 1); sprite.RunAction(SKAction.RepeatActionForever(action)); AddChild(sprite); } }
public override void TouchesEnded(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesEnded(touches, evt); var gesture = WritePadAPI.detectGesture(WritePadAPI.GEST_CUT | WritePadAPI.GEST_RETURN, currentStroke); if (!mMoved) { mX++; } AddPixelsXY(mX, mY, true); mCurrStroke = -1; mMoved = false; strokeLen = 0; mPath.AddLineTo(new PointF(mX, mY)); mPathList.Add(mPath); mPath = new UIBezierPath(); mPath.LineWidth = WritePadAPI.DEFAULT_INK_WIDTH; mPath.LineCapStyle = CGLineCap.Round; mPath.LineJoinStyle = CGLineJoin.Round; SetNeedsDisplay(); switch (gesture) { case WritePadAPI.GEST_RETURN: if (OnReturnGesture != null) { mPathList.RemoveAt(mPathList.Count - 1); WritePadAPI.recoDeleteLastStroke(); SetNeedsDisplay(); OnReturnGesture(); } break; case WritePadAPI.GEST_CUT: if (OnCutGesture != null) { mPathList.RemoveAt(mPathList.Count - 1); WritePadAPI.recoDeleteLastStroke(); SetNeedsDisplay(); OnCutGesture(); } break; } }
public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt) { base.TouchesBegan(touches, evt); currentStroke = new List <WritePadAPI.CGTracePoint> (); UITouch touch = (UITouch)touches.AnyObject; var location = touch.LocationInView(this); mPath.RemoveAllPoints(); mPath.MoveTo(new PointF(location.X, location.Y)); mX = location.X; mY = location.Y; AddCurrentPoint(mX, mY); mMoved = false; strokeLen = 0; mCurrStroke = WritePadAPI.recoNewStroke(WritePadAPI.DEFAULT_INK_WIDTH, 0xFF0000FF); AddPixelsXY(mX, mY, false); }