RadImageEditor and Click event

4 posts, 0 answers
  1. Mikko
    Mikko avatar
    12 posts
    Member since:
    Jun 2012

    Posted 08 Oct Link to this post

    Does RadImageEditor support Click event?

    What we would like to do, is to collect Zoom level and position after Click event. The reason for this is that we would like to show
    ground plan to the user and he could mark location of a problem. Not to draw anything.

     

  2. Vessy
    Admin
    Vessy avatar
    2067 posts

    Posted 10 Oct Link to this post

    Hi Mikko,

    The ImageEditor does not expose a click event, but you can handle the click event of its ViewPort element and access the mouse position in it like follows:

            <telerik:RadImageEditor ID="RadImageEditor1" runat="server" ImageUrl="test.jpg" OnClientImageLoad="onImageLoad">
            </telerik:RadImageEditor>
            <script>
                var imageEditor;
    
                function onImageLoad(sender, args) {
                    imageEditor = sender;
                    $telerik.$(imageEditor.get_viewport()).on("click", function (e) {
                        var statusBar = imageEditor._statusBar;
                        var posX = statusBar.get_coorX().innerText;
                        var posY = statusBar.get_coorY().innerText;
                        alert("{x:" + posX + ", y:" + posY + "}");
                    })
                }
            </script>

    Regards,
    Vessy
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Mikko
    Mikko avatar
    12 posts
    Member since:
    Jun 2012

    Posted 11 Oct in reply to Vessy Link to this post

    Hi Vessy,

    Thank you for a great support.

    Can we also get a zoom %?

    Our goal is that user could zoom photo and mark certain position and we could show this photo with a same zoom and location to other users. We are still missing zoom and location of photo (as user might move it)

    Mikko

  4. Vessy
    Admin
    Vessy avatar
    2067 posts

    Posted 16 Oct Link to this post

    Hi Mikko,

    You can get the current zoom level of an image at any time through the EditableImage object of the ImageEditor. You can find details about the public Client-side API of RadImageEditor here:

    https://docs.telerik.com/devtools/aspnet-ajax/controls/imageeditor/client-side-programming/overview

    For example:

    $find("RadImageEditor1").getEditableImage().get_zoomLevel();

    Regards,
    Vessy
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top