1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-11 09:11:50 +00:00
tobspr_shapez.io/src/js/core/polyfills.ts
Даниїл Григор'єв 0670110593
Move beginCircle to polyfills.ts
Technically not a polyfill, but neither are two existing functions in
polyfills.ts.
2025-06-14 04:43:19 +03:00

22 lines
544 B
TypeScript

// Converts from degrees to radians.
Math.radians = function (degrees: number): number {
return (degrees * Math.PI) / 180.0;
};
// Converts from radians to degrees.
Math.degrees = function (radians: number): number {
return (radians * 180.0) / Math.PI;
};
// Begins a path and draws a circle.
CanvasRenderingContext2D.prototype.beginCircle = function (x: number, y: number, r: number): void {
this.beginPath();
if (r < 0.05) {
this.rect(x, y, 1, 1);
return;
}
this.arc(x, y, r, 0, 2.0 * Math.PI);
};