Fix for donuts

This commit is contained in:
2023-12-18 19:35:22 +02:00
parent 20d2e3a176
commit 7a5f15b29d

View File

@ -2523,9 +2523,9 @@ export class UserAPI {
circle = this.ball; circle = this.ball;
public donut = ( public donut = (
slices: number = 3, slices: number | ShapeObject = 3,
eaten: number = 0, eaten: number = 0,
radius: number | ShapeObject = this.hc() / 3, radius: number = this.hc() / 3,
hole: number = this.hc() / 12, hole: number = this.hc() / 12,
fillStyle: string = "white", fillStyle: string = "white",
secondary: string = "black", secondary: string = "black",
@ -2534,13 +2534,13 @@ export class UserAPI {
x: number = this.wc(), x: number = this.wc(),
y: number = this.hc(), y: number = this.hc(),
): boolean => { ): boolean => {
if (typeof radius === "object") { if (typeof slices === "object") {
fillStyle = radius.fillStyle || "white"; fillStyle = slices.fillStyle || "white";
x = radius.x || this.wc(); x = slices.x || this.wc();
y = radius.y || this.hc(); y = slices.y || this.hc();
rotate = radius.rotate || 0; rotate = slices.rotate || 0;
slices = radius.slices || 3; radius = slices.radius || this.hc() / 3;
radius = radius.radius || this.hc() / 3; slices = slices.slices || 3;
} }
const canvas: HTMLCanvasElement = this.app.interface.drawings as HTMLCanvasElement; const canvas: HTMLCanvasElement = this.app.interface.drawings as HTMLCanvasElement;