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

Remove prefixed imageSmoothingEnabled

webkitImageSmoothingEnabled got deprecated back in 2016.
globalConfig.smoothing.quality is now properly typed as well.
This commit is contained in:
Даниїл Григор'єв 2024-07-26 17:39:38 +03:00
parent 79c4f3b9b0
commit ed44ff1ebe
No known key found for this signature in database
GPG Key ID: B890DF16341D8C1D
4 changed files with 2 additions and 14 deletions

View File

@ -1,6 +1,6 @@
import { globalConfig } from "./config";
import { fastArrayDelete } from "./utils";
import { createLogger } from "./logging";
import { fastArrayDelete } from "./utils";
const logger = createLogger("buffer_utils");
@ -10,9 +10,6 @@ const logger = createLogger("buffer_utils");
*/
export function enableImageSmoothing(context) {
context.imageSmoothingEnabled = true;
context.webkitImageSmoothingEnabled = true;
// @ts-ignore
context.imageSmoothingQuality = globalConfig.smoothing.quality;
}
@ -22,7 +19,6 @@ export function enableImageSmoothing(context) {
*/
export function disableImageSmoothing(context) {
context.imageSmoothingEnabled = false;
context.webkitImageSmoothingEnabled = false;
}
/**

View File

@ -108,7 +108,7 @@ export const globalConfig = {
smoothing: {
smoothMainCanvas: smoothCanvas && true,
quality: "low", // Low is CRUCIAL for mobile performance!
quality: "low" as ImageSmoothingQuality, // Low is CRUCIAL for mobile performance!
},
rendering: {},

View File

@ -41,13 +41,9 @@ export function prepareHighDPIContext(context, smooth = true) {
if (smooth) {
context.imageSmoothingEnabled = true;
context.webkitImageSmoothingEnabled = true;
// @ts-ignore
context.imageSmoothingQuality = globalConfig.smoothing.quality;
} else {
context.imageSmoothingEnabled = false;
context.webkitImageSmoothingEnabled = false;
}
}

4
src/js/globals.d.ts vendored
View File

@ -47,10 +47,6 @@ declare interface ImportMeta {
declare interface CanvasRenderingContext2D {
beginRoundedRect(x: number, y: number, w: number, h: number, r: number): void;
beginCircle(x: number, y: number, r: number): void;
msImageSmoothingEnabled: boolean;
mozImageSmoothingEnabled: boolean;
webkitImageSmoothingEnabled: boolean;
}
// Just for compatibility with the shared code