I want to show a loader icon inside a node. I have written the below code for animation. But I see that the icon is slightly moving after every rotation. If there’s a text beside it, it is moving the text as well.
var myAnimation = new go.Animation();
myAnimation.easing = go.Animation.EaseLinear;
diagram.nodes.each((node) => {
myAnimation.duration = 4000;
if (node.findObject('TESTLOADINGICON')) {
myAnimation.add(
node.findObject('TESTLOADINGICON'),
'angle',
0,
360
);
})
})
Yes it is in a horizontal panel. I have also specified height and width, but even it has enough space, it is slightly changing position. How can i avoid it?
I suppose you could surround the Picture with a “Table” Panel that has a fixed width and height big enough to hold the maximum width and height of the Picture at all angles.
Thanks, this worked. But it’s always holding fixed width and height. I want height and width go away when the picture inside Table panel is not available.
We have a loadingState property on node, when the property value is inProgress, we will be showing loading animation icon in the Picture shape. If the loadingState is null, then Picture visible property value is false.
As the Picture is wrapped inside Table Panel. Even though Picture visiblity is false, it’s occupying the space of table panel height and width.
I did try binding the visibility of the table panel based on whether picture is available or not. But as the hierarchy is Picture inside Table. Table visibility binding is invoked first and then Picture visibility.
Initially loadingState is null.
→ First Table visibility is triggered and pictureObj.isVisibileObject is false it returned false;
→ Then Picture visibility is triggered and the value is null, it also returned false.
loadingState is set to “inProgress”
→ First Table visibility is triggered and pictureObj.isVisibileObject is still false, it returned false;
→ Then Picture visibility is triggered as the value is inProgress, it returned true. But the Table visibility is false, the source svg is not rendered in Picture shape.