The Kendo-UI Diagram widget supports moving the whole diagram using the pan() method. However, the given offset does always have to be absolute.
Consider the following example:
The diagram is zoomed in and therefore not fully visible - assume a current offset of (-100, -100). The users should be able to pan using keyboard shortcuts. Whenever pressing one of the arrow keys, the diagram is moved in the corresponding direction by e.g. 50px:
If the user presses [ArrowRight], pan() needs to be called with an offset of (-50, -100).
If the user presses [ArrowUp], pan() needs to be called with an offset of (-100, -150).
However, since I do not know how much the diagram has already been moved, I cannot set the absolute offset required.
I have seen that pan() returns the current offset when being called without arguments, but this is not documented. Is this safe to use for that purpose or is there a better alternative? If yes, the documentation should be updated.
Hello, Michael,
Indeed the pan method returns the current pan x and y values, we will make sure to update the documentation to reflect that. You can safely use the pan method for that purpose.
Let me know if you have any further questions.
Regards,
Martin
Progress Telerik
Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!