Bigger signature cuts while minimizing signature pad

BhautikBhautik Member ✭✭✭

Hi,
I have implement signature pad in my application.I am using two signature pad one is for large screen and another one for small screen.Now i want to implement like that,I want to copy signature of large pad to small pad.Right now I am able to copy signature from one pad to another but problem is that it is cropping whenever I copy signature from large pad to small.Is there any way to implement functionality like that?

Answers

  • JannikRJannikR Member ✭✭
    edited March 1

    What do you exactly do when you copy the signature between the two SignaturePads?

    The SignaturePad has a Points Property (Enumeration) where each Point of your signature "line" is stored.
    Point is a struct which has a X and Y property, containing the position of the point on the SignaturePad.

    When you now copy the signature from the large SignaturePad to the small SignaturePad (and also the other way round) you need to recalculate these points. For each point you need to find the new position on the target SignaturePad (applying some kind of scaling factor). Possible but some work and calculations to do ...

    Why do you have two signature pads? To you have two different views for large and small screens?

  • BhautikBhautik Member ✭✭✭

    @JannikR said:
    What do you exactly do when you copy the signature between the two SignaturePads?

    The SignaturePad has a Points Property (Enumeration) where each Point of your signature "line" is stored.
    Point is a struct which has a X and Y property, containing the position of the point on the SignaturePad.

    When you now copy the signature from the large SignaturePad to the small SignaturePad (and also the other way round) you need to recalculate these points. For each point you need to find the new position on the target SignaturePad (applying some kind of scaling factor). Possible but some work and calculations to do ...

    Why do you have two signature pads? To you have two different views for large and small screens?

    I have two different views.On some button click large signature pad will be displayed in full screen and whatever return on large signature pad I need to copy in small signature pad.

    Do you know how to recalculate these points?

  • JannikRJannikR Member ✭✭
    edited March 1

    Written in pseudo code you need to do something like this:

     private IList<Point> RecalculateSignature(IList<Point> points, int scaleFactor = 2)
      {
         return points.Select(point => new Point(Math.Floor(point.X / scaleFactor), Math.Floor(point.Y / scaleFactor))).ToList();
      }
    
    

    This assumes that your larger SignaturPad is twice the size than you smaller SignaturePad ... I guess it is not, but you should be able to calculate the exact scale factor for your implementation.

Sign In or Register to comment.