Skip to content

Commit 3ab13de

Browse files
authored
Update index.html
1 parent 21c7142 commit 3ab13de

File tree

1 file changed

+70
-27
lines changed

1 file changed

+70
-27
lines changed

index.html

Lines changed: 70 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
background-color: #fff;
1111
margin: 0;
1212
padding: 0;
13+
font-size: 75%;
1314
}
1415
.container {
1516
width: 96vw;
@@ -31,24 +32,24 @@
3132
display: flex;
3233
gap: 20px;
3334
margin-bottom: 30px;
35+
flex-wrap: wrap;
3436
}
35-
.controls-left {
36-
flex: 1 1 380px;
37-
min-width: 320px;
37+
.controls-left,
38+
.controls-right {
39+
flex: 1 1 500px;
40+
min-width: 500px;
3841
display: flex;
3942
flex-direction: column;
43+
}
44+
.controls-left {
4045
gap: 0;
4146
}
4247
.controls-right {
43-
flex: 2 2 440px;
44-
min-width: 340px;
45-
display: flex;
46-
flex-direction: column;
4748
gap: 20px;
4849
}
4950
.control-group {
5051
background-color: #f8f8f8;
51-
padding: 15px;
52+
padding: 8px;
5253
border-radius: 8px;
5354
border: 1px solid #ddd;
5455
}
@@ -61,13 +62,15 @@
6162
.slider-container {
6263
display: flex;
6364
align-items: center;
64-
gap: 10px;
65+
gap: 6px;
66+
flex-wrap: wrap;
67+
min-height: 24px;
6568
}
6669
input[type="range"] {
6770
flex: 1;
68-
height: 6px;
71+
height: 4px;
6972
background: #ddd;
70-
border-radius: 3px;
73+
border-radius: 2px;
7174
outline: none;
7275
-webkit-appearance: none;
7376
}
@@ -88,18 +91,18 @@
8891
border: none;
8992
}
9093
.value-display {
91-
min-width: 50px;
94+
min-width: 40px;
9295
text-align: center;
9396
background-color: white;
94-
padding: 4px 8px;
97+
padding: 1px 4px;
9598
border-radius: 4px;
9699
border: 1px solid #ccc;
97-
font-size: 14px;
100+
font-size: 10px;
98101
}
99102
.density-inputs {
100103
display: flex;
101104
flex-direction: column;
102-
gap: 18px;
105+
gap: 8px;
103106
}
104107
.density-box {
105108
width: 30px;
@@ -112,16 +115,24 @@
112115
vertical-align: middle;
113116
}
114117
.density-input {
115-
display: flex;
118+
display: grid;
119+
grid-template-columns: 72px 1fr auto auto;
116120
align-items: center;
117-
gap: 10px;
121+
gap: 8px;
122+
}
123+
.density-input label {
124+
text-align: right;
125+
}
126+
.density-input input[type="range"] {
127+
min-width: 120px;
118128
}
119129
.density-input input[type="number"] {
120130
width: 60px;
121-
padding: 8px;
131+
padding: 4px;
122132
border: 1px solid #ccc;
123133
border-radius: 4px;
124134
text-align: center;
135+
font-size: 10px;
125136
}
126137
.canvas-container {
127138
text-align: center;
@@ -225,21 +236,21 @@ <h1>USM簡易シミュレーター</h1>
225236
<label>強さ (Amount)</label>
226237
<div class="slider-container">
227238
<input type="range" id="amount" min="0" max="500" value="100" step="1">
228-
<div class="value-display" id="amountValue">100%</div>
239+
<input type="number" class="value-display" id="amountValue" min="0" max="500" value="100">
229240
</div>
230241
</div>
231242
<div class="control-group">
232243
<label>半径 (Radius)</label>
233244
<div class="slider-container">
234245
<input type="range" id="radius" min="0.1" max="5" step="0.1" value="1">
235-
<div class="value-display" id="radiusValue">1.0</div>
246+
<input type="number" class="value-display" id="radiusValue" min="0.1" max="5" step="0.1" value="1.0">
236247
</div>
237248
</div>
238249
<div class="control-group">
239250
<label>閾値 (Threshold)</label>
240251
<div class="slider-container">
241252
<input type="range" id="threshold" min="0" max="50" value="0">
242-
<div class="value-display" id="thresholdValue">0</div>
253+
<input type="number" class="value-display" id="thresholdValue" min="0" max="50" value="0">
243254
</div>
244255
</div>
245256
</div>
@@ -452,9 +463,9 @@ <h1>USM簡易シミュレーター</h1>
452463
// 値を表示
453464
startDensityValue.textContent = startDensity;
454465
endDensityValue.textContent = endDensity;
455-
amountValue.textContent = amount + '%';
456-
radiusValue.textContent = radius.toFixed(1);
457-
thresholdValue.textContent = threshold;
466+
amountValue.value = amount;
467+
radiusValue.value = radius.toFixed(1);
468+
thresholdValue.value = threshold;
458469
// 濃度ボックスの色を更新
459470
startDensityBox.style.background = `rgb(${startDensity},${startDensity},${startDensity})`;
460471
endDensityBox.style.background = `rgb(${endDensity},${endDensity},${endDensity})`;
@@ -585,9 +596,41 @@ <h1>USM簡易シミュレーター</h1>
585596
// 各スライダー等の値変更時にグラフ再描画
586597
startDensityInput.addEventListener('input', drawGraph);
587598
endDensityInput.addEventListener('input', drawGraph);
588-
amountSlider.addEventListener('input', drawGraph);
589-
radiusSlider.addEventListener('input', drawGraph);
590-
thresholdSlider.addEventListener('input', drawGraph);
599+
amountSlider.addEventListener('input', () => {
600+
amountValue.value = amountSlider.value;
601+
drawGraph();
602+
});
603+
radiusSlider.addEventListener('input', () => {
604+
radiusValue.value = radiusSlider.value;
605+
drawGraph();
606+
});
607+
thresholdSlider.addEventListener('input', () => {
608+
thresholdValue.value = thresholdSlider.value;
609+
drawGraph();
610+
});
611+
612+
// input[type="number"]にinputイベント追加
613+
amountValue.addEventListener('input', () => {
614+
let v = Math.max(0, Math.min(500, parseInt(amountValue.value) || 0));
615+
amountValue.value = v;
616+
amountSlider.value = v;
617+
drawGraph();
618+
});
619+
// radiusValueはinputイベントではなくchangeイベントで制御
620+
radiusValue.addEventListener('change', () => {
621+
let v = parseFloat(radiusValue.value);
622+
if (isNaN(v)) return;
623+
v = Math.max(0.1, Math.min(5, v));
624+
radiusValue.value = v;
625+
radiusSlider.value = v;
626+
drawGraph();
627+
});
628+
thresholdValue.addEventListener('input', () => {
629+
let v = Math.max(0, Math.min(50, parseInt(thresholdValue.value) || 0));
630+
thresholdValue.value = v;
631+
thresholdSlider.value = v;
632+
drawGraph();
633+
});
591634

592635
// ウインドウリサイズ時にキャンバスサイズ調整と再描画
593636
window.addEventListener('resize', drawGraph);

0 commit comments

Comments
 (0)