Removed slider image cache since it was buggy

This commit is contained in:
nise.moe 2024-03-03 16:59:19 +01:00
parent 4bb7f0d133
commit 3ddddc168b
4 changed files with 38 additions and 58 deletions

View File

@ -37,7 +37,6 @@
"sonner": "^1.3.1",
"tailwind-merge": "^2.0.0",
"tailwindcss-animate": "^1.0.7",
"ts-md5": "^1.3.1",
"zustand": "^4.4.1"
},
"devDependencies": {
@ -3646,14 +3645,6 @@
"resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="
},
"node_modules/ts-md5": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/ts-md5/-/ts-md5-1.3.1.tgz",
"integrity": "sha512-DiwiXfwvcTeZ5wCE0z+2A9EseZsztaiZtGrtSaY5JOD7ekPnR/GoIVD5gXZAlK9Na9Kvpo9Waz5rW64WKAWApg==",
"engines": {
"node": ">=12"
}
},
"node_modules/tslib": {
"version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",

View File

@ -46,7 +46,6 @@
"sonner": "^1.3.1",
"tailwind-merge": "^2.0.0",
"tailwindcss-animate": "^1.0.7",
"ts-md5": "^1.3.1",
"zustand": "^4.4.1"
}
}

View File

@ -1,10 +1,9 @@
import { Vector2 } from "osu-classes";
import { Md5 } from "ts-md5";
import p5 from "p5";
import { loadImageAsync } from "@/utils";
export class Drawer {
private static imageCache: Record<string, p5.Graphics> = {};
static images = {
cursor: undefined as any as p5.Image,
cursortrail: undefined as any as p5.Image,
@ -129,8 +128,6 @@ export class Drawer {
static drawSliderBody(origin: Vector2, path: Vector2[], radius: number) {
Drawer.p.push();
const cacheKey = Md5.hashStr(JSON.stringify(path) + JSON.stringify(radius));
if (!this.imageCache[cacheKey]) {
const g = Drawer.p.createGraphics(512 * 4, 384 * 4);
g.scale(2);
g.translate(512 - 256, 384 - 192);
@ -170,10 +167,8 @@ export class Drawer {
g.endShape();
}
this.imageCache[cacheKey] = g;
}
Drawer.p.imageMode(Drawer.p.CORNER);
Drawer.p.image(this.imageCache[cacheKey], -256, -192, 512 * 2, 384 * 2);
Drawer.p.image(g, -256, -192, 512 * 2, 384 * 2);
Drawer.p.pop();
}

View File

@ -1899,11 +1899,6 @@ ts-interface-checker@^0.1.9:
resolved "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz"
integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==
ts-md5@^1.3.1:
version "1.3.1"
resolved "https://registry.npmjs.org/ts-md5/-/ts-md5-1.3.1.tgz"
integrity sha512-DiwiXfwvcTeZ5wCE0z+2A9EseZsztaiZtGrtSaY5JOD7ekPnR/GoIVD5gXZAlK9Na9Kvpo9Waz5rW64WKAWApg==
tslib@^2.0.0, tslib@^2.1.0, tslib@^2.4.0:
version "2.6.2"
resolved "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz"