I do I ensure my model data object for this Node
has those properties?
My trouble is that, I am successfully adding a Picture
to a Node
with the following template, but I can’t seem to acesss the natural width of the picture, let alone any width, when I save the properties of the Node to the database.
Here is the full unabridged Node Template:
var imagetemplate = GO(go.Node, "Horizontal",
new go.Binding("location", "shapePosition"),
new go.Binding("key", "key"),
GO(go.Picture,
{ width: 200, height: 200},
new go.Binding("angle", "rotation"),
new go.Binding("width", "width"),
new go.Binding("source", "text"),
new go.Binding("height", "height"),
new go.Binding("maxSize", "bounds")
)
)
And here is where I add the Picture
to the above template:
ticketMasterDiagram.startTransaction("add node");
ticketMasterDiagram.model.addNodeData({
key:"tes",
category:"image",
rotation:0,
text:SecureURL+ res.substring(1, res.length)});
ticketMasterDiagram.commitTransaction("add node");
I am pretty sure i have a width in the “model data object”. As this is what I set the image model data to:
{ key:Layout[j],
shapePosition:new go.Point(Number(Layout[j+1]), Number(Layout[j+2])),
width:Number(Layout[j+3]),
height:Number(Layout[j+4]),
rotation:Number(Layout[j+8]),
text: imageSource,
category:"image"};
When I alert currently the node.data.width
it is getting a 0
. Does this mean that I need to explicitly tell the Node
that I am setting the width
to the Picture’s natural width? And if so, how can i accomplish this?