Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
load1n9 committed Feb 27, 2023
1 parent f575ff2 commit 8e2142d
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 72 deletions.
1 change: 0 additions & 1 deletion examples/canvas-svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ applyDark(win.window);

win.ctx.scale(15, 15);
win.onDraw = (ctx) => {

// from https://github.com/microsoft/fluentui-emoji/blob/main/assets/Avocado/Flat/avocado_flat.svg
ctx.fillStyle = "#44911B";
ctx.fill(
Expand Down
1 change: 0 additions & 1 deletion examples/cube2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ win.window.setIcon(decode(new Uint8Array(await img.arrayBuffer())));
applyMicaAlt(win.window);
applyDark(win.window);


const ctx = win.ctx;
ctx.fillStyle = "#fff";
ctx.strokeStyle = "#fff";
Expand Down
120 changes: 60 additions & 60 deletions examples/imgui2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,76 +56,76 @@ for (let i = -step * steps / 2; i < step * steps; i += step) {
}

win.onDraw = (ctx) => {
theta += 3;
if (theta > 360) {
theta = 0;
theta += 3;
if (theta > 360) {
theta = 0;
}
thetaY = theta * Math.PI / 180;
thetaZ = theta * Math.PI / 180;
thetaX = theta * Math.PI / 180;
const matrix2 = [];
for (const column of matrix) {
const column2 = [];
for (const row of column) {
const row2 = [];
for (const point of row) {
let x = point[0];
let y = point[1];
let z = point[2];
x = x * Math.cos(thetaX) - z * Math.sin(thetaX);
z = point[0] * Math.sin(thetaX) + z * Math.cos(thetaX);
y = y * Math.cos(thetaY) - z * Math.sin(thetaY);
z = point[1] * Math.sin(thetaY) + z * Math.cos(thetaY);
const x2 = x;
x = x * Math.cos(thetaZ) - y * Math.sin(thetaZ);
y = x2 * Math.sin(thetaZ) + y * Math.cos(thetaZ);

ctx.beginPath();
ctx.arc(x + d, y + d, 5, 0, 2 * Math.PI, false);
ctx.fill();
row2.push([x + d, y + d]);
}
column2.push(row2);
}
thetaY = theta * Math.PI / 180;
thetaZ = theta * Math.PI / 180;
thetaX = theta * Math.PI / 180;
const matrix2 = [];
for (const column of matrix) {
const column2 = [];
for (const row of column) {
const row2 = [];
for (const point of row) {
let x = point[0];
let y = point[1];
let z = point[2];
x = x * Math.cos(thetaX) - z * Math.sin(thetaX);
z = point[0] * Math.sin(thetaX) + z * Math.cos(thetaX);
y = y * Math.cos(thetaY) - z * Math.sin(thetaY);
z = point[1] * Math.sin(thetaY) + z * Math.cos(thetaY);
const x2 = x;
x = x * Math.cos(thetaZ) - y * Math.sin(thetaZ);
y = x2 * Math.sin(thetaZ) + y * Math.cos(thetaZ);

matrix2.push(column2);
}

for (let i = 0; i < matrix2.length; i++) {
for (let j = 0; j < matrix2[i].length; j++) {
for (let k = 0; k < matrix2[i][j].length; k++) {
const point = matrix2[i][j][k];
const point2 = matrix2[i][j][k + 1];
if (point2) {
ctx.beginPath();
ctx.arc(x + d, y + d, 5, 0, 2 * Math.PI, false);
ctx.fill();
row2.push([x + d, y + d]);
ctx.moveTo(point[0], point[1]);
ctx.lineTo(point2[0], point2[1]);
ctx.stroke();
}
column2.push(row2);
}
matrix2.push(column2);
}

for (let i = 0; i < matrix2.length; i++) {
for (let j = 0; j < matrix2[i].length; j++) {
const point = matrix2[i][j];
const point2 = matrix2[i][j + 1];
if (point2) {
for (let k = 0; k < matrix2[i][j].length; k++) {
const point = matrix2[i][j][k];
const point2 = matrix2[i][j][k + 1];
if (point2) {
ctx.beginPath();
ctx.moveTo(point[0], point[1]);
ctx.lineTo(point2[0], point2[1]);
ctx.stroke();
}
}
const point = matrix2[i][j];
const point2 = matrix2[i][j + 1];
if (point2) {
for (let k = 0; k < matrix2[i][j].length; k++) {
ctx.beginPath();
ctx.moveTo(point[k][0], point[k][1]);
ctx.lineTo(point2[k][0], point2[k][1]);
ctx.stroke();
}
ctx.beginPath();
ctx.moveTo(point[k][0], point[k][1]);
ctx.lineTo(point2[k][0], point2[k][1]);
ctx.stroke();
}
}
const point = matrix2[i];
const point2 = matrix2[i + 1];
if (point2) {
for (let j = 0; j < matrix2[i].length; j++) {
for (let k = 0; k < matrix2[i][j].length; k++) {
ctx.beginPath();
ctx.moveTo(point[j][k][0], point[j][k][1]);
ctx.lineTo(point2[j][k][0], point2[j][k][1]);
ctx.stroke();
}
}
const point = matrix2[i];
const point2 = matrix2[i + 1];
if (point2) {
for (let j = 0; j < matrix2[i].length; j++) {
for (let k = 0; k < matrix2[i][j].length; k++) {
ctx.beginPath();
ctx.moveTo(point[j][k][0], point[j][k][1]);
ctx.lineTo(point2[j][k][0], point2[j][k][1]);
ctx.stroke();
}
}
}
}
};

await mainloop(() => {
Expand Down
1 change: 0 additions & 1 deletion ext/styles/darwin.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { StylePlatform } from "./platform.ts";
import { DwmWindow } from "../../mod.ts";


function applyBlur(win: DwmWindow) {
console.warn("blur not implemented for this system");
}
Expand Down
1 change: 0 additions & 1 deletion ext/styles/linux.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { StylePlatform } from "./platform.ts";
import { DwmWindow } from "../../mod.ts";


function applyBlur(win: DwmWindow) {
console.warn("blur not implemented for this system");
}
Expand Down
16 changes: 8 additions & 8 deletions ext/styles/platform.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { DwmWindow } from "../../mod.ts";

export interface StylePlatform {
applyBlur(win: DwmWindow): void;
clearBlur(win: DwmWindow): void;
applyMica(win: DwmWindow): void;
applyDark(win: DwmWindow): void;
applyLight(win: DwmWindow): void;
applyMicaAlt(win: DwmWindow): void;
clearMica(win: DwmWindow): void;
}
applyBlur(win: DwmWindow): void;
clearBlur(win: DwmWindow): void;
applyMica(win: DwmWindow): void;
applyDark(win: DwmWindow): void;
applyLight(win: DwmWindow): void;
applyMicaAlt(win: DwmWindow): void;
clearMica(win: DwmWindow): void;
}

0 comments on commit 8e2142d

Please sign in to comment.