Auto connector not respecting position function

8 posts, 0 answers
  1. Ralph
    Ralph avatar
    17 posts
    Member since:
    May 2011

    Posted 30 Jan 2015 Link to this post

    Hello,

    I am attempting to change the position of the auto connector. I would prefer the connector to not show up at all, but the functionality to be present. To work around this issue I am attempting to override the position function of the connector so that it sits underneath the left connector as shown in this example: http://dojo.telerik.com/iREkA/11
    However, when I hover over the shape the auto connector is still shown in the middle of the shape. If I override it outside of the shape defaults this seems to work so why would it not work in the shape defaults?

    Thanks
  2. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 03 Feb 2015 Link to this post

    Hello Ralph,

    This seems like an issue with extending the default options. I have logged it in our system and we will look into it. A possible workaround for now would be to set the connectors in the options after the initialization:
    var diagram = $("#diagram").data('kendoDiagram');
    diagram.options.shapeDefaults.connectors = [{ name: "left" }, { name: "right"}, {
        name: "auto",
        position: function(shape) {
            return shape.bounds().left();
        }
    }];


    Regards,
    Daniel
    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. phani
    phani avatar
    1 posts
    Member since:
    Mar 2015

    Posted 19 Mar 2015 in reply to Daniel Link to this post

    hi sir, 
          how can we use that in my diagram.
  5. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 23 Mar 2015 Link to this post

    Hello,

    There seems to be a problem with the attached image and I cannot open it on my side. Could you reattach the image or provide more detailed information on the problem that you are experiencing to set the connectors in your scenario.
    Also, the issue with setting the connectors with the shapeDefaults options should be fixed in the latest official release.

    Regards,
    Daniel
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Manoj
    Manoj avatar
    3 posts
    Member since:
    Jul 2015

    Posted 21 Jul 2015 Link to this post

    Hi,

    Recently i have started using Kendo UI, i must say really awesome components you people have built. I have an issue with positioning connector points on custom shapes. Dynamically i'm drawing shapes depending on some inputs Ex: input is 3 then draw a triangle, if input is 4 then draw diamond etc. for all these i need to position connector points only at the edges. Can somebody will help me with this?

  7. Manoj
    Manoj avatar
    3 posts
    Member since:
    Jul 2015

    Posted 21 Jul 2015 in reply to Manoj Link to this post

    Or else if i can restrict the number of connector points appearing then it would be helpful please find the snippet i'm using 
    var customShapes = ["",
                                  "",
                                  "M43.51,0.50 L86.50,74.50 L0.50,74.50 za",
                                  "M56.00,0.50 L111.50,37.50 L56.00,74.50 L0.50,37.50 z",
                                  "M37.50,0.50 L74.50,28.76 L60.35,74.50 L14.65,74.50 L0.50,28.76 z",
                                  "M21.56,0.50 L63.56,0.50 L84.50,37.50 L63.56,74.50 L21.56,74.50 L0.50,37.50 z",
                                  "M0.50,48.01 L7.78,15.18 L37.38,0.50 L67.10,15.18 L74.50,47.88 L54.00,74.50 L21.12,74.50 z"];
              
              $('#decisionOk').click(function(){
                  var no = $('#decisionNumber').val();
                  var shape = {"width":90,"height":110,"path":customShapes[no]};
                  var pos = new Point(xPos, yPos);
                  var transformed = diagram.documentToModel(pos);
                  shape.x = transformed.x;
                  shape.y = transformed.y;
                   
                  $('#window').hide();
                  diagram.addShape(shape);
              });
  8. Daniel
    Admin
    Daniel avatar
    2117 posts

    Posted 23 Jul 2015 Link to this post

    Hello,

    You can customize the connectors or restrict the number of connectors shown by using the shape.connectors option. In order to position the connectors only on the edges I can suggest to parse the path and use the segment points to position the connectors. I created an example that demonstrates the scenario.

    Regards,
    Daniel
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  9. Manoj
    Manoj avatar
    3 posts
    Member since:
    Jul 2015

    Posted 23 Jul 2015 in reply to Daniel Link to this post

    Hi Daniel,

     Awesome :) this really works for me. Thanks

Back to Top
Kendo UI is VS 2017 Ready