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

Zoom in and zoom out buttons

5 Answers 619 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Mantas
Top achievements
Rank 1
Mantas asked on 10 Jul 2017, 01:57 PM

Hello, 

I would like to implement zoom in and out buttons manually.

http://dojo.telerik.com/Irepu/5

 

Here's a dojo fiddle, and currently button zooms in and out at the very center of diagram where I use .boundingBox(). But if I click on FOCUS button (which for demo purposes moves focus to the beginning to the diagram) I would like those buttons to zoom in and out at the center of the screen which user sees, so that the beginning of the diagram would be zoom in and out.

 

As I imagine I would need some .boundingBox() offsets or something. However i can not find anything like that.

5 Answers, 1 is accepted

Sort by
0
Mantas
Top achievements
Rank 1
answered on 12 Jul 2017, 06:34 AM
Does someone has faced such kind of problem? Anyone?
0
Stefan
Telerik team
answered on 12 Jul 2017, 08:06 AM
Hello Mantas,

Thank you for the provided example.

After inspecting it, I noticed that if the bringIntoView method is not called after zooming in and our, the Diagram is not centred again.

Also, if the same shape which is passed on the focus is passed for zoom in and our, this will create a look closer to the desired result. This will require checking if the Diagram is focused already or not:

http://dojo.telerik.com/Irepu/8

I hope this is helpful.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
0
Mantas
Top achievements
Rank 1
answered on 12 Jul 2017, 10:12 AM

Appreciate your response.

However my problem is a bit different. User have buttons to move around.

So I move to the right and the most right shape is in the center of screen (first screenshot). And when I press zoom in, I would expect this shape (which was in the middle of screen) to stay in the middle of screen, but it does not (second screenshot).

I cannot use .bringIntoView(), because user might not have any shape selected. 

Is there any way to find out coordinates of visible part of diagram on screen to user?

 

1. <a href="http://imgur.com/UfKU0LQ">http://imgur.com/UfKU0LQ</a>

2. <a href="http://imgur.com/v6Sn04U">http://imgur.com/v6Sn04U</a>

0
Mantas
Top achievements
Rank 1
answered on 12 Jul 2017, 10:14 AM

Forgot to attach working sample

dojo

0
Stefan
Telerik team
answered on 14 Jul 2017, 07:02 AM
Hello Mantas,

Thank you for the provided example.

In this scenario I can suggest only zooming the Diagram without setting a specific point, as the widget will automatically zoom the currently viewed portion of the surface:

http://dojo.telerik.com/Irepu/11

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Diagram
Asked by
Mantas
Top achievements
Rank 1
Answers by
Mantas
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or