By default, the edge preview on drawing a new connection is a straight line, how do you set the edge style of that preview (with the assumption that the edge style of the finished edge is the same)?

asked 21 Apr '11, 03:37

David's gravatar image

David
4.9k21831
accept rate: 47%


Override graph.connectionHandler.createEdgeState like so:

graph.connectionHandler.createEdgeState = function(me)
{
    var edge = graph.createEdge(null, null, null, null, null, 'edgeStyle=elbowEdgeStyle');
    return new mxCellState(this.graph.view, edge, this.graph.getCellStyle(edge));
};

This function is called when a new edge is drawn for preview, the edgeStyle parameter will determine the edge style applied. That edge style will then be transferred to the edge created after the preview.

link

answered 21 Apr '11, 03:49

David's gravatar image

David
4.9k21831
accept rate: 47%

edited 26 Jun '12, 16:26

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×228
×100
×50
×4
×3

Asked: 21 Apr '11, 03:37

Seen: 2,887 times

Last updated: 26 Jun '12, 16:26