fix: remove viewport-based font size calculation causing jump on mobile
The calculateFontSize() function was overriding the font size on mobile based on viewport width (vw/25), causing the terminal to display at ~15px while the internal state was 8px. When pressing A-, it would jump from 15px to 7px. Now it respects the actual fontSize state consistently. Quality gates: TypeScript check passed, production build successful
This commit is contained in:
@@ -64,11 +64,8 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
|||||||
const isUnmountingRef = useRef(false);
|
const isUnmountingRef = useRef(false);
|
||||||
|
|
||||||
const calculateFontSize = useCallback(() => {
|
const calculateFontSize = useCallback(() => {
|
||||||
if (!isMobile) return fontSize;
|
return fontSize;
|
||||||
const vw = window.innerWidth;
|
}, [fontSize]);
|
||||||
const calculated = Math.max(MIN_FONT_SIZE, Math.min(MAX_FONT_SIZE, vw / 25));
|
|
||||||
return Math.round(calculated);
|
|
||||||
}, [isMobile, fontSize]);
|
|
||||||
|
|
||||||
const connectWebSocket = useCallback(() => {
|
const connectWebSocket = useCallback(() => {
|
||||||
const apiUrl = import.meta.env.VITE_API_BASE_URL || "";
|
const apiUrl = import.meta.env.VITE_API_BASE_URL || "";
|
||||||
|
|||||||
Reference in New Issue
Block a user