Esempio n. 1
0
        void OnDragDelta(object sender, C1DragDeltaEventArgs e)
        {
            var pos = e.GetPosition(image);

            _line.X2 = pos.X;
            _line.Y2 = pos.Y;
        }
 void HandleDragDelta(object sender, C1DragDeltaEventArgs e)
 {
     if (clickedItem != null)
     {
         var newY = (int)flexChart.PointToData(e.GetPosition(flexChart)).Y;
         if (newY >= 0 && newY <= 100)
         {
             clickedItem.Y = newY;
         }
     }
 }
        void OnDragDelta(object sender, C1DragDeltaEventArgs e)
        {
            var pos = e.GetPosition(imageGrid);

            pos = new Point(Math.Max(0, Math.Min(pos.X, _bitmap.PixelWidth)),
                            Math.Max(0, Math.Min(pos.Y, _bitmap.PixelHeight)));

            _selection = new Rect(
                Math.Round(Math.Min(_start.X, pos.X)),
                Math.Round(Math.Min(_start.Y, pos.Y)),
                Math.Round(Math.Abs(_start.X - pos.X)),
                Math.Round(Math.Abs(_start.Y - pos.Y)));

            UpdateMask();
        }
        void OnDragDelta(object sender, C1DragDeltaEventArgs e)
        {
            var zoom = GetZoom();
            var maxX = FramePanel.ActualWidth - Rectangle.ActualWidth * zoom;
            var maxY = FramePanel.ActualHeight - Rectangle.ActualHeight * zoom;
            var newX = _initialX + e.CumulativeTranslation.X;
            var newY = _initialY + e.CumulativeTranslation.Y;

            if (e.IsInertial)
            {
                Bounce(maxX, maxY, ref newX, ref newY);
            }
            else
            {
                Clip(maxX, maxY, ref newX, ref newY);
            }
            SetPosition(new Point(newX, newY));
        }
        void OnDragDelta(object sender, C1DragDeltaEventArgs e)
        {
            var transform = Window.Current.Content.TransformToVisual(image);
            var start     = transform.TransformPoint(_startPosition);
            var end       = transform.TransformPoint(e.GetPosition(null));

            start.X = Math.Min((double)Math.Max(start.X, 0), _bitmap.PixelWidth);
            end.X   = Math.Min((double)Math.Max(end.X, 0), _bitmap.PixelWidth);
            start.Y = Math.Min((double)Math.Max(start.Y, 0), _bitmap.PixelHeight);
            end.Y   = Math.Min((double)Math.Max(end.Y, 0), _bitmap.PixelHeight);

            _selection = new Rect(new Point(
                                      Math.Round(Convert.ToDouble(Math.Min(start.X, end.X))),
                                      Math.Round(Convert.ToDouble(Math.Min(start.Y, end.Y)))),
                                  new Size(Convert.ToDouble(Math.Round(Math.Abs(start.X - end.X))),
                                           Convert.ToDouble(Math.Round(Math.Abs(start.Y - end.Y)))));

            UpdateMask();
        }
Esempio n. 6
0
 private void OnDragDelta(object sender, C1DragDeltaEventArgs e)
 {
     if (e.PointerDeviceType == C1PointerDeviceType.Touch && !_startOverSelectedCell)
     {
         double x = _startScrollPosition.X;
         Point cumulativeTranslation = e.CumulativeTranslation;
         x = Math.Min(x + cumulativeTranslation.X, 0);
         Point cumulativeTranslation1 = e.CumulativeTranslation;
         double y = _startScrollPosition.Y;
         y = Math.Min(y + cumulativeTranslation1.Y, 0);
         _grid.ScrollPosition = new Point(x, y);
         return;
     }
     if (!e.IsInertial && _htDragStarted != null && _htDragStarted.Panel != null)
     {
         _htMove = _htDragStarted.Panel.HitTest(e.OriginalEventArgs);
         HandleDrag(e.OriginalEventArgs, _htDragStarted, _htMove);
     }
 }