Get Mouse Coordinates while drawing/cropping

1 Answer 20 Views
ImageEditor
Haris
Top achievements
Rank 1
Haris asked on 26 Aug 2021, 09:17 PM

Hi,

I am able to get the mouse position using the client sides events but is it possible to get the starting/ending mouse positions while drawing a rectangle? or is the information from the cropping window available on the client side (Width, Height, Position X,Y?

The requirement is to have the user identify something on the image and create "tag". Ideally, the user can use the rectangle to draw the outline. I would need to get the starting/ending mouse coordinates.

I can use the click events but that is not ideal.

I tried to use some other client side events but with no luck.

Thanks.

-Haris

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 31 Aug 2021, 10:14 AM

Hello Haris,

The source code of all RadImageEditor dialogs is shipped with the controls installation and is available under the "ImageEditorDialogs" folder. You customize each of this dialog, overwriting or extending their methods by following the approach demonstrated here: 

You can also access the methods and variables defined in the current dialog through the get_currentToolWidget() of the ImageEditor (the available methods depends on the currently loaded dialog). For example, you can get the star position of the "DrawRectangle" tool like follows:

var startPosition = $find("RadImageEditor1").get_currentToolWidget().drawTool.startPos;

You can also implement your entirely custom dialog:

Please, keep in mind that RadImageEditor does not support layers and the marked tags will not be available once the tool is closed/applied.

Regards,
Vessy
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

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