0

I am trying to create custom share a circle and BIN inside that circle to use as button. but context.circle is not working in documention they mentioned, rect, circle, text.. we can use with custom shape.

Please letme know what is the issue, is it bug or something i am missing.

var rect = new Konva.Shape({
        x: 10,
        y: 20,
        fill: '#00D2FF',
        radius: 10,
        sceneFunc: function (context, shape) {
          context.beginPath();
          context.circle(0, 0, 5);
          context.fillStrokeShape(shape);
        },
      });
Saba Naeem
  • 35
  • 5

1 Answers1

1

context argument is a wrapper around 2D native canvas context https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D.

You should use its methods to make drawings. In your case you may need context.arc: https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/arc

lavrton
  • 18,973
  • 4
  • 30
  • 63
  • Thanks for guiding me, this is sad that in documentation its not clearly mentioned. Actually i want to create cirlce and bucket svg inside that as icon to make a button. – Saba Naeem Aug 03 '22 at 09:06