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

Dropping specific shapes

5 Answers 118 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 05 Mar 2015, 09:38 AM
Hi,
I am facing issues when dropping specific shapes, I mean by specific, some shapes that are drawn using svg paths; in this case, the dropped shape is either dropped as rectangle or failed to be dropped.
I am using the following code:   
$("#diagram").kendoDropTarget({
    drop: function (e) {
        var item, pos, transformed;
        if (e.draggable.hint) {
            item = e.draggable.hint.data("shape");
            pos = e.draggable.hintOffset;
            pos = new Point(pos.left, pos.top);
            var transformed = diagram.documentToModel(pos);
            item.x = transformed.x;
            item.y = transformed.y;

            diagram.addShape(item);
        }
    }
});

Thanks in advance.


5 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 09 Mar 2015, 08:12 AM
Hi,

My guess here is that we don't support the particular path syntax.

It might be a syntax error as well, but that's easy to rule out.
Just place them in a regular SVG document to see if they show up.

Internally this is handled through the Path.parse method.
There's a snippet in the docs that demonstrates how it works on a sample path definition.
You can run it in the Dojo by clicking the "Edit this example"

Can you send us a sample in the Dojo with the paths that fail to parse?

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
John
Top achievements
Rank 1
answered on 10 Mar 2015, 07:56 AM
Thanks for your response.
The path is "M1 10 L 1 0.5 M20 0 L 20 74.5 M0.5 0.5 L 111.5 0.5 111.5 0 111.5 74.5 0 74.5Z M20 38.5 L 111.5 38.5", in addition to the stroke properties, I need to specify the x, y coordinates when dropping the shape.

Regards.
0
T. Tsonev
Telerik team
answered on 12 Mar 2015, 08:21 AM
Hello,

The path is parsed successfully so its syntax shouldn't be a problem.
I also tried adding it to the diagram and it seems to work fine.

The coordinates can be set during the shape creation. I've commented the code in the snippet.

Can you spot any differences with your scenario?

Regards,
T. Tsonev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
John
Top achievements
Rank 1
answered on 13 Mar 2015, 09:45 AM
Thanks for your reply, the issue is fixed now.

Regards.
0
T. Tsonev
Telerik team
answered on 17 Mar 2015, 07:29 AM
Hi,

Great! Glad to hear everything worked out OK on your end.

Regards,
T. Tsonev
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
T. Tsonev
Telerik team
John
Top achievements
Rank 1
Share this question
or