Vanquished Wombat
Vanquished Wombat

Reputation: 9545

Konva transformer avoid snap to grid for rotation

In my transformer I am using anchor snapping to line up the sizing anchors with a grid. But the code also executes when I use the rotating anchor.

How can I use the snap-to-grid code but not for the rotation anchor?

Upvotes: 0

Views: 60

Answers (1)

Vanquished Wombat
Vanquished Wombat

Reputation: 9545

The snap to grid demo in the Konva docs uses the following code to recognise the rotation anchor and exit the function before the snapping code runs.

// do not snap rotating point
if (tr.getActiveAnchor() === 'rotater') {
  return newPos;
}

Upvotes: 1

Related Questions