Abddeus commited on
Commit
a8839c0
·
verified ·
1 Parent(s): 7902b6c

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +194 -9
index.html CHANGED
@@ -262,6 +262,105 @@
262
  .pill-deviated { background: rgba(244, 63, 94, 0.15); color: var(--status-red); }
263
  .pill-neutral { background: #1e293b; color: var(--text-muted); }
264
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  /* Toast Notification */
266
  #toast-msg {
267
  position: fixed; bottom: 20px; right: 20px;
@@ -445,32 +544,32 @@
445
  </div>
446
  <button class="btn btn-secondary" id="btn-save-json" title="Save tracing & patient data as .json">
447
  <svg viewBox="0 0 24 24"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>
448
- Save JSON
449
  </button>
450
  <button class="btn btn-secondary" onclick="document.getElementById('json-input').click()" title="Load saved .json tracing">
451
  <svg viewBox="0 0 24 24"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>
452
- Load JSON
453
  </button>
454
  <input type="file" id="json-input" accept=".json,application/json" style="display:none;">
455
  <button class="btn btn-secondary" id="btn-copy-note" title="Copy clinical summary & diagnosis for chart">
456
  <svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
457
- Copy Note
458
  </button>
459
  <button class="btn btn-secondary" id="btn-export-csv" title="Download measurements to Excel CSV">
460
  <svg viewBox="0 0 24 24"><line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/></svg>
461
- CSV
462
  </button>
463
  <button class="btn btn-secondary" onclick="window.print()" title="Print 1-Page ABO Report">
464
  <svg viewBox="0 0 24 24"><polyline points="6 9 6 2 18 2 18 9"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>
465
- Print
466
  </button>
467
  <button class="btn btn-secondary" id="btn-lock-suite" title="Lock workspace">
468
  <svg viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
469
- Lock
470
  </button>
471
  <button class="btn btn-danger" id="btn-next-patient" title="Clear current patient">
472
  <svg viewBox="0 0 24 24"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>
473
- Next Patient
474
  </button>
475
  </div>
476
  </header>
@@ -797,6 +896,22 @@
797
  </div>
798
  </div>
799
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
800
  <!-- Security Gate Modal (Pre-locked; Only editable by you in this code) -->
801
  <div id="security-gate" style="position:fixed; inset:0; z-index:9999; background:rgba(3,7,18,0.96); backdrop-filter:blur(10px); display:none; align-items:center; justify-content:center;">
802
  <div style="background:#1e293b; border:1px solid #334155; border-radius:12px; padding:24px; width:310px; display:flex; flex-direction:column; gap:12px; text-align:center; box-shadow:0 20px 40px rgba(0,0,0,0.6);">
@@ -955,6 +1070,20 @@ const loupeBox = document.getElementById("loupe-box");
955
  const loupeCanvas = document.getElementById("loupe-canvas");
956
  const loupeLabel = document.getElementById("loupe-label");
957
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
958
  document.getElementById("pt-date").valueAsDate = new Date();
959
  updateSectionVisibility();
960
  buildNormsEditor();
@@ -1261,6 +1390,7 @@ function setupImage(srcUrl, shouldRunAi = true) {
1261
  svgElem.setAttribute("viewBox", `0 0 ${imgElem.naturalWidth} ${imgElem.naturalHeight}`);
1262
  svgElem.setAttribute("width", imgElem.clientWidth);
1263
  svgElem.setAttribute("height", imgElem.clientHeight);
 
1264
  if (shouldRunAi && session) runAutoTrace();
1265
  else renderAnalysis();
1266
  };
@@ -1512,11 +1642,50 @@ calBtn.addEventListener("click", () => {
1512
 
1513
  function getSVGCoords(e) {
1514
  const pt = svgElem.createSVGPoint();
1515
- pt.x = e.clientX;
1516
- pt.y = e.clientY;
1517
  return pt.matrixTransform(svgElem.getScreenCTM().inverse());
1518
  }
1519
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1520
  function updateLoupe(pt, name) {
1521
  if (!imgElem.src) return;
1522
  loupeBox.style.display = "block";
@@ -1809,6 +1978,12 @@ function renderAnalysis() {
1809
  draggingLm = rKey;
1810
  c.classList.add("dragging");
1811
  });
 
 
 
 
 
 
1812
  g.appendChild(c);
1813
 
1814
  const t = document.createElementNS("http://www.w3.org/2000/svg", "text");
@@ -1853,6 +2028,16 @@ function renderAnalysis() {
1853
  updateLoupe(pt, name);
1854
  });
1855
 
 
 
 
 
 
 
 
 
 
 
1856
  c.addEventListener("dblclick", (e) => {
1857
  e.stopPropagation();
1858
  if (initialAiCoords[name]) {
 
262
  .pill-deviated { background: rgba(244, 63, 94, 0.15); color: var(--status-red); }
263
  .pill-neutral { background: #1e293b; color: var(--text-muted); }
264
 
265
+ /* Mobile Navigation & Responsive Overrides */
266
+ .mobile-nav-bar {
267
+ display: none;
268
+ height: 52px;
269
+ background: var(--surface-dark);
270
+ border-top: 1px solid var(--surface-border);
271
+ position: fixed;
272
+ bottom: 0; left: 0; right: 0;
273
+ z-index: 40;
274
+ grid-template-columns: repeat(3, 1fr);
275
+ }
276
+ .mobile-tab-btn {
277
+ background: none;
278
+ border: none;
279
+ color: var(--text-muted);
280
+ display: flex;
281
+ flex-direction: column;
282
+ align-items: center;
283
+ justify-content: center;
284
+ gap: 3px;
285
+ font-size: 10px;
286
+ font-weight: 600;
287
+ cursor: pointer;
288
+ padding: 4px;
289
+ transition: color 0.15s ease;
290
+ }
291
+ .mobile-tab-btn svg { width: 18px; height: 18px; fill: currentColor; }
292
+ .mobile-tab-btn.active { color: #38bdf8; background: rgba(56, 189, 248, 0.08); }
293
+
294
+ @media (max-width: 1023px) {
295
+ body {
296
+ height: 100dvh;
297
+ }
298
+ header {
299
+ padding: 0 10px;
300
+ height: 52px;
301
+ }
302
+ .brand-subtitle { display: none; }
303
+ .header-actions { gap: 4px; }
304
+ .header-actions .btn {
305
+ padding: 6px 8px;
306
+ }
307
+ .header-actions .btn .btn-text {
308
+ display: none;
309
+ }
310
+ #status-badge {
311
+ padding: 4px 8px;
312
+ font-size: 10px;
313
+ }
314
+ #status-txt { display: none; }
315
+
316
+ .workspace {
317
+ height: calc(100dvh - 52px - 52px);
318
+ flex-direction: column;
319
+ position: relative;
320
+ }
321
+
322
+ .mobile-nav-bar {
323
+ display: grid;
324
+ }
325
+
326
+ /* Single active view on phones/tablets */
327
+ .sidebar, .viewport, .analysis-panel {
328
+ width: 100% !important;
329
+ height: 100% !important;
330
+ border: none !important;
331
+ flex: 1;
332
+ }
333
+
334
+ body.tab-tools .sidebar { display: flex !important; }
335
+ body.tab-tools .viewport { display: none !important; }
336
+ body.tab-tools .analysis-panel { display: none !important; }
337
+
338
+ body.tab-viewport .sidebar { display: none !important; }
339
+ body.tab-viewport .viewport { display: flex !important; }
340
+ body.tab-viewport .analysis-panel { display: none !important; }
341
+
342
+ body.tab-analysis .sidebar { display: none !important; }
343
+ body.tab-analysis .viewport { display: none !important; }
344
+ body.tab-analysis .analysis-panel { display: flex !important; }
345
+
346
+ #loupe-box {
347
+ top: 10px; left: auto; right: 10px;
348
+ width: 110px; height: 110px;
349
+ }
350
+
351
+ .viewport-overlay-controls {
352
+ bottom: 8px;
353
+ padding: 3px 10px;
354
+ }
355
+ .viewport-overlay-controls .shortcut-hint {
356
+ display: none;
357
+ }
358
+
359
+ #overlay-svg {
360
+ touch-action: none;
361
+ }
362
+ }
363
+
364
  /* Toast Notification */
365
  #toast-msg {
366
  position: fixed; bottom: 20px; right: 20px;
 
544
  </div>
545
  <button class="btn btn-secondary" id="btn-save-json" title="Save tracing & patient data as .json">
546
  <svg viewBox="0 0 24 24"><path d="M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"/><polyline points="17 21 17 13 7 13 7 21"/><polyline points="7 3 7 8 15 8"/></svg>
547
+ <span class="btn-text">Save JSON</span>
548
  </button>
549
  <button class="btn btn-secondary" onclick="document.getElementById('json-input').click()" title="Load saved .json tracing">
550
  <svg viewBox="0 0 24 24"><path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/></svg>
551
+ <span class="btn-text">Load JSON</span>
552
  </button>
553
  <input type="file" id="json-input" accept=".json,application/json" style="display:none;">
554
  <button class="btn btn-secondary" id="btn-copy-note" title="Copy clinical summary & diagnosis for chart">
555
  <svg viewBox="0 0 24 24"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>
556
+ <span class="btn-text">Copy Note</span>
557
  </button>
558
  <button class="btn btn-secondary" id="btn-export-csv" title="Download measurements to Excel CSV">
559
  <svg viewBox="0 0 24 24"><line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/></svg>
560
+ <span class="btn-text">CSV</span>
561
  </button>
562
  <button class="btn btn-secondary" onclick="window.print()" title="Print 1-Page ABO Report">
563
  <svg viewBox="0 0 24 24"><polyline points="6 9 6 2 18 2 18 9"/><path d="M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"/><rect x="6" y="14" width="12" height="8"/></svg>
564
+ <span class="btn-text">Print</span>
565
  </button>
566
  <button class="btn btn-secondary" id="btn-lock-suite" title="Lock workspace">
567
  <svg viewBox="0 0 24 24"><rect x="3" y="11" width="18" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
568
+ <span class="btn-text">Lock</span>
569
  </button>
570
  <button class="btn btn-danger" id="btn-next-patient" title="Clear current patient">
571
  <svg viewBox="0 0 24 24"><polyline points="23 4 23 10 17 10"/><path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/></svg>
572
+ <span class="btn-text">Next</span>
573
  </button>
574
  </div>
575
  </header>
 
896
  </div>
897
  </div>
898
 
899
+ <!-- Mobile View Navigation Bar (Shown on small screens) -->
900
+ <nav class="mobile-nav-bar" id="mobile-nav">
901
+ <button class="mobile-tab-btn active" data-tab="tools">
902
+ <svg viewBox="0 0 24 24"><path d="M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"/></svg>
903
+ <span>Controls</span>
904
+ </button>
905
+ <button class="mobile-tab-btn" data-tab="viewport">
906
+ <svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><circle cx="12" cy="12" r="3"/><line x1="12" y1="2" x2="12" y2="6"/><line x1="12" y1="18" x2="12" y2="22"/><line x1="2" y1="12" x2="6" y2="12"/><line x1="18" y1="12" x2="22" y2="12"/></svg>
907
+ <span>Tracing</span>
908
+ </button>
909
+ <button class="mobile-tab-btn" data-tab="analysis">
910
+ <svg viewBox="0 0 24 24"><path d="M3 3v18h18"/><path d="m19 9-5 5-4-4-3 3"/></svg>
911
+ <span>Results</span>
912
+ </button>
913
+ </nav>
914
+
915
  <!-- Security Gate Modal (Pre-locked; Only editable by you in this code) -->
916
  <div id="security-gate" style="position:fixed; inset:0; z-index:9999; background:rgba(3,7,18,0.96); backdrop-filter:blur(10px); display:none; align-items:center; justify-content:center;">
917
  <div style="background:#1e293b; border:1px solid #334155; border-radius:12px; padding:24px; width:310px; display:flex; flex-direction:column; gap:12px; text-align:center; box-shadow:0 20px 40px rgba(0,0,0,0.6);">
 
1070
  const loupeCanvas = document.getElementById("loupe-canvas");
1071
  const loupeLabel = document.getElementById("loupe-label");
1072
 
1073
+ // Mobile View Tab Controller
1074
+ function setMobileTab(tabName) {
1075
+ document.body.classList.remove("tab-tools", "tab-viewport", "tab-analysis");
1076
+ document.body.classList.add(`tab-${tabName}`);
1077
+ document.querySelectorAll(".mobile-tab-btn").forEach(btn => {
1078
+ btn.classList.toggle("active", btn.getAttribute("data-tab") === tabName);
1079
+ });
1080
+ }
1081
+ document.querySelectorAll(".mobile-tab-btn").forEach(btn => {
1082
+ btn.addEventListener("click", () => setMobileTab(btn.getAttribute("data-tab")));
1083
+ });
1084
+ // Default to tools on mobile until image is loaded
1085
+ setMobileTab("tools");
1086
+
1087
  document.getElementById("pt-date").valueAsDate = new Date();
1088
  updateSectionVisibility();
1089
  buildNormsEditor();
 
1390
  svgElem.setAttribute("viewBox", `0 0 ${imgElem.naturalWidth} ${imgElem.naturalHeight}`);
1391
  svgElem.setAttribute("width", imgElem.clientWidth);
1392
  svgElem.setAttribute("height", imgElem.clientHeight);
1393
+ setMobileTab("viewport"); // Switch to tracing tab automatically on mobile
1394
  if (shouldRunAi && session) runAutoTrace();
1395
  else renderAnalysis();
1396
  };
 
1642
 
1643
  function getSVGCoords(e) {
1644
  const pt = svgElem.createSVGPoint();
1645
+ pt.x = e.clientX !== undefined ? e.clientX : (e.touches && e.touches[0] ? e.touches[0].clientX : 0);
1646
+ pt.y = e.clientY !== undefined ? e.clientY : (e.touches && e.touches[0] ? e.touches[0].clientY : 0);
1647
  return pt.matrixTransform(svgElem.getScreenCTM().inverse());
1648
  }
1649
 
1650
+ function handleDragMove(clientX, clientY) {
1651
+ if (!draggingLm || !coords[draggingLm]) return;
1652
+ const p = getSVGCoords({ clientX, clientY });
1653
+ coords[draggingLm].x = p.x;
1654
+ coords[draggingLm].y = p.y;
1655
+
1656
+ if ((draggingLm === "RULER_1" || draggingLm === "RULER_2") && coords.RULER_1 && coords.RULER_2) {
1657
+ const dist = Math.hypot(coords.RULER_2.x - coords.RULER_1.x, coords.RULER_2.y - coords.RULER_1.y);
1658
+ if (dist > 1) {
1659
+ pxPerMm = dist / 10.0;
1660
+ calStatus.innerText = `Scale: ${pxPerMm.toFixed(2)} px/mm (Calibrated)`;
1661
+ }
1662
+ }
1663
+
1664
+ updateLoupe(p, draggingLm);
1665
+ renderAnalysis();
1666
+ }
1667
+
1668
+ function handleDragEnd() {
1669
+ if (draggingLm) {
1670
+ draggingLm = null;
1671
+ loupeBox.style.display = "none";
1672
+ document.querySelectorAll(".landmark-handle").forEach(el => el.classList.remove("dragging"));
1673
+ }
1674
+ }
1675
+
1676
+ window.addEventListener("mousemove", (e) => {
1677
+ handleDragMove(e.clientX, e.clientY);
1678
+ });
1679
+ window.addEventListener("mouseup", handleDragEnd);
1680
+
1681
+ window.addEventListener("touchmove", (e) => {
1682
+ if (draggingLm && e.touches.length === 1) {
1683
+ e.preventDefault();
1684
+ handleDragMove(e.touches[0].clientX, e.touches[0].clientY);
1685
+ }
1686
+ }, { passive: false });
1687
+ window.addEventListener("touchend", handleDragEnd);
1688
+
1689
  function updateLoupe(pt, name) {
1690
  if (!imgElem.src) return;
1691
  loupeBox.style.display = "block";
 
1978
  draggingLm = rKey;
1979
  c.classList.add("dragging");
1980
  });
1981
+ c.addEventListener("touchstart", (e) => {
1982
+ e.stopPropagation();
1983
+ e.preventDefault();
1984
+ draggingLm = rKey;
1985
+ c.classList.add("dragging");
1986
+ }, { passive: false });
1987
  g.appendChild(c);
1988
 
1989
  const t = document.createElementNS("http://www.w3.org/2000/svg", "text");
 
2028
  updateLoupe(pt, name);
2029
  });
2030
 
2031
+ c.addEventListener("touchstart", (e) => {
2032
+ e.stopPropagation();
2033
+ e.preventDefault();
2034
+ draggingLm = name;
2035
+ selectedLm = name;
2036
+ document.getElementById("selected-lm-label").innerText = name;
2037
+ c.classList.add("dragging");
2038
+ updateLoupe(pt, name);
2039
+ }, { passive: false });
2040
+
2041
  c.addEventListener("dblclick", (e) => {
2042
  e.stopPropagation();
2043
  if (initialAiCoords[name]) {