This is a migrated thread and some comments may be shown as answers.

RadImageEditor and Click event

5 Answers 118 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Mikko
Top achievements
Rank 1
Veteran
Mikko asked on 08 Oct 2019, 05:19 PM

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.

 

5 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 10 Oct 2019, 02:11 PM

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.
0
Mikko
Top achievements
Rank 1
Veteran
answered on 11 Oct 2019, 07:47 PM

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

0
Vessy
Telerik team
answered on 16 Oct 2019, 07:24 AM

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.
0
Mikko
Top achievements
Rank 1
Veteran
answered on 25 Mar 2021, 06:51 PM

Hi Vessy,

Your sample works great with desktop browsers, but not with Android phones. For some reason it does not return cordinates.

Best regards, Mikko

0
Vessy
Telerik team
answered on 30 Mar 2021, 01:40 PM

Hi Mikko,

Unfortunately, this behavior is related to a limitation that could not be controlled by us. I have just answered your other thread on a similar matter, you can refer my reply there for more detailed explanation of why the coordinates are not available on mobile:

https://www.telerik.com/forums/click-location-on-android

Regards,
Vessy
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
ImageEditor
Asked by
Mikko
Top achievements
Rank 1
Veteran
Answers by
Vessy
Telerik team
Mikko
Top achievements
Rank 1
Veteran
Share this question
or