Constraints on Image Width/Height on WP7 GestureListener

前端 未结 3 377
别那么骄傲
别那么骄傲 2021-01-16 13:27

I added the GestureListener to an image i\'m trying to have zoom like this Stack Overflow answer here: How to zoom in and zoom out Images in WP7?

The pr

3条回答
  •  有刺的猬
    2021-01-16 14:03

    I guess you can do it by restricting transform.ScaleX and transform.ScaleY in the below event handler.if initialScale < somelength ,then only do the code.

    private void OnPinchDelta(object sender, PinchGestureEventArgs e)
        {
            transform.Rotation = initialAngle + e.TotalAngleDelta;
            transform.ScaleX = initialScale * e.DistanceRatio;
            transform.ScaleY = initialScale * e.DistanceRatio;
        }
    

提交回复
热议问题