label gets too big for control

If we allow a user to edit a label, is there anyway of resizing the control automatically to take into account the size of the label ?

1 Reply

SG Shyam G Syncfusion Team October 19, 2017 12:35 PM UTC

Hi Julian, 
 
Please use textChange event which triggers when the label editing is ended. In this event, you can take the text bounds and set it for node’s width and height using diagram updateNode method. Please refer to the code example and help documentation. 
 
Code example: 
 
  <ej-diagram id="diagramCore" width="100%" height="100%" textChange="textchange($event)"> 
                </ej-diagram> 
 
  textChange (args) { 
                        var diagram = $("#diagram").ejDiagram("instance"); 
                        if (args && args.element) { 
                            //get the textbox bounds 
                            var bounds = document.getElementById(args.diagramId + "_editBox").getBoundingClientRect(); 
                            //update the node size 
                            diagram.updateNode(args.element.name, { width: bounds.width, height: bounds.height }); 
                        } 
                    } 
 
 
Regards, 
Shyam G 


Loader.
Up arrow icon