rorshi commited on
Commit
f539571
·
1 Parent(s): 09e5b85

대시보드 안정화 작업중

Browse files
npc_social_network/templates/dashboard.html CHANGED
@@ -9,12 +9,12 @@
9
  /* 기본 스타일 및 변수 */
10
  :root { --bg-color: #f0f2f5; --panel-bg-color: #ffffff; --border-color: #2c3e50; --border-color: #dee2e6; --shadow: 0 4px 6px rgba(0,0,0,0.05); --primary-color: #007bff; --success-color: #28a745; --info-color: #17a2b8; --secondary-color: #6c757d; }
11
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; display: flex; height: 100vh; margin: 0; background-color: var(--bg-color); }
12
- #main-container { display: flex; flex: 1; padding: 15px; gap: 15px; }
13
- #network-panel { flex: 3; display: flex; flex-direction: column; background: var(--panel-bg-color); border-radius: 12px; box-shadow: var(--shadow); }
14
- #network { width: 100%; flex: 1; border-bottom: 1px solid var(--border-color); }
15
 
16
  /* 전체 컨트롤 패널 (가장 바깥쪽) */
17
- #controls { padding: 15px; display: flex; flex-direction: column; gap: 15px; background-color: #3e3f41; border-radius: 0 0 12px 12px;}
18
 
19
  /* 메인 컨트롤 버튼 */
20
  #main-controls { display: flex; gap: 10px; justify-content: flex-start;}
@@ -57,6 +57,7 @@
57
  <button id="play-pause-btn">Play / Pause</button>
58
  <button id="tick-btn">Next Tick</button>
59
  <button id="refresh-btn">⟳ 새로고침</button>
 
60
  </div>
61
  <!-- 개입 기능 선택 -->
62
  <div id="intervention-area" style="display: flex; gap: 15px; align-items: flex-start;">
@@ -118,6 +119,7 @@
118
  const playPauseBtn = document.getElementById('play-pause-btn');
119
  const tickBtn = document.getElementById('tick-btn');
120
  const refreshBtn = document.getElementById('refresh-btn');
 
121
  // 개입 기능 선택
122
  const tabEvent = document.getElementById('tab-event');
123
  const tabRelation = document.getElementById('tab-relation');
@@ -146,12 +148,18 @@
146
  let autoUpdateInterval = null;
147
 
148
  const options = {
149
- physics: { stabilization: false, solver: 'forceAtlas2Based', forceAtlas2Based: { gravitationalConstant: -80, springLength: 150, springConstant: 0.08 } },
150
- nodes: { borderWidth: 2, size: 30, font: { size: 14, color: '#333' } },
151
- edges: { font: { align: 'middle', size: 11, strokeWidth: 3, strokeColor: 'white' }, smooth: { type: 'cubicBezier' } },
152
- interaction: { hover: true }
153
  };
154
 
 
 
 
 
 
 
155
  // 탭 버튼 클릭 이벤트
156
  tabEvent.addEventListener('click', () =>{
157
  tabEvent.classList.add('active');
@@ -212,7 +220,7 @@
212
  // --- [수정된 부분 시작] ---
213
  // 물리 시뮬레이션이 안정화되면 물리 효과를 비활성화하여 노드 움직임을 멈춥니다.
214
  network.on("stabilizationIterationsDone", function () {
215
- network.setOptions( { physics: false } );
216
  });
217
  }
218
 
 
9
  /* 기본 스타일 및 변수 */
10
  :root { --bg-color: #f0f2f5; --panel-bg-color: #ffffff; --border-color: #2c3e50; --border-color: #dee2e6; --shadow: 0 4px 6px rgba(0,0,0,0.05); --primary-color: #007bff; --success-color: #28a745; --info-color: #17a2b8; --secondary-color: #6c757d; }
11
  body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; display: flex; height: 100vh; margin: 0; background-color: var(--bg-color); }
12
+ #main-container { display: flex; flex: 1; padding: 15px; gap: 15px; min-height: 0;}
13
+ #network-panel { flex: 3; display: flex; flex-direction: column; background: var(--panel-bg-color); border-radius: 12px; box-shadow: var(--shadow); min-width: 0; }
14
+ #network { width: 100%; flex: 1; border-bottom: 1px solid var(--border-color); min-height: 0; }
15
 
16
  /* 전체 컨트롤 패널 (가장 바깥쪽) */
17
+ #controls { flex-shrink: 0; padding: 12px; display: flex; flex-direction: column; gap: 15px; background-color: #3e3f41; border-radius: 0 0 12px 12px;}
18
 
19
  /* 메인 컨트롤 버튼 */
20
  #main-controls { display: flex; gap: 10px; justify-content: flex-start;}
 
57
  <button id="play-pause-btn">Play / Pause</button>
58
  <button id="tick-btn">Next Tick</button>
59
  <button id="refresh-btn">⟳ 새로고침</button>
60
+ <button id="fit-btn">관계도 보기</button>
61
  </div>
62
  <!-- 개입 기능 선택 -->
63
  <div id="intervention-area" style="display: flex; gap: 15px; align-items: flex-start;">
 
119
  const playPauseBtn = document.getElementById('play-pause-btn');
120
  const tickBtn = document.getElementById('tick-btn');
121
  const refreshBtn = document.getElementById('refresh-btn');
122
+ const fitBtn = document.getElementById('fit-btn')
123
  // 개입 기능 선택
124
  const tabEvent = document.getElementById('tab-event');
125
  const tabRelation = document.getElementById('tab-relation');
 
148
  let autoUpdateInterval = null;
149
 
150
  const options = {
151
+ physics: { stabilization: {iterations: 1000}, solver: 'forceAtlas2Based', forceAtlas2Based: { gravitationalConstant: -80, springLength: 150, springConstant: 0.08 } },
152
+ nodes: { borderWidth: 2, shape: 'circularImage', size: 30, font: { size: 14, color: '#333' } },
153
+ edges: { width: 2, font: { align: 'top', size: 11, strokeWidth: 3, strokeColor: 'white' }, smooth: { type: 'cubicBezier' } },
154
+ interaction: { hover: true, zoomView: true, dragView: true, minZoom: 0.2, maxZoom: 4.0 }
155
  };
156
 
157
+ fitBtn.addEventListener('click', () => {
158
+ if (network) {
159
+ network.fit();
160
+ }
161
+ });
162
+
163
  // 탭 버튼 클릭 이벤트
164
  tabEvent.addEventListener('click', () =>{
165
  tabEvent.classList.add('active');
 
220
  // --- [수정된 부분 시작] ---
221
  // 물리 시뮬레이션이 안정화되면 물리 효과를 비활성화하여 노드 움직임을 멈춥니다.
222
  network.on("stabilizationIterationsDone", function () {
223
+ network.setOptions({ physics: false, interaction: { hover: true, zoomView: true, dragView: true, minZoom: 0.5, maxZoom: 2.0 }});
224
  });
225
  }
226