Spaces:
Sleeping
Sleeping
Sasha commited on
Commit ·
3cb06eb
1
Parent(s): 6b2bdd0
fix: resolve mobile layout swipe and word cloud scaling
Browse files- client/src/App.jsx +7 -3
- client/src/index.css +9 -0
client/src/App.jsx
CHANGED
|
@@ -1163,10 +1163,12 @@ export default function App() {
|
|
| 1163 |
const placedBoxes = [];
|
| 1164 |
const laidOutWords = [];
|
| 1165 |
|
| 1166 |
-
const
|
|
|
|
| 1167 |
const stretchY = 1.0;
|
| 1168 |
-
const paddingX = 12;
|
| 1169 |
-
const paddingY = 8;
|
|
|
|
| 1170 |
const remToPx = 16;
|
| 1171 |
|
| 1172 |
// Identify center group: words with count within 500 of the max count,
|
|
@@ -1221,6 +1223,8 @@ export default function App() {
|
|
| 1221 |
fontWeight = fontSize > 2.0 ? '700' : (fontSize > 1.4 ? '600' : '500');
|
| 1222 |
}
|
| 1223 |
|
|
|
|
|
|
|
| 1224 |
// Precise width calculation based on custom width factors
|
| 1225 |
const wordWidth = fontSize * getWordWidthFactor(w.word) * remToPx;
|
| 1226 |
const wordHeight = fontSize * 1.1 * remToPx;
|
|
|
|
| 1163 |
const placedBoxes = [];
|
| 1164 |
const laidOutWords = [];
|
| 1165 |
|
| 1166 |
+
const isMobile = typeof window !== 'undefined' && window.innerWidth < 768;
|
| 1167 |
+
const stretchX = isMobile ? 1.4 : 2.8;
|
| 1168 |
const stretchY = 1.0;
|
| 1169 |
+
const paddingX = isMobile ? 6 : 12;
|
| 1170 |
+
const paddingY = isMobile ? 4 : 8;
|
| 1171 |
+
const fontScale = isMobile ? 0.45 : 1.0;
|
| 1172 |
const remToPx = 16;
|
| 1173 |
|
| 1174 |
// Identify center group: words with count within 500 of the max count,
|
|
|
|
| 1223 |
fontWeight = fontSize > 2.0 ? '700' : (fontSize > 1.4 ? '600' : '500');
|
| 1224 |
}
|
| 1225 |
|
| 1226 |
+
fontSize = fontSize * fontScale;
|
| 1227 |
+
|
| 1228 |
// Precise width calculation based on custom width factors
|
| 1229 |
const wordWidth = fontSize * getWordWidthFactor(w.word) * remToPx;
|
| 1230 |
const wordHeight = fontSize * 1.1 * remToPx;
|
client/src/index.css
CHANGED
|
@@ -1130,6 +1130,15 @@ body {
|
|
| 1130 |
justify-content: flex-start;
|
| 1131 |
-webkit-overflow-scrolling: touch;
|
| 1132 |
scrollbar-width: none; /* Firefox */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1133 |
}
|
| 1134 |
|
| 1135 |
.nav-tabs::-webkit-scrollbar {
|
|
|
|
| 1130 |
justify-content: flex-start;
|
| 1131 |
-webkit-overflow-scrolling: touch;
|
| 1132 |
scrollbar-width: none; /* Firefox */
|
| 1133 |
+
flex-wrap: nowrap;
|
| 1134 |
+
}
|
| 1135 |
+
|
| 1136 |
+
.nav-tabs > * {
|
| 1137 |
+
flex-shrink: 0;
|
| 1138 |
+
}
|
| 1139 |
+
|
| 1140 |
+
.tab-content p {
|
| 1141 |
+
padding: 0 0.5rem;
|
| 1142 |
}
|
| 1143 |
|
| 1144 |
.nav-tabs::-webkit-scrollbar {
|