Drawing

1 Answer 61 Views
Drawing
n/a
Top achievements
Rank 1
Iron
n/a asked on 05 Dec 2022, 10:19 AM

Hello!

 

I'am traying to use drawing, How to draw a circle? in KendoReact | Telerik Forums but I get error at

surface.draw(circle);

 

TypeError: surface.draw is not a function

 

What am I doing wrong?

Is it possible to get example in Typescript?

Thank you, Matjaz

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 07 Dec 2022, 02:03 PM

Hi,  Matjaz,

The thrown error usually indicates that the the surface element is not a `Surface` drawing object. It should be created prior the drawing in a similar way:

  import { Surface } from '@progress/kendo-drawing';
  ...
  createSurface = () => {
        const element = ReactDOM.findDOMNode(this);
        this.surface = Surface.create(element);
        return this.surface;
    }

For convenience, I have created a sample where the circle is drawn successfully, so you an examine it at your end:

https://stackblitz.com/edit/react-guo6jg-rnfz7o?file=app%2Fdraw-scene.js 

Regards,
Vessy
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Drawing
Asked by
n/a
Top achievements
Rank 1
Iron
Answers by
Vessy
Telerik team
Share this question
or