1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-09 16:21:51 +00:00

Move beginCircle to polyfills.ts

Technically not a polyfill, but neither are two existing functions in
polyfills.ts.
This commit is contained in:
Даниїл Григор'єв 2025-06-14 04:43:19 +03:00
parent a84837d913
commit 0670110593
No known key found for this signature in database
GPG Key ID: B890DF16341D8C1D
3 changed files with 12 additions and 15 deletions

View File

@ -9,19 +9,6 @@ import { Rectangle } from "./rectangle";
const logger = createLogger("draw_utils");
export function initDrawUtils() {
CanvasRenderingContext2D.prototype.beginCircle = function (x, y, r) {
this.beginPath();
if (r < 0.05) {
this.rect(x, y, 1, 1);
return;
}
this.arc(x, y, r, 0, 2.0 * Math.PI);
};
}
/**
*
* @param {object} param0

View File

@ -7,3 +7,15 @@ Math.radians = function (degrees: number): number {
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);
};

View File

@ -5,7 +5,6 @@ import "./mods/modloader";
import { Application } from "./application";
import { IS_DEBUG } from "./core/config";
import { initDrawUtils } from "./core/draw_utils";
import { createLogger, logSection } from "./core/logging";
import { initComponentRegistry } from "./game/component_registry";
import { initGameModeRegistry } from "./game/game_mode_registry";
@ -43,7 +42,6 @@ console.log("%cDEVCODE BUILT IN", "color: #f77");
logSection("Boot Process", "#f9a825");
initDrawUtils();
initComponentRegistry();
initItemRegistry();
initMetaBuildingRegistry();