6

This is the bounding box of a custom shape Bounding box of regular polygon with 3 sides Here the bounding box of the triangle is not getting attached correctly to the ends of the triangle ,same is the case for all regular polygons.So when we are trying to snap shapes ,shapes are not getting snapped to the ends of regular polygons correctly due to the above mentioned issue. Here is the link:- https://codesandbox.io/s/react-konva-basic-demo-btuum?file=/index.js

6by3
  • 448
  • 2
  • 5
  • 15
  • 1
    Hello Athul, welcome to stackoverflow. Please include any code examples that you've tried as text in the question itself, not as a link. You can use the "Code Sample" button in the editor pane for your question to properly format code. You may also get more responses / views to this question by adding 'javascript' as a question category. – cronburg Jul 21 '20 at 15:48

1 Answers1

3

Update:

The issue was solved from Konva side. Updated and working demo: https://codesandbox.io/s/react-konva-transformer-on-polygon-kodm7

Old answer:

Konva calculating the bounding box for regular polygon approximately. Konva just rounds that regular polygon into a circle with the same radius.

As the solution just use Konva.Line or Konva.Path for drawing regular polygons.

lavrton
  • 18,973
  • 4
  • 30
  • 63