|
function getNodeDefaults(obj, diagram) {
if (obj.width === undefined) {
obj.width = 145;
} else {
var ratio = 100 / obj.width;
obj.width = 100;
obj.height *= ratio;
}
obj.style = { fill: '#357BD2', strokeColor: 'white' };
//Set ports
obj.ports = getPorts(obj);
obj.constraints = ej.diagrams.NodeConstraints.Default | ej.diagrams.NodeConstraints.AllowDrop;
return obj;
} |
|
var x; var y;
function drop(args) {
// If node drops on another node, reset the node offset position.
var diagram = document.getElementById('diagram').ej2_instances[0];
args.element.offsetX = x;
args.element.offsetY = y;
diagram.dataBind();
}
function positionChange(args) {
if (args.state === "Start") {
//Store the node offset values
x = args.source.offsetX;
y = args.source.offsetY;
}
} |