Bug in selectionAdornment

I’m trying to move Toolbar to the left or right if it doesn’t fit to viewport and found 2 strange things:

  1. Binding of Object new go.Binding(‘’,‘’, fn).ofObject() fires fn 5 times and 4 of them with empty node position

  2. When I select node where Toolbar shoulbe outside of veiwport it show right offset, but doesn’t move it.

here is a code Plunker - GoJs toolbar offset

Is fist point bug or there is explanation of it?
Why selection opens with wrong alignment?

Yes, when the source property is the empty string, the Binding will be evaluated frequently. That’s why we discourage such use unless it’s necessary.

I’m not sure that what you are doing will work, because you cannot depend on the exact times at which bindings are evaluated. And depending on the Diagram.viewportBounds is particularly
problematic. Better to implement a “ViewportBoundsChanged” DiagramEvent listener.

But issue is not at depending on the Diagram.viewportBounds issue in new go.Binding('alignment', '', (data) => { it return right value but set wrong value. Look at example, It return -116.666666 but set 0.

I’m saying that the conversion function is fundamentally flawed because it depends on Diagram.viewportBounds.

That property might change value and the Binding would not be evaluated. If it did magically depend on it, the potentially varying results might cause infinite updates.

And it’s value is likely to be wrong at the time the Binding is evaluated, because the viewport is normally updated long after bindings are evaluated.