Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic AllowInplaceEdit textbox size (Read 3035 times)
Kiran B
Full Member
***
Offline


I Love MindFusion!

Posts: 102
Joined: Apr 19th, 2013
AllowInplaceEdit textbox size
Apr 29th, 2013 at 9:24am
Print Post  
Hi,

Is there any way to control the edit area height and width? By default it take the size of the shape. I want it to be consistent. I want to provide fixed height and width for all the shapes. Also is there any way to restrict multi line entry?

Thanks
Kiran B
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: AllowInplaceEdit textbox size
Reply #1 - Apr 29th, 2013 at 11:39am
Print Post  
Hi,

The diagram calls a setInplaceEditBounds method before showing the text area, so you could override its size like this:

Code
Select All
var originalEditBounds = Diagram.prototype.setInplaceEditBounds;
Diagram.prototype.setInplaceEditBounds = function (rect)
{
	originalEditBounds.apply(this, [rect]);
	this.inplaceTextBox.style.width = '200px';
	this.inplaceTextBox.style.height = '200px';
}; 



Alternatively, you could override nodes' getEditRect method, returning a rectangle in logical coordinates.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Kiran B
Full Member
***
Offline


I Love MindFusion!

Posts: 102
Joined: Apr 19th, 2013
Re: AllowInplaceEdit textbox size
Reply #2 - Apr 30th, 2013 at 3:43am
Print Post  
Hi Stoyan,

I need to do this logic based on the Shape of the node. Which is the recommended way to do this.
Writing a switch case?


Thanks
Kiran B
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: AllowInplaceEdit textbox size
Reply #3 - Apr 30th, 2013 at 2:34pm
Print Post  
Yes, you could use a switch statement on the node shape's Id value:

Code
Select All
if (ShapeNode.isInstanceOfType(node))
{
	switch (node.getShape().getId())
	{
		case "Rectangle":
			...
			break;
		case "Decision":
			...
			break;
	}
} 



I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint