I want to retrieve all TextNode and its view port location so I have function as below to get all textnode objects.
var objs = [];
var wrapObjects = dia.findObjectsIn(rect, function(o) {
if (o instanceof go.TextBlock) objs.push(o);
console.log(“Name”, o.name);
return o.name === “messageWrapShape”;
}, function(o) {
return console.log(o);
}, true);
then want to call transformDocToView to get point i m interested on but when trying to call objs[0].getDocumentPoint() for each object, I got below error – please, help.
go.js:103 Uncaught TypeError: Cannot read property ‘x’ of undefined
at z.set.z.set (go.js:103)
at Lh.G.getDocumentPoint.G.Wa (go.js:1019)
at :1:5
However, actualBoudns api worked as below for first object.
objs[0].actualBounds
B {x: 0, y: 3.1783203124999995, width: 32.62890625, height: 9.643359375000001}
I want to convert points into view port with function : transformDocToView so, I need documentPoint for first object but It always throws exception; please guide.
If you look at the documentation, GraphObject | GoJS API, you will see that it requires an argument that either is a point in local coordinates or is a spot on that object that determines the point in local coordinates to be transformed.