Edit this page

editable.drag Boolean |Object (default: true)

Specifies if the shapes and connections can be dragged.

Example - disabling dragging of shapes and connections

<div id="diagram"></div>
<script>
  var dataSource = new kendo.data.HierarchicalDataSource({
    data: [{
      "name": "Progress",
      "items": [
        {"name": "Kendo UI",
         "items":[
           {"name": "TreeList"},
           {"name": "Chart"}
         ]
        },
        {"name": "NativeScript"}
      ]
    }],
    schema: {
      model: {
        children: "items"
      }
    }
  });
  $("#diagram").kendoDiagram({
    dataSource: dataSource,
    editable: {
      drag: false
    },
    layout: {
      type: "tree",
      subtype: "down"
    },
    shapeDefaults: {
      content: {
        template: "#= name #"
      },
      width: 80,
      height: 80
    },
    connectionDefaults: {
      type: "polyline",
      startCap: "FilledCircle",
      endCap: "ArrowEnd"
    }
  });
</script>

editable.drag.snap Boolean |Object (default: true)

Specifies the shapes drag snap options. By default, during dragging, the shapes move by a given number of pixels at once. You can disable this behavior to make shapes movement smooth or you can specify a different number for the drag snap size to simulate a snap-to-grid functionality.

Example - disabling drag snap behavior in Diagram

<div id="diagram"></div>
<script>
  var dataSource = new kendo.data.HierarchicalDataSource({
    data: [{
      "name": "Progress",
      "items": [
        {"name": "Kendo UI",
         "items":[
           {"name": "TreeList"},
           {"name": "Chart"}
         ]
        },
        {"name": "NativeScript"}
      ]
    }],
    schema: {
      model: {
        children: "items"
      }
    }
  });
  $("#diagram").kendoDiagram({
    dataSource: dataSource,
    editable: {
      drag: {
        snap: false
      }
    },
    layout: {
      type: "tree",
      subtype: "down"
    },
    shapeDefaults: {
      content: {
        template: "#= name #"
      },
      width: 80,
      height: 80
    },
    connectionDefaults: {
      type: "polyline",
      startCap: "FilledCircle",
      endCap: "ArrowEnd"
    }
  });
</script>

editable.drag.snap.size Number (default: 10)

Specifies the shapes drag snap size.

Example - increasing the Diagram drag snap size

<div id="diagram"></div>
<script>
  var dataSource = new kendo.data.HierarchicalDataSource({
    data: [{
      "name": "Progress",
      "items": [
        {"name": "Kendo UI",
         "items":[
           {"name": "TreeList"},
           {"name": "Chart"}
         ]
        },
        {"name": "NativeScript"}
      ]
    }],
    schema: {
      model: {
        children: "items"
      }
    }
  });
  $("#diagram").kendoDiagram({
    dataSource: dataSource,
    editable: {
      drag: {
        snap: {
            size: 80
        }
      }
    },
    layout: {
      type: "tree",
      subtype: "down"
    },
    shapeDefaults: {
      content: {
        template: "#= name #"
      },
      width: 80,
      height: 80
    },
    connectionDefaults: {
      type: "polyline",
      startCap: "FilledCircle",
      endCap: "ArrowEnd"
    }
  });
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy