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:
parent
79c4f3b9b0
commit
ed44ff1ebe
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -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: {},
|
||||
|
||||
@ -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
4
src/js/globals.d.ts
vendored
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user