C1Image Control Pointer Position With Rotated Images

Posted by: john.kiowski on 14 April 2021, 4:33 am EST

    • Post Options:
    • Link

    Posted 14 April 2021, 4:33 am EST

    We’re using the C1Image control in our UWP application and are having issues with the reported pointer position from the image control when images are rotated. I’ve attached a sample app to this post that demonstrates the problem.

    If you run the sample app, you’ll notice that image zooming and panning works fine for non-rotated images. But once the image is rotated, the reported pointer position from the image control is wildly inaccurate.

    In this sample app, you control the image scaling (zoom) via the mouse wheel, and control the image center position (pan) by holding down the left mouse button, dragging the image to the desired position, and releasing the mouse button.

    Please let us know how to properly zoom centered on the pointer position and how to pan a rotated image with the C1Image control. Of course, we’ve tried the obvious things like applying the scale factor and rotation to the reported pointer position, but the problem seems deeper than that. The coordinates reported back from the image seem to be extremely erratic and not useful for making this work in our app.

    Thanks,

    John Kiowski

    Software Manager

    Tower Engineering Systems

    SampleC1ImageControl.zip

  • Posted 19 April 2021, 10:22 pm EST

    Hi John,

    I apologize for the delay and thank you for sharing the sample.

    This issue was because you were getting the point relative to the C1Image whereas you need to get the point relative to the container i.e ‘gridMain(Grid)’ in your case. JFYI, this behavior is not specific to C1Image i.e standard UWP Image showed the same behavior.

    And also regarding the Panning behavior in rotated view, you need to provide the center X/Y values with respect to the rotated view. I have made some changes to fix the panning while the image is rotated to 90 degrees. Similarly, you can fix it for other angle values.

    I have attached a sample which implements the above using CompositeTransform. (see ZoomAndPan.zip)

    Best Regards,

    Kartik

    ZoomAndPan.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels