I have set the property of
{
rotatable: true,
locationSpot: go.Spot.Center,
rotateObjectName: “SHAPE”,
}
polygondrawing node, the geometry reshaping is moving the entire polygon around while reshaping it
if i remove locationSpot, the rotation happens from topLeft corner which i want it from center
walter
June 28, 2022, 1:08pm
2
Set rotationSpot ?
Part | GoJS API
Yes, setting it to go.Spot.Center still rotates the node from top left.
walter
June 29, 2022, 9:39am
4
Which version of GoJS are you using?
Does the Geometry Reshaping sample show the behavior that you want? If so, how is your Part different?
I’m using version 2.1
geometryReshaping is not showing the same behavior as the rotation tool from canvas.
$(
go.Node,
{
zOrder: 1,
},
),
{
selectionAdorned: true,
},
{
resizable: false,
resizeObjectName: "SHAPE",
selectionAdorned: true,
},
{
rotatable: true,
rotationSpot: go.Spot.Center,
// rotateObjectName: "SHAPE",
rotateAdornmentTemplate: _getRotateAdornmentTemplate(),
},
new go.Binding("rotationSpot", "rotSpot", go.Spot.parse).makeTwoWay(
go.Spot.stringify
),
{ reshapable: true },
$(
go.Shape,
{ name: "SHAPE", fill: "lightgray", strokeWidth: 1.5 },
new go.Binding("desiredSize", "size", go.Size.parse).makeTwoWay(
go.Size.stringify
),
new go.Binding("angle", "angle").makeTwoWay(),
new go.Binding("geometryString", "geo").makeTwoWay(),
new go.Binding("fill"),
new go.Binding("stroke"),
new go.Binding("strokeWidth"),
new go.Binding("stroke", "isSelected", (s) =>
s ? "#00D1FF" : "#333333"
).ofObject()
)
)
walter
June 30, 2022, 10:23am
6
rotationSpot is a new property in 2.2.
If you want that behavior in 2.1 you will need to implement it yourself. Try setting locationSpot to go.Spot.Center
.
while setting locationSpot to go.Spot.Center the rotation works as expected but the reshaping polygon move the entire geometry around the canvas from top left corner
walter
June 30, 2022, 10:56am
8
Well, if you want the behavior that is in that 2.2 sample, the easiest course of action is to upgrade to 2.2.
Okay, Thanks a lot Walter!