ImageEditor zoomDropdown default

2 Answers 116 Views
Editor
Joel
Top achievements
Rank 2
Iron
Iron
Iron
Joel asked on 04 Jun 2021, 04:29 PM
How do I set the default zoom option?  I need it to "Fit to screen" when it loads

2 Answers, 1 is accepted

Sort by
0
Accepted
Stoyan
Telerik team
answered on 09 Jun 2021, 03:09 PM

Hi Joel,

In order to programmatically set the fit to screen property when an image is rendered into the ImageEditor:

  1. Subscribe to the imageRendered method
  2. In its handler use the executeCommand method and pass it the following parameters  command:"ZoomImageEditorCommand" and options:"fitToScreen"
function rendered(e) {
        e.sender.executeCommand({ command: "ZoomImageEditorCommand", options: "fitToScreen" })
}

Please let me know, if you have further questions. Thank you

Regards,
Stoyan
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/.

0
Joel
Top achievements
Rank 2
Iron
Iron
Iron
answered on 14 Jun 2021, 10:14 PM

Yes, this worked for me:

 


            @(Html.Kendo().ImageEditor()
                .Name("imageEditor")
                .Height(1200)
                .Events(e => e.ImageRendered("imageRendered"))
                .Toolbar(toolbar =>
                {
                    toolbar.Items(items =>
                    {
                        items.Add().Name("zoomIn");
                        items.Add().Name("zoomOut");
                        items.Add().Name("zoomDropdown");
                    });
                }))

    function imageRendered(e) {
        e.sender.executeCommand({ command: "ZoomImageEditorCommand", options: "fitToScreen" });
    }

 

Tags
Editor
Asked by
Joel
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Stoyan
Telerik team
Joel
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or