Dropping specific shapes

6 posts, 0 answers
  1. John
    John  avatar
    15 posts
    Member since:
    May 2014

    Posted 05 Mar 2015 Link to this post

    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.


  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 09 Mar 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
  4. John
    John  avatar
    15 posts
    Member since:
    May 2014

    Posted 10 Mar 2015 in reply to T. Tsonev Link to this post

    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.
  5. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 12 Mar 2015 Link to this post

    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!
     
  6. John
    John  avatar
    15 posts
    Member since:
    May 2014

    Posted 13 Mar 2015 in reply to T. Tsonev Link to this post

    Thanks for your reply, the issue is fixed now.

    Regards.
  7. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 17 Mar 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready