mirror of
https://github.com/ruilisi/fortune-sheet.git
synced 2025-01-07 03:16:50 +08:00
Perform fix, if not globalThis, then Window
This commit is contained in:
parent
ae482085b2
commit
d83324a8ba
@ -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: {},
|
||||
|
@ -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(
|
||||
|
Loading…
Reference in New Issue
Block a user