11import { useCallback , useEffect , useState } from "react" ;
2- import { type EmulatorSettings } from "./emulator/emulator-ui" ;
2+ import {
3+ type EmulatorScreenScaling ,
4+ type EmulatorSettings ,
5+ } from "./emulator/emulator-ui" ;
36import {
47 type EmulatorSpeed ,
58 type EmulatorType ,
@@ -65,6 +68,7 @@ export function MacSettings({
6568 const [ storageExportVisible , setStorageExportVisible ] = useState ( false ) ;
6669 const [ storageImportVisible , setStorageImportVisible ] = useState ( false ) ;
6770 const [ saveImageVisible , setSaveImageVisible ] = useState ( false ) ;
71+ const { screenScaling = "auto" } = emulatorSettings ;
6872
6973 return (
7074 < Dialog title = "Settings" onDone = { onDone } appearance = { appearance } >
@@ -122,8 +126,7 @@ export function MacSettings({
122126 event . target . value
123127 ) as EmulatorSpeed ,
124128 } )
125- }
126- >
129+ } >
127130 { Array . from (
128131 EMULATOR_SPEEDS . entries ( ) ,
129132 ( [ speed , label ] ) => (
@@ -139,15 +142,36 @@ export function MacSettings({
139142 </ div >
140143 </ label >
141144 ) }
145+ < div className = "MacSettings-Row" >
146+ < div className = "MacSettings-Row-Label" > Scaling:</ div >
147+ < Select
148+ appearance = { appearance }
149+ value = { screenScaling }
150+ onChange = { e => {
151+ const screenScaling = e . target
152+ . value as EmulatorScreenScaling ;
153+ setEmulatorSettings ( {
154+ ...emulatorSettings ,
155+ screenScaling,
156+ } ) ;
157+ } } >
158+ < option value = "auto" > Auto</ option >
159+ < option value = "smooth" > Smooth</ option >
160+ < option value = "pixelated" > Crisp</ option >
161+ </ Select >
162+ < div className = "Dialog-Description" >
163+ Preferred scaling method when displaying the Mac screen at
164+ non-native sizes.
165+ </ div >
166+ </ div >
142167 { hasSavedHD && (
143168 < >
144169 < h2 > Saved HD</ h2 >
145170 < div className = "MacSettings-Row" >
146171 < div className = "MacSettings-Row-Label" > Contents:</ div >
147172 < Button
148173 appearance = { appearance }
149- onClick = { ( ) => setStorageExportVisible ( true ) }
150- >
174+ onClick = { ( ) => setStorageExportVisible ( true ) } >
151175 Export…
152176 </ Button >
153177 < StorageConfirmDialog
@@ -163,8 +187,7 @@ export function MacSettings({
163187 /> { " " }
164188 < Button
165189 appearance = { appearance }
166- onClick = { ( ) => setStorageImportVisible ( true ) }
167- >
190+ onClick = { ( ) => setStorageImportVisible ( true ) } >
168191 Import…
169192 </ Button >
170193 < StorageConfirmDialog
@@ -180,8 +203,7 @@ export function MacSettings({
180203 /> { " " }
181204 < Button
182205 appearance = { appearance }
183- onClick = { ( ) => setStorageResetVisible ( true ) }
184- >
206+ onClick = { ( ) => setStorageResetVisible ( true ) } >
185207 Reset
186208 </ Button >
187209 < StorageConfirmDialog
@@ -206,8 +228,7 @@ export function MacSettings({
206228 < div className = "MacSettings-Row-Label" />
207229 < Button
208230 appearance = { appearance }
209- onClick = { ( ) => setSaveImageVisible ( true ) }
210- >
231+ onClick = { ( ) => setSaveImageVisible ( true ) } >
211232 Save Disk Image…
212233 </ Button >
213234 < StorageConfirmDialog
@@ -242,8 +263,7 @@ export function MacSettings({
242263 { " " }
243264 < Button
244265 appearance = { appearance }
245- onClick = { handleRequestPersistence }
246- >
266+ onClick = { handleRequestPersistence } >
247267 Request Persistence
248268 </ Button >
249269 </ >
@@ -253,8 +273,7 @@ export function MacSettings({
253273 HD data even when running low on disk space (
254274 < a
255275 href = "https://web.dev/persistent-storage/"
256- target = "_blank"
257- >
276+ target = "_blank" >
258277 more info
259278 </ a >
260279 ).
@@ -299,8 +318,7 @@ function StorageConfirmDialog({
299318 onOther = { onOther }
300319 otherLabel = { otherLabel }
301320 onCancel = { ( ) => setVisible ( false ) }
302- appearance = { appearance }
303- >
321+ appearance = { appearance } >
304322 < div style = { { maxWidth : 400 } } > { body } </ div >
305323 </ Dialog >
306324 ) ;
0 commit comments