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
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
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
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
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
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.