当前位置: 首页>>代码示例>>C#>>正文


C# UITouch.LocationInView方法代码示例

本文整理汇总了C#中UITouch.LocationInView方法的典型用法代码示例。如果您正苦于以下问题:C# UITouch.LocationInView方法的具体用法?C# UITouch.LocationInView怎么用?C# UITouch.LocationInView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UITouch的用法示例。


在下文中一共展示了UITouch.LocationInView方法的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;
        }
开发者ID:nicwise,项目名称:RangeSliderMonoTouch,代码行数:34,代码来源:RangeSlider.cs

示例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 ();
		}
开发者ID:BoogieMAN2K,项目名称:monotouch-samples,代码行数:8,代码来源:View.cs

示例3: 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;
        }
开发者ID:nicwise,项目名称:RangeSliderMonoTouch,代码行数:14,代码来源:RangeSlider.cs

示例4: 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;
        }
开发者ID:jasallen,项目名称:RangeSliderDemoVideoFiles,代码行数:17,代码来源:RangeSliderView.cs

示例5: 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;
        }
开发者ID:jasallen,项目名称:RangeSliderDemoVideoFiles,代码行数:19,代码来源:RangeSliderView.cs

示例6: 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;
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:21,代码来源:LinePoint.cs

示例7: BeginTracking

        public override bool BeginTracking(UITouch touch, UIEvent uievent)
        {
            _previousTouchPoint = (CGPoint)touch.LocationInView((UIView)this);

            // hit test the knob layers
            if (_lowerKnobLayer.PaintFrame.Contains(_previousTouchPoint))
            {
                _lowerKnobLayer.Highlighted = true;
                _lowerKnobLayer.SetNeedsDisplay();
            }
            else if (_upperKnobLayer.PaintFrame.Contains(_previousTouchPoint))
            {
                _upperKnobLayer.Highlighted = true;
                _upperKnobLayer.SetNeedsDisplay();
            }

            RawHighValue = HighValue;
            RawLowValue = LowValue;

            return _upperKnobLayer.Highlighted || _lowerKnobLayer.Highlighted;
        }
开发者ID:jasallen,项目名称:FuRangeSlider,代码行数:21,代码来源:FuRangeSlider.cs

示例8: ShouldReceiveTouch

 public override bool ShouldReceiveTouch (UIGestureRecognizer recognizer, UITouch touch)
 {
     return (_controller.Visible ||
         (touch.LocationInView (_controller._internalTopView.View).Y <= _controller.SlideHeight)) && (_controller.LeftMenuEnabled || _controller.RightMenuEnabled);
 }
开发者ID:TharinduMunasinge,项目名称:c-sharp,代码行数:5,代码来源:SlideOutNavigationController.cs

示例9: ItemForTouch

        private MenuItem ItemForTouch(UITouch touch)
        {
            PointF touchLocation = touch.LocationInView(touch.View);
            touchLocation = Director.Instance.ConvertCoordinate(touchLocation);

            foreach (MenuItem item in Children) {
                PointF local = item.ConvertToNodeSpace(touchLocation);

                RectangleF r = item.Rect;
                r.X = 0;
                r.Y = 0;

                if (r.Contains(local) && item.IsEnabled) {
                    return item;
                }
            }

            return null;
        }
开发者ID:hcxyzlm,项目名称:CocosNet-1,代码行数:19,代码来源:Menu.cs

示例10: GetPosition

		private System.Drawing.PointF GetPosition(UITouch touch)
		{
			var p = touch.LocationInView(touch.View);

			// convert point to pixels
			var scale = touch.View.ContentScaleFactor;
			p.X *= scale;
			p.Y *= scale;
			return p;
		}
开发者ID:Joe-xXx,项目名称:playscript-mono,代码行数:10,代码来源:Player.cs

示例11: GetGestureDirectionWithTouch

        UISwipeGestureRecognizerDirection GetGestureDirectionWithTouch(UITouch touch)
        {
            CGPoint gestureEndPoint = touch.LocationInView(this);
            double dx = Math.Abs(this.GestureStartPoint.X - gestureEndPoint.X);
            nfloat dy = -1 * (gestureEndPoint.Y - this.GestureStartPoint.Y);

            if (dx > 20)
            {
                return UISwipeGestureRecognizerDirection.Right;
            }

            if (dy < 0)
            {
                return UISwipeGestureRecognizerDirection.Down;
            }
            else if (dy > 0)
            {
                return UISwipeGestureRecognizerDirection.Up;
            }

            return UISwipeGestureRecognizerDirection.Down;
        }
开发者ID:harrysaggu,项目名称:xamarin-plugins,代码行数:22,代码来源:iOSCardsView.cs

示例12: GetTouchPoint

        private float GetTouchPoint(UITouch touch)
        {
            var location = touch.LocationInView(this);

            var x = location.X;
            var y = location.Y;

            if (x < _bounds.Left)
                x = _bounds.Left;
            if (x > _bounds.Right)
                x = _bounds.Right;
            if (y < _bounds.Top)
                y = _bounds.Top;
            if (y > _bounds.Bottom)
                y = _bounds.Bottom;

            _sliderPositionRaw = new CGPoint(x, _bounds.GetMidY());

            var scaleX = _bounds.Width / 2f;

            x = (x - scaleX) * 100f / scaleX;

            System.Diagnostics.Debug.WriteLine($"GetTouchPoint: x={x}");

            return (float)x;
        }
开发者ID:milindur,项目名称:MdkControlApp,代码行数:26,代码来源:SliderView.cs

示例13: ShouldReceiveTouch

		public bool ShouldReceiveTouch (UIGestureRecognizer recognizer, UITouch touch)
		{
			if (leftRingControl.HitTest (touch.LocationInView (leftRingControl), null) != null)
				return false;

			foreach(var button in buttons) {
				if (button.HitTest (touch.LocationInView (clearButton), null) != null)
					return false;
			}

			return true;
		}
开发者ID:xamarin,项目名称:monotouch-samples,代码行数:12,代码来源:CanvasMainViewController.cs

示例14: GestureRecognizerShouldReceiveTouch

        bool GestureRecognizerShouldReceiveTouch(UIGestureRecognizer gestureRecognizer, UITouch touch)
        {
            if (_ios7) {
                if (_interactivePopGestureRecognizerEnabled && (_contentViewController is UINavigationController)) {
                    UINavigationController navigationController = _contentViewController as UINavigationController;
                    if (navigationController.ViewControllers.Length > 1 && navigationController.InteractivePopGestureRecognizer.Enabled) {
                        return false;
                    }
                }
            }

            if (_panFromEdge && gestureRecognizer is UIPanGestureRecognizer && !Visible) {
                var point = touch.LocationInView(gestureRecognizer.View);
                if (point.X < 20.0 || point.X > View.Frame.Size.Width - 20.0) {
                    return true;
                } else {
                    return false;
                }
            }

            return true;
        }
开发者ID:rid00z,项目名称:JellyBeanTracker,代码行数:22,代码来源:MRSideMenu.cs

示例15: GetTouchingCrayon

        Crayon GetTouchingCrayon(UITouch touch)
        {
            var location = touch.LocationInView (this);

            var pos = CRAYON_START - CRAYON_SPACING;
            foreach (var crayon in Crayons) {

                switch (Orientation) {

                case UIInterfaceOrientation.Portrait:
                case UIInterfaceOrientation.PortraitUpsideDown:
                    if ((location.X > Frame.Width - crayon.Length)
                     && (location.Y > pos)
                     && (location.Y < pos + CRAYON_SPACING / 2 + crayon.Width + CRAYON_SPACING / 2))
                        return crayon;
                    break;

                case UIInterfaceOrientation.LandscapeLeft:
                case UIInterfaceOrientation.LandscapeRight:
                    if ((location.Y > Frame.Height - crayon.Length)
                     && (location.X < Frame.Width - pos)
                     && (location.X > Frame.Width - pos - CRAYON_SPACING / 2 - crayon.Width - CRAYON_SPACING / 2))
                        return crayon;
                    break;

                }

                pos += crayon.Width + CRAYON_SPACING;
            }
            return null;
        }
开发者ID:chkn,项目名称:CrayonCamelot,代码行数:31,代码来源:Canvas.cs


注:本文中的UITouch.LocationInView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。