Fix position of part in viewport

Hi there,

I have some metadata I’d like to display in the top right corner of the viewport. The only trick is that I’d like it to stay in that position when the user scrolls or pans the diagram. At the moment I’m updating the position of the part when the viewport bounds change (the part is fixed to (0, 0) in view coords). However, I’m getting a bit of jitter with the part when the user pans the diagram. Best way to describe it is that it looks like the text is vibrating. Is there a better way to do this that I’m not aware of?

this.diagram.addDiagramListener("ViewportBoundsChanged", e => {
    const bounds = e.diagram.viewportBounds.position.copy();
    this.metadata.location = new go.Point(bounds.x, bounds.y);
});

Edit: Sorry I should note that I’m only seeing this behaviour in Chrome

See GoJS Legends and Titles -- Northwoods Software.

Your way of doing things is fine, but as you note, it is subject to all viewport changes, which may result in minor jittering. Often, it’s better to use a separate HTML element in front of the diagram which can remain fixed in the corner independent of scrolling/panning/zooming within the diagram.