Skip to content

Commit 65473b7

Browse files
committed
fix: scale unavailable with no rotation
1 parent 0dd7397 commit 65473b7

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

browser/src/App.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ const App = () => {
186186
id="video"
187187
className={clsx(videoRotate === 0 ? [videoStyle, "min-h-[480px] min-w-[640px]"] : "hidden")}
188188
ref={videoRef}
189+
style={{
190+
transform: `scale(${videoScale})`,
191+
}}
189192
autoPlay
190193
playsInline
191194
onLoadedMetadata={setCanvas}

desktop/src/renderer/src/App.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ const App = (): ReactElement => {
3030
const { t } = useTranslation()
3131
const isBigScreen = useMediaQuery({ minWidth: 850 })
3232

33-
const videoScale = useAtomValue(videoScaleAtom)
3433
const [videoRotate, setVideoRotate] = useAtom(videoRotateAtom)
34+
const [videoScale, setVideoScale] = useAtom(videoScaleAtom)
3535
const videoState = useAtomValue(videoStateAtom)
3636
const serialPortState = useAtomValue(serialPortStateAtom)
3737
const mouseStyle = useAtomValue(mouseStyleAtom)
@@ -112,18 +112,23 @@ const App = (): ReactElement => {
112112
}, [videoRotate])
113113

114114
useEffect(() => {
115-
const rotate = storage.getVideoRotate()
116-
if (rotate) {
117-
setVideoRotate(rotate)
118-
}
119-
120115
const resolution = storage.getVideoResolution()
121116
if (resolution) {
122117
setResolution(resolution)
123118
}
124119

125120
requestMediaPermissions(resolution)
126121

122+
const rotate = storage.getVideoRotate()
123+
if (rotate) {
124+
setVideoRotate(rotate)
125+
}
126+
127+
const scale = storage.getVideoScale()
128+
if (scale) {
129+
setVideoScale(scale)
130+
}
131+
127132
return (): void => {
128133
camera.close()
129134
window.electron.ipcRenderer.invoke(IpcEvents.CLOSE_SERIAL_PORT)
@@ -199,6 +204,9 @@ const App = (): ReactElement => {
199204
id="video"
200205
className={clsx(videoRotate === 0 ? [videoStyle, 'min-h-[480px] min-w-[640px]'] : 'hidden')}
201206
ref={videoRef}
207+
style={{
208+
transform: `scale(${videoScale})`
209+
}}
202210
autoPlay
203211
playsInline
204212
onLoadedMetadata={setCanvas}

0 commit comments

Comments
 (0)