Using a new Point in creating a path results in error in a production build

2 Answers 57 Views
Drawing
Noah
Top achievements
Rank 2
Iron
Iron
Iron
Noah asked on 31 May 2024, 03:05 PM

Using a Point object created with its constructor as the moveTo for a path fails when built for production but works when debugging.

    const moveTo: Point = new Point(x, y);
    path
      .moveTo(moveTo)
      .lineTo(moveTo.x + offsets[0].x, moveTo.y + offsets[0].y)
      .lineTo(moveTo.x + offsets[1].x, moveTo.y + offsets[1].y)
      .lineTo(moveTo.x + offsets[2].x, moveTo.y + offsets[2].y)
      .lineTo(moveTo)
      .fill('red');

 

If I use the code above, that path will draw just fine when built with development settings, but if I build the app for production it fails with NaN errors on the paths SVG Move step.  (the error has SVG that looks like 'M Nan')

however, if I just use the X and Y coordinates, it works... the following works in production.  I don't know if it's a bug or I'm doing something wrong, but the fact that it works in a dev build, but not an optimized production build makes me think it's a bug.

    path
      .moveTo(moveTo.x, moveTo.y)

 

2 Answers, 1 is accepted

Sort by
0
Martin Bechev
Telerik team
answered on 05 Jun 2024, 01:23 PM

Hello Noah,

There are two methods moveTo - the first accepts x and y values as arguments, while the second one accepts a Point as argument.

When drawing a Path it looks that moveTo works only with x and y values:

https://stackblitz.com/edit/angular-dsf2d1

Passing a Point throws this error:

I will discuss this matter with the development team, and follow you back once I have more details.

Regards,
Martin Bechev
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
0
Martin Bechev
Telerik team
answered on 06 Jun 2024, 02:41 PM

Hi Noah,

I discussed this case with the developers. The moveTo(Point) doesn't work, but moveTo(x, y) does, because most probably there two copies of the Drawing packages are loaded.

Please execute the following command to check if there are multiple versions installed:

npm ls @progress/kendo-drawing

Regards,
Martin Bechev
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Noah
Top achievements
Rank 2
Iron
Iron
Iron
commented on 06 Jun 2024, 02:54 PM

looks like they're all the same version.

Martin Bechev
Telerik team
commented on 07 Jun 2024, 11:53 AM

Hi Noah,

Try deleting the node_modules and package-lock.json files and reinstall the dependencies with the npm install command.

Regards

Tags
Drawing
Asked by
Noah
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Martin Bechev
Telerik team
Share this question
or