1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 02:01:51 +00:00
tobspr_shapez.io/src/js/core/polyfills.ts

22 lines
544 B
TypeScript
Raw Normal View History

// 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);
};