Exemplo n.º 1
0
        private void OnPinchUpdated(object sender, PinchGestureUpdatedEventArgs e)
        {
            switch (e.Status)
            {
            case GestureStatus.Started:
                StartScale = CapturedImage.Scale;
                AnchorX    = e.ScaleOrigin.X;
                AnchorY    = e.ScaleOrigin.Y;
                break;

            case GestureStatus.Running:
                double current = CapturedImage.Scale + (e.Scale - 1) * StartScale;
                CapturedImage.Scale = Clamp(current, MIN_SCALE * (1 - OVERSHOOT), MAX_SCALE * (1 + OVERSHOOT));
                break;

            case GestureStatus.Completed:
                if (Scale > MAX_SCALE)
                {
                    CapturedImage.ScaleTo(MAX_SCALE, 250, Easing.SpringOut);
                }
                else if (Scale < MIN_SCALE)
                {
                    CapturedImage.ScaleTo(MIN_SCALE, 250, Easing.SpringOut);
                }

                break;
            }
        }
Exemplo n.º 2
0
 private void OnTapped(object sender, EventArgs e)
 {
     if (CapturedImage.Scale > MIN_SCALE || CapturedImage.Scale < MIN_SCALE)
     {
         CapturedImage.ScaleTo(MIN_SCALE, 250, Easing.CubicInOut);
         CapturedImage.TranslateTo(0, 0, 250, Easing.CubicInOut);
     }
     else
     {
         AnchorX = AnchorY = 0.5; //TODO tapped position
         CapturedImage.ScaleTo(MAX_SCALE, 250, Easing.CubicInOut);
     }
 }