Perform fix, if not globalThis, then Window

This commit is contained in:
Kreijstal 2024-11-25 16:34:17 +00:00
parent ae482085b2
commit d83324a8ba
2 changed files with 2 additions and 2 deletions

View File

@ -227,7 +227,7 @@ export function defaultContext(refs: RefValues): Context {
defaultrowNum: 84,
addDefaultRows: 50,
fullscreenmode: true,
devicePixelRatio: (typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {}).devicePixelRatio,
devicePixelRatio: (typeof globalThis !== 'undefined' ? globalThis : window).devicePixelRatio,
contextMenu: {},
sheetTabContextMenu: {},

View File

@ -30,7 +30,7 @@ const Sheet: React.FC<Props> = ({ sheet }) => {
if (!data) return;
setContext((draftCtx) => {
if (settings.devicePixelRatio === 0) {
draftCtx.devicePixelRatio = (typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {}).devicePixelRatio;
draftCtx.devicePixelRatio = (typeof globalThis !== 'undefined' ? globalThis : window).devicePixelRatio;
}
updateContextWithSheetData(draftCtx, data);
updateContextWithCanvas(