fabricjs / fabric.js

Javascript Canvas Library, SVG-to-Canvas (& canvas-to-SVG) Parser
http://fabricjs.com
Other
28.56k stars 3.48k forks source link

[Feature]: Use radians for angles in Circle #9654

Open lbordowitz opened 6 months ago

lbordowitz commented 6 months ago

CheckList

Description

With a clean break between Fabric 5.0.0 and Fabric 6.0.0, it would be nice to have the angle provided in radians in the Circle class, maybe any other places that are still using degrees.

Current State

The current code uses degrees instead of radians. That's a bit awkward in some spots.

Additional Context

The endAngle documentation mentions " End angle of the circle probably will change to degrees in next major version ". Was it previously radians, and then changed to degrees? If that's the case, maybe just the documentation needs to change?

ShaMan123 commented 6 months ago

An effort was made to move all to deg Why do you need rads? It is annoying working in rads and needing to convert only for it to be converted back. I would say that a robust soultion would be to introduce a class

class Angle {
  static deg(value: TDegree) 
  static rad(value: TRadian) 

  // impl lazy getters
  get/set deg() 
  get/set rad() 

}

and have the codebase use this class all over with lazy getters it will save compution and make all of us happy

asturur commented 6 months ago

Yes it was in radians before and then moved to angle and the documentation should be fixed.