Nicha1234 commited on
Commit
858df9c
·
verified ·
1 Parent(s): 58990ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -22
app.py CHANGED
@@ -14,37 +14,43 @@ st.set_page_config(layout="wide", page_title="K-Space to MRI")
14
 
15
  st.markdown("""
16
  <style>
17
- /* CSS แก้ปัญหาการสั่นของหน้าจอแบบเด็ดขาด */
18
- /* CSS แก้ปัญหาหน้าเว็บสั่นแบบ Reflow Loop */
19
- /* ล็อกความสูงของรูปภาพทุกรูปป้องกันจอกระตุกจากการโหลดภาพใหม่ */
20
- [data-testid="stImage"] {
21
- min-height: 400px;
22
- display: flex;
23
- align-items: center;
24
- justify-content: center;
25
- }
26
-
27
- html, body, .stApp {
28
- overflow-x: hidden !important;
29
- }
30
- /* Force scrollbar always visible — this is the primary fix for page jitter */
31
  html {
32
  overflow-y: scroll !important;
 
33
  }
34
  body {
35
  overflow-y: scroll !important;
 
 
36
  }
37
- img {
38
- max-width: 100% !important;
39
- height: auto !important;
 
40
  }
41
-
42
- .stApp {
43
- overflow-y: scroll !important;
44
- transition: none !important;
45
  }
46
  .main .block-container {
47
  min-height: 101vh !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
  html, body, [class*="st-"] {
@@ -78,6 +84,18 @@ st.markdown("""
78
  background-color: #1E88E5;
79
  color: white;
80
  }
 
 
 
 
 
 
 
 
 
 
 
 
81
  .reference-text {
82
  font-size: 14px;
83
  color: #666;
@@ -392,7 +410,7 @@ with col_main:
392
 
393
  # Center Text
394
  st.markdown("""
395
- <div style="text-align: center; background-color: #f0f8ff; padding: 15px; border-radius: 10px; margin-bottom: 20px;">
396
  <b>k-space 1 จุด = ข้อมูลของภาพทั้งภาพ และ ภาพ 1 พิกเซล = ผลรวมของ k-space ทุกจุด</b><br><br>
397
  <b>1 จุดใน k-space = แผ่นลวดลายคลื่น 1 แผ่น (2D Sinusoidal Wave)</b>
398
  </div>
 
14
 
15
  st.markdown("""
16
  <style>
17
+ /* === JIGGLE / REFLOW FIX === */
18
+ /* scrollbar-gutter: stable reserves scrollbar space at all times,
19
+ preventing the layout shift that causes page jitter */
 
 
 
 
 
 
 
 
 
 
 
20
  html {
21
  overflow-y: scroll !important;
22
+ scrollbar-gutter: stable !important;
23
  }
24
  body {
25
  overflow-y: scroll !important;
26
+ overflow-x: hidden !important;
27
+ scrollbar-gutter: stable !important;
28
  }
29
+ .stApp {
30
+ overflow-x: hidden !important;
31
+ overflow-y: scroll !important;
32
+ transition: none !important;
33
  }
34
+ /* Prevent any animation/transition that can cause reflow */
35
+ *, *::before, *::after {
36
+ transition: none !important;
37
+ animation-duration: 0.001ms !important;
38
  }
39
  .main .block-container {
40
  min-height: 101vh !important;
41
+ width: 100% !important;
42
+ box-sizing: border-box !important;
43
+ }
44
+ img {
45
+ max-width: 100% !important;
46
+ height: auto !important;
47
+ display: block !important;
48
+ }
49
+ /* Give image containers a stable aspect ratio so layout does not collapse while loading */
50
+ [data-testid="stImage"] > img {
51
+ aspect-ratio: 1 / 1;
52
+ width: 100%;
53
+ height: auto;
54
  }
55
 
56
  html, body, [class*="st-"] {
 
84
  background-color: #1E88E5;
85
  color: white;
86
  }
87
+ /* Info box — force dark text in both light and dark mode */
88
+ .kspace-info-box {
89
+ text-align: center;
90
+ background-color: #dbeafe !important;
91
+ padding: 15px;
92
+ border-radius: 10px;
93
+ margin-bottom: 20px;
94
+ color: #1e3a5f !important;
95
+ }
96
+ .kspace-info-box b, .kspace-info-box strong {
97
+ color: #1e3a5f !important;
98
+ }
99
  .reference-text {
100
  font-size: 14px;
101
  color: #666;
 
410
 
411
  # Center Text
412
  st.markdown("""
413
+ <div class="kspace-info-box">
414
  <b>k-space 1 จุด = ข้อมูลของภาพทั้งภาพ และ ภาพ 1 พิกเซล = ผลรวมของ k-space ทุกจุด</b><br><br>
415
  <b>1 จุดใน k-space = แผ่นลวดลายคลื่น 1 แผ่น (2D Sinusoidal Wave)</b>
416
  </div>