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

'Snap-to-grid' functionality

6 Answers 182 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 25 Mar 2015, 09:18 AM
Hello,

I need to organize my diagram in a way that each time I drop a shape or draw a connection, it is lined up properly.
Also is there a way to increase the movement's step of a given shape in order to make the dropped shapes organized in a better way?

Thanks in advance.

6 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 27 Mar 2015, 10:04 AM
Hello John,

There is a snap.size option that can be used to change the step but it seems that it is missing from the documentation. We will document it as soon as possible. 
Snap to grid functionality is not currently available although it is partially incorporated in the code and could be implemented by using approach similar to the one in this example.

Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Adrian
Top achievements
Rank 1
answered on 19 May 2015, 01:51 AM

Hello Daniel,

 We are trying this approach and it works but, there is an issue with editable diagrams.......shapeDefaults: {editable: {tools: ['edit', 'delete']}}

For the user issue is:  they select one element and if he deletes it,he will see another one disappearing.

Why?

By adding a drawings group at index 0, Kendo seems to lose the index for all other groups (diagram shapes) so when you attempt to delete one the immediate before is actually erased. 

Any suggestions to fix this?

Will really appreciate it Daniel

Regards

0
Daniel
Telerik team
answered on 20 May 2015, 03:31 PM
Hello Adrian,

Indeed, you are right. The elements are removed by index and an incorrect element will be removed when when inserting an additional element to the shapes group. You can avoid the problem by inserting the grid in root group:
diagram.canvas.drawingElement.insertAt(grid, 0);
In this case you will also need to scale the grid when the diagram is zoomed e.g.
zoomEnd: function(e) {                  
    this.canvas.drawingElement.children[0].transform(kendo.geometry.transform().scale(e.zoom));
}


Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Adrian
Top achievements
Rank 1
answered on 20 May 2015, 04:35 PM

Hey Daniel, 

this works great!

thank you man 

Adrian

0
Manoj
Top achievements
Rank 1
answered on 25 May 2018, 12:06 PM

Hi Daniel,

Is this can be achieved without diagram ? with just draggable / droppable

0
Konstantin Dikov
Telerik team
answered on 29 May 2018, 07:29 AM
Hi Manoj,

I have answered you in the other forum thread that you have opened with the same question. If other questions arise, please post them in the other thread:

Best Regards,
Konstantin Dikov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Diagram
Asked by
John
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Adrian
Top achievements
Rank 1
Manoj
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or