Harmonize ration param name
This commit is contained in:
46
src/API.ts
46
src/API.ts
@ -86,10 +86,9 @@ export type ShapeObject = {
|
|||||||
fillStyle: string,
|
fillStyle: string,
|
||||||
secondary: string,
|
secondary: string,
|
||||||
strokeStyle: string,
|
strokeStyle: string,
|
||||||
rotate: number,
|
rotation: number,
|
||||||
points: number,
|
points: number,
|
||||||
outerRadius: number,
|
outerRadius: number,
|
||||||
rotation: number,
|
|
||||||
eyeSize: number,
|
eyeSize: number,
|
||||||
happiness: number,
|
happiness: number,
|
||||||
slices: number,
|
slices: number,
|
||||||
@ -2455,7 +2454,7 @@ export class UserAPI {
|
|||||||
public equilateral = (
|
public equilateral = (
|
||||||
radius: number|ShapeObject = this.hc()/3,
|
radius: number|ShapeObject = this.hc()/3,
|
||||||
fillStyle: string = "white",
|
fillStyle: string = "white",
|
||||||
rotate: number = 0,
|
rotation: number = 0,
|
||||||
x: number = this.wc(),
|
x: number = this.wc(),
|
||||||
y: number = this.hc(),
|
y: number = this.hc(),
|
||||||
): boolean => {
|
): boolean => {
|
||||||
@ -2463,14 +2462,14 @@ export class UserAPI {
|
|||||||
fillStyle = radius.fillStyle || "white";
|
fillStyle = radius.fillStyle || "white";
|
||||||
x = radius.x || this.wc();
|
x = radius.x || this.wc();
|
||||||
y = radius.y || this.hc();
|
y = radius.y || this.hc();
|
||||||
rotate = radius.rotate || 0;
|
rotation = radius.rotation || 0;
|
||||||
radius = radius.radius || this.hc()/3;
|
radius = radius.radius || this.hc()/3;
|
||||||
}
|
}
|
||||||
const canvas: HTMLCanvasElement = this.app.interface.drawings as HTMLCanvasElement;
|
const canvas: HTMLCanvasElement = this.app.interface.drawings as HTMLCanvasElement;
|
||||||
const ctx = canvas.getContext("2d")!;
|
const ctx = canvas.getContext("2d")!;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x, y);
|
ctx.translate(x, y);
|
||||||
ctx.rotate((rotate * Math.PI) / 180);
|
ctx.rotate((rotation * Math.PI) / 180);
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(0, -radius);
|
ctx.moveTo(0, -radius);
|
||||||
ctx.lineTo(radius, radius);
|
ctx.lineTo(radius, radius);
|
||||||
@ -2486,7 +2485,7 @@ export class UserAPI {
|
|||||||
width: number|ShapeObject = this.hc()/3,
|
width: number|ShapeObject = this.hc()/3,
|
||||||
height: number = this.hc()/3,
|
height: number = this.hc()/3,
|
||||||
fillStyle: string = "white",
|
fillStyle: string = "white",
|
||||||
rotate: number = 0,
|
rotation: number = 0,
|
||||||
x: number = this.wc(),
|
x: number = this.wc(),
|
||||||
y: number = this.hc(),
|
y: number = this.hc(),
|
||||||
): boolean => {
|
): boolean => {
|
||||||
@ -2494,7 +2493,7 @@ export class UserAPI {
|
|||||||
fillStyle = width.fillStyle || "white";
|
fillStyle = width.fillStyle || "white";
|
||||||
x = width.x || this.wc();
|
x = width.x || this.wc();
|
||||||
y = width.y || this.hc();
|
y = width.y || this.hc();
|
||||||
rotate = width.rotate || 0;
|
rotation = width.rotation || 0;
|
||||||
height = width.height || this.hc()/3;
|
height = width.height || this.hc()/3;
|
||||||
width = width.width || this.hc()/3;
|
width = width.width || this.hc()/3;
|
||||||
}
|
}
|
||||||
@ -2502,7 +2501,7 @@ export class UserAPI {
|
|||||||
const ctx = canvas.getContext("2d")!;
|
const ctx = canvas.getContext("2d")!;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x, y);
|
ctx.translate(x, y);
|
||||||
ctx.rotate((rotate * Math.PI) / 180);
|
ctx.rotate((rotation * Math.PI) / 180);
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(0, -height);
|
ctx.moveTo(0, -height);
|
||||||
ctx.lineTo(width, height);
|
ctx.lineTo(width, height);
|
||||||
@ -2546,7 +2545,7 @@ export class UserAPI {
|
|||||||
fillStyle: string = "white",
|
fillStyle: string = "white",
|
||||||
secondary: string = "black",
|
secondary: string = "black",
|
||||||
stroke: string = "black",
|
stroke: string = "black",
|
||||||
rotate: number = 0,
|
rotation: number = 0,
|
||||||
x: number = this.wc(),
|
x: number = this.wc(),
|
||||||
y: number = this.hc(),
|
y: number = this.hc(),
|
||||||
): boolean => {
|
): boolean => {
|
||||||
@ -2554,7 +2553,7 @@ export class UserAPI {
|
|||||||
fillStyle = slices.fillStyle || "white";
|
fillStyle = slices.fillStyle || "white";
|
||||||
x = slices.x || this.wc();
|
x = slices.x || this.wc();
|
||||||
y = slices.y || this.hc();
|
y = slices.y || this.hc();
|
||||||
rotate = slices.rotate || 0;
|
rotation = slices.rotation || 0;
|
||||||
radius = slices.radius || this.hc() / 3;
|
radius = slices.radius || this.hc() / 3;
|
||||||
eaten = slices.eaten || 0;
|
eaten = slices.eaten || 0;
|
||||||
hole = slices.hole || this.hc() / 12;
|
hole = slices.hole || this.hc() / 12;
|
||||||
@ -2567,7 +2566,7 @@ export class UserAPI {
|
|||||||
const ctx = canvas.getContext("2d")!;
|
const ctx = canvas.getContext("2d")!;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x, y);
|
ctx.translate(x, y);
|
||||||
ctx.rotate((rotate * Math.PI) / 180);
|
ctx.rotate((rotation * Math.PI) / 180);
|
||||||
|
|
||||||
if(slices<2) {
|
if(slices<2) {
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
@ -2629,7 +2628,7 @@ export class UserAPI {
|
|||||||
fillStyle: string = "white",
|
fillStyle: string = "white",
|
||||||
secondary: string = "black",
|
secondary: string = "black",
|
||||||
stroke: string = "black",
|
stroke: string = "black",
|
||||||
rotate: number = 0,
|
rotation: number = 0,
|
||||||
x: number = this.wc(),
|
x: number = this.wc(),
|
||||||
y: number = this.hc(),
|
y: number = this.hc(),
|
||||||
): boolean => {
|
): boolean => {
|
||||||
@ -2637,7 +2636,7 @@ export class UserAPI {
|
|||||||
fillStyle = slices.fillStyle || "white";
|
fillStyle = slices.fillStyle || "white";
|
||||||
x = slices.x || this.wc();
|
x = slices.x || this.wc();
|
||||||
y = slices.y || this.hc();
|
y = slices.y || this.hc();
|
||||||
rotate = slices.rotate || 0;
|
rotation = slices.rotation || 0;
|
||||||
radius = slices.radius || this.hc() / 3;
|
radius = slices.radius || this.hc() / 3;
|
||||||
secondary = slices.secondary || "black";
|
secondary = slices.secondary || "black";
|
||||||
stroke = slices.stroke || "black";
|
stroke = slices.stroke || "black";
|
||||||
@ -2649,7 +2648,7 @@ export class UserAPI {
|
|||||||
const ctx = canvas.getContext("2d")!;
|
const ctx = canvas.getContext("2d")!;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x, y);
|
ctx.translate(x, y);
|
||||||
ctx.rotate((rotate * Math.PI) / 180);
|
ctx.rotate((rotation * Math.PI) / 180);
|
||||||
|
|
||||||
if(slices<2) {
|
if(slices<2) {
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
@ -2697,7 +2696,7 @@ export class UserAPI {
|
|||||||
points: number|ShapeObject = 5,
|
points: number|ShapeObject = 5,
|
||||||
radius: number = this.hc()/3,
|
radius: number = this.hc()/3,
|
||||||
fillStyle: string = "white",
|
fillStyle: string = "white",
|
||||||
rotate: number = 0,
|
rotation: number = 0,
|
||||||
outerRadius: number = radius/100,
|
outerRadius: number = radius/100,
|
||||||
x: number = this.wc(),
|
x: number = this.wc(),
|
||||||
y: number = this.hc(),
|
y: number = this.hc(),
|
||||||
@ -2707,7 +2706,7 @@ export class UserAPI {
|
|||||||
fillStyle = points.fillStyle || "white";
|
fillStyle = points.fillStyle || "white";
|
||||||
x = points.x || this.wc();
|
x = points.x || this.wc();
|
||||||
y = points.y || this.hc();
|
y = points.y || this.hc();
|
||||||
rotate = points.rotate || 0;
|
rotation = points.rotation || 0;
|
||||||
outerRadius = points.outerRadius || radius/100;
|
outerRadius = points.outerRadius || radius/100;
|
||||||
points = points.points || 5;
|
points = points.points || 5;
|
||||||
}
|
}
|
||||||
@ -2717,7 +2716,7 @@ export class UserAPI {
|
|||||||
const ctx = canvas.getContext("2d")!;
|
const ctx = canvas.getContext("2d")!;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x, y);
|
ctx.translate(x, y);
|
||||||
ctx.rotate((rotate * Math.PI) / 180);
|
ctx.rotate((rotation * Math.PI) / 180);
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(0, -radius);
|
ctx.moveTo(0, -radius);
|
||||||
for (let i = 0; i < points; i++) {
|
for (let i = 0; i < points; i++) {
|
||||||
@ -2736,7 +2735,7 @@ export class UserAPI {
|
|||||||
public stroke = (
|
public stroke = (
|
||||||
width: number|ShapeObject = 1,
|
width: number|ShapeObject = 1,
|
||||||
strokeStyle: string = "white",
|
strokeStyle: string = "white",
|
||||||
rotate: number = 0,
|
rotation: number = 0,
|
||||||
x1: number = this.wc()-this.wc()/10,
|
x1: number = this.wc()-this.wc()/10,
|
||||||
y1: number = this.hc(),
|
y1: number = this.hc(),
|
||||||
x2: number = this.wc()+this.wc()/5,
|
x2: number = this.wc()+this.wc()/5,
|
||||||
@ -2748,14 +2747,14 @@ export class UserAPI {
|
|||||||
y1 = width.y1 || this.hc();
|
y1 = width.y1 || this.hc();
|
||||||
x2 = width.x2 || this.wc()+this.wc()/5;
|
x2 = width.x2 || this.wc()+this.wc()/5;
|
||||||
y2 = width.y2 || this.hc();
|
y2 = width.y2 || this.hc();
|
||||||
rotate = width.rotate || 0;
|
rotation = width.rotation || 0;
|
||||||
width = width.width || 1;
|
width = width.width || 1;
|
||||||
}
|
}
|
||||||
const canvas: HTMLCanvasElement = this.app.interface.drawings as HTMLCanvasElement;
|
const canvas: HTMLCanvasElement = this.app.interface.drawings as HTMLCanvasElement;
|
||||||
const ctx = canvas.getContext("2d")!;
|
const ctx = canvas.getContext("2d")!;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x1, y1);
|
ctx.translate(x1, y1);
|
||||||
ctx.rotate((rotate * Math.PI) / 180);
|
ctx.rotate((rotation * Math.PI) / 180);
|
||||||
ctx.beginPath();
|
ctx.beginPath();
|
||||||
ctx.moveTo(0, 0);
|
ctx.moveTo(0, 0);
|
||||||
ctx.lineTo(x2-x1, y2-y1);
|
ctx.lineTo(x2-x1, y2-y1);
|
||||||
@ -2770,7 +2769,7 @@ export class UserAPI {
|
|||||||
width: number|ShapeObject = this.wc()/4,
|
width: number|ShapeObject = this.wc()/4,
|
||||||
height: number = this.wc()/4,
|
height: number = this.wc()/4,
|
||||||
fillStyle: string = "white",
|
fillStyle: string = "white",
|
||||||
rotate: number = 0,
|
rotation: number = 0,
|
||||||
x: number = this.wc()-this.wc()/8,
|
x: number = this.wc()-this.wc()/8,
|
||||||
y: number = this.hc()-this.hc()/8,
|
y: number = this.hc()-this.hc()/8,
|
||||||
): boolean => {
|
): boolean => {
|
||||||
@ -2778,16 +2777,15 @@ export class UserAPI {
|
|||||||
fillStyle = width.fillStyle || "white";
|
fillStyle = width.fillStyle || "white";
|
||||||
x = width.x || this.wc()-this.wc()/4;
|
x = width.x || this.wc()-this.wc()/4;
|
||||||
y = width.y || this.hc()-this.hc()/2;
|
y = width.y || this.hc()-this.hc()/2;
|
||||||
rotate = width.rotate || 0;
|
rotation = width.rotation || 0;
|
||||||
height = width.height || this.wc()/4;
|
height = width.height || this.wc()/4;
|
||||||
width = width.width || this.wc()/4;
|
width = width.width || this.wc()/4;
|
||||||
|
|
||||||
}
|
}
|
||||||
const canvas: HTMLCanvasElement = this.app.interface.drawings as HTMLCanvasElement;
|
const canvas: HTMLCanvasElement = this.app.interface.drawings as HTMLCanvasElement;
|
||||||
const ctx = canvas.getContext("2d")!;
|
const ctx = canvas.getContext("2d")!;
|
||||||
ctx.save();
|
ctx.save();
|
||||||
ctx.translate(x, y);
|
ctx.translate(x, y);
|
||||||
ctx.rotate((rotate * Math.PI) / 180);
|
ctx.rotate((rotation * Math.PI) / 180);
|
||||||
ctx.fillStyle = fillStyle;
|
ctx.fillStyle = fillStyle;
|
||||||
ctx.fillRect(0, 0, width, height);
|
ctx.fillRect(0, 0, width, height);
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
|
|||||||
Reference in New Issue
Block a user