mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
Add a slight timeout to update the fontSmoothing pref (#407)
This seems like a bug with chrome/electron where the devicePixelRatio value doesn't update right away. It's probably in the event loop, so adding a short timeout should solve this problem.
This commit is contained in:
parent
063045a829
commit
7e889dd509
1 changed files with 11 additions and 7 deletions
|
|
@ -60,14 +60,18 @@ export function resetFontSize () {
|
|||
}
|
||||
|
||||
export function setFontSmoothing () {
|
||||
const devicePixelRatio = window.devicePixelRatio;
|
||||
const fontSmoothing = devicePixelRatio < 2
|
||||
? 'subpixel-antialiased'
|
||||
: 'antialiased';
|
||||
return (dispatch) => {
|
||||
setTimeout(() => {
|
||||
const devicePixelRatio = window.devicePixelRatio;
|
||||
const fontSmoothing = devicePixelRatio < 2
|
||||
? 'subpixel-antialiased'
|
||||
: 'antialiased';
|
||||
|
||||
return {
|
||||
type: UI_FONT_SMOOTHING_SET,
|
||||
fontSmoothing
|
||||
dispatch({
|
||||
type: UI_FONT_SMOOTHING_SET,
|
||||
fontSmoothing
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue