Tina Tarighian
commited on
Commit
·
0a001bd
1
Parent(s):
bba5c78
mobile ratio fixes
Browse files- components/CameraSetup.js +4 -3
- components/MainContent.js +2 -1
- components/ThoughtBubble.js +4 -3
- styles/globals.css +3 -1
components/CameraSetup.js
CHANGED
@@ -35,12 +35,13 @@ const CameraSetup = ({
|
|
35 |
tracks.forEach(track => track.stop());
|
36 |
}
|
37 |
|
38 |
-
// Get camera stream
|
39 |
const stream = await navigator.mediaDevices.getUserMedia({
|
40 |
video: {
|
41 |
facingMode: facingMode,
|
42 |
-
width: { ideal:
|
43 |
-
height: { ideal:
|
|
|
44 |
},
|
45 |
audio: false
|
46 |
});
|
|
|
35 |
tracks.forEach(track => track.stop());
|
36 |
}
|
37 |
|
38 |
+
// Get camera stream with better constraints
|
39 |
const stream = await navigator.mediaDevices.getUserMedia({
|
40 |
video: {
|
41 |
facingMode: facingMode,
|
42 |
+
width: { ideal: 1280 },
|
43 |
+
height: { ideal: 720 },
|
44 |
+
aspectRatio: { ideal: 4/3 } // Add ideal aspect ratio
|
45 |
},
|
46 |
audio: false
|
47 |
});
|
components/MainContent.js
CHANGED
@@ -66,7 +66,8 @@ const MainContent = ({
|
|
66 |
style={{
|
67 |
height: `${canvasHeight}px`,
|
68 |
maxHeight: isMobile ? '70vh' : 'none',
|
69 |
-
objectFit: '
|
|
|
70 |
}}
|
71 |
width={canvasWidth}
|
72 |
height={canvasHeight}
|
|
|
66 |
style={{
|
67 |
height: `${canvasHeight}px`,
|
68 |
maxHeight: isMobile ? '70vh' : 'none',
|
69 |
+
objectFit: 'cover',
|
70 |
+
objectPosition: 'center'
|
71 |
}}
|
72 |
width={canvasWidth}
|
73 |
height={canvasHeight}
|
components/ThoughtBubble.js
CHANGED
@@ -127,13 +127,14 @@ const ThoughtBubble = ({
|
|
127 |
};
|
128 |
}
|
129 |
|
130 |
-
|
|
|
131 |
|
132 |
if (isLeftHand) {
|
133 |
// For left hand, position to the right of thumb
|
134 |
return {
|
135 |
position: 'absolute',
|
136 |
-
top: `${thumbPosition.y - (isMobile ?
|
137 |
left: `${thumbPosition.x + offset}px`,
|
138 |
width: getBubbleWidth(),
|
139 |
maxWidth: isThinking ? 'none' : `${canvasWidth - thumbPosition.x - (offset * 2)}px` // Prevent overflow
|
@@ -142,7 +143,7 @@ const ThoughtBubble = ({
|
|
142 |
// For right hand, position to the left of thumb
|
143 |
return {
|
144 |
position: 'absolute',
|
145 |
-
top: `${thumbPosition.y - (isMobile ?
|
146 |
right: `${canvasWidth - thumbPosition.x + offset}px`,
|
147 |
width: getBubbleWidth(),
|
148 |
maxWidth: isThinking ? 'none' : `${thumbPosition.x - (offset * 2)}px` // Prevent overflow
|
|
|
127 |
};
|
128 |
}
|
129 |
|
130 |
+
// Reduce the offset to position bubble closer to hand
|
131 |
+
const offset = isMobile ? 8 : 12; // Reduced from 12/20
|
132 |
|
133 |
if (isLeftHand) {
|
134 |
// For left hand, position to the right of thumb
|
135 |
return {
|
136 |
position: 'absolute',
|
137 |
+
top: `${thumbPosition.y - (isMobile ? 10 : 15)}px`, // Reduced vertical offset
|
138 |
left: `${thumbPosition.x + offset}px`,
|
139 |
width: getBubbleWidth(),
|
140 |
maxWidth: isThinking ? 'none' : `${canvasWidth - thumbPosition.x - (offset * 2)}px` // Prevent overflow
|
|
|
143 |
// For right hand, position to the left of thumb
|
144 |
return {
|
145 |
position: 'absolute',
|
146 |
+
top: `${thumbPosition.y - (isMobile ? 10 : 15)}px`, // Reduced vertical offset
|
147 |
right: `${canvasWidth - thumbPosition.x + offset}px`,
|
148 |
width: getBubbleWidth(),
|
149 |
maxWidth: isThinking ? 'none' : `${thumbPosition.x - (offset * 2)}px` // Prevent overflow
|
styles/globals.css
CHANGED
@@ -76,13 +76,15 @@ body {
|
|
76 |
width: 100%;
|
77 |
max-width: 100%;
|
78 |
overflow: hidden;
|
|
|
79 |
}
|
80 |
|
81 |
.canvas-container canvas {
|
82 |
display: block;
|
83 |
width: 100%;
|
84 |
height: auto;
|
85 |
-
object-fit: contain
|
|
|
86 |
}
|
87 |
|
88 |
/* Mobile-specific styles */
|
|
|
76 |
width: 100%;
|
77 |
max-width: 100%;
|
78 |
overflow: hidden;
|
79 |
+
border-radius: 12px; /* Add rounded corners */
|
80 |
}
|
81 |
|
82 |
.canvas-container canvas {
|
83 |
display: block;
|
84 |
width: 100%;
|
85 |
height: auto;
|
86 |
+
object-fit: cover; /* Changed from contain to cover */
|
87 |
+
border-radius: 12px; /* Match container */
|
88 |
}
|
89 |
|
90 |
/* Mobile-specific styles */
|