OOh, I set binding on shape but should on Panel. Thank you
I change my code, and initial alignment correctly work.
const TextAdornmentPanel = $(
go.Panel,
‘Auto’,
{
isActionable: true,
actionMove: handleMoveAdornmentPanel,
},
new go.Binding(‘alignment’,‘alignment’,go.Spot.parse).makeTwoWay( go.Spot.stringify)
$(
go.Shape,
new go.Binding(‘stroke’, ‘strokeColor’),
new go.Binding(‘strokeWidth’, ‘strokeWidth’),
new go.Binding(‘fill’, ‘fillColor’),
new go.Binding(‘figure’, ‘figure’),
),
$(
go.Panel,
‘Spot’,
{
padding: new go.Margin(3, 3, 3, 3),
},
$(
go.TextBlock,
{
textAlign: ‘center’,
verticalAlignment: go.Spot.Center,
overflow: go.TextBlock.OverflowEllipsis,
isMultiline: false,
editable: false,
},
new go.Binding(‘text’, ‘text’),
),
),
);
but makeTwoWay not work. I think the problem in handleMoveAdornmentPanel
in next code
const newSpot = new go.Spot(0, 0, dx, dy);
obj.alignment = newSpot;