@basic-genomics/hivtrace-viz 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12,9 +12,13 @@
12
12
  <link rel="shortcut icon" href="#" />
13
13
 
14
14
  <style>
15
+ html,
15
16
  body {
17
+ height: 100%;
18
+ width: 100%;
16
19
  margin: 0;
17
20
  padding: 0;
21
+ overflow: hidden;
18
22
  }
19
23
 
20
24
  /* 搜索框固定宽度 */
@@ -297,7 +301,7 @@
297
301
  flex-direction: column;
298
302
  height: 100%;
299
303
  min-height: 500px;
300
- padding: 12px;
304
+ padding: 12px 0 0 0;
301
305
  gap: 12px;
302
306
  }
303
307
 
@@ -312,31 +316,11 @@
312
316
 
313
317
  .hivtrace-pill-row {
314
318
  display: flex;
315
- flex-wrap: nowrap;
316
- gap: 8px;
317
- overflow-x: auto;
319
+ flex-wrap: wrap;
320
+ gap: 4px;
318
321
  padding: 4px 0 8px 0;
319
322
  }
320
323
 
321
- /* Horizontal scrollbar for pill row */
322
- .hivtrace-pill-row::-webkit-scrollbar {
323
- height: 6px;
324
- }
325
-
326
- .hivtrace-pill-row::-webkit-scrollbar-track {
327
- background: #f1f1f1;
328
- border-radius: 3px;
329
- }
330
-
331
- .hivtrace-pill-row::-webkit-scrollbar-thumb {
332
- background: #c1c1c1;
333
- border-radius: 3px;
334
- }
335
-
336
- .hivtrace-pill-row::-webkit-scrollbar-thumb:hover {
337
- background: #a1a1a1;
338
- }
339
-
340
324
  /* 横向 Pill 样式 */
341
325
  .hivtrace-pill {
342
326
  display: inline-flex;
@@ -387,8 +371,6 @@
387
371
  display: flex;
388
372
  flex-direction: column;
389
373
  gap: 12px;
390
- min-height: 0;
391
- overflow: auto;
392
374
  }
393
375
 
394
376
  /* 大屏幕(> 996px):左右布局 */
@@ -397,20 +379,19 @@
397
379
  .hivtrace-attributes-content,
398
380
  .hivtrace-stats-content {
399
381
  flex-direction: row;
382
+ align-items: stretch;
400
383
  }
401
384
  }
402
385
 
403
386
  /* 可视化面板和统计面板 */
404
387
  .hivtrace-viz-panel,
405
388
  .hivtrace-stats-panel {
406
- flex: 1;
407
389
  display: flex;
408
390
  flex-direction: column;
409
391
  background: #f9fafb;
410
392
  border: 1px solid #e5e7eb;
411
393
  border-radius: 8px;
412
394
  padding: 12px;
413
- min-width: 0;
414
395
  }
415
396
 
416
397
  /* 大屏幕(> 996px):图表固定宽度 500px */
@@ -442,6 +423,30 @@
442
423
  justify-content: center;
443
424
  }
444
425
 
426
+ .hivtrace-expand-spacing,
427
+ .hivtrace-compress-spacing,
428
+ .hivtrace-enlarge-window,
429
+ .hivtrace-shrink-window,
430
+ .hivtrace-attributes-color-label {
431
+ border-top-right-radius: 0 !important;
432
+ border-bottom-right-radius: 0 !important;
433
+ }
434
+
435
+ .hivtrace-compress-spacing,
436
+ .hivtrace-shrink-window,
437
+ .hivtrace-enlarge-window,
438
+ .hivtrace-compute-graph-statistics,
439
+ .hivtrace-color-picker-toggle {
440
+ border-top-left-radius: 0 !important;
441
+ border-bottom-left-radius: 0 !important;
442
+ }
443
+
444
+ .set-min-cluster-size,
445
+ .hivtrace-hide-others,
446
+ .hivtrace-color-picker-toggle {
447
+ border-left: none !important;
448
+ }
449
+
445
450
  .hivtrace-viz-wrapper {
446
451
  display: flex;
447
452
  align-items: center;
@@ -668,13 +673,13 @@
668
673
 
669
674
  <!-- Dropdowns to Format Notes By Attributes (Color, Shape, Opacity and Label) -->
670
675
  <div class="input-group-btn">
671
- <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"
672
- data-hivtrace-ui-role="attributes_label">
676
+ <button type="button" class="btn btn-default dropdown-toggle hivtrace-attributes-color-label"
677
+ data-toggle="dropdown" data-hivtrace-ui-role="attributes_label">
673
678
  颜色 <span class="caret"></span>
674
679
  </button>
675
680
  <ul class="dropdown-menu" role="menu" data-hivtrace-ui-role="attributes"></ul>
676
- <button type="button" class="btn btn-default" data-toggle="collapse" href="#colorPickerRow"
677
- title="Select Color Palette">
681
+ <button type="button" class="btn btn-default hivtrace-color-picker-toggle"
682
+ data-toggle="collapse" href="#colorPickerRow" title="Select Color Palette">
678
683
  <i class="fa fa-circle color-picker-toggle" aria-hidden="true"></i>
679
684
  </button>
680
685
  <button type="button" class="btn btn-default" style="display: none"
@@ -716,7 +721,7 @@
716
721
  </span>
717
722
  <input id="filter_input" type="text" class="form-control" placeholder="在属性中搜索文本"
718
723
  data-hivtrace-ui-role="filter" />
719
- <span class="input-group-addon">
724
+ <span class="input-group-addon hivtrace-hide-others">
720
725
  隐藏其他
721
726
  <input type="checkbox" data-hivtrace-ui-role="hide_filter" />
722
727
  </span>
@@ -912,8 +917,92 @@
912
917
 
913
918
  <script src="./hivtrace.js"></script>
914
919
  <!-- <script src="dist/hivtrace.es.js"></script> -->
915
-
916
920
  <script>
921
+ // 动态计算标签页高度
922
+ (function () {
923
+ var debounceTimer = null;
924
+
925
+ function updateTabContentHeight() {
926
+ var tabPane = document.querySelector('.tab-content');
927
+ if (!tabPane) return;
928
+
929
+ // 获取标签页内容区域的顶部位置
930
+ var tabPaneRect = tabPane.getBoundingClientRect();
931
+ var availableHeight = window.innerHeight - tabPaneRect.top;
932
+
933
+ // 设置统计标签页高度
934
+ var statsTab = document.getElementById('trace-attributes');
935
+ if (statsTab) {
936
+ statsTab.style.height = availableHeight + 'px';
937
+ }
938
+
939
+ // 设置网络标签页内 network_tag 高度
940
+ var networkTag = document.querySelector('#trace-results #network_tag');
941
+ if (networkTag) {
942
+ var networkTagRect = networkTag.getBoundingClientRect();
943
+ networkTag.style.height = (window.innerHeight - networkTagRect.top) + 'px';
944
+ }
945
+
946
+ // 设置动态簇视图的 SVG 容器高度
947
+ var clusterContainers = document.querySelectorAll('.hivtrace-network-svg-container');
948
+ clusterContainers.forEach(function (container) {
949
+ var containerRect = container.getBoundingClientRect();
950
+ container.style.height = (window.innerHeight - containerRect.top) + 'px';
951
+ });
952
+ }
953
+
954
+ // 防抖函数:避免频繁调用
955
+ function debouncedUpdate(delay) {
956
+ if (debounceTimer) {
957
+ clearTimeout(debounceTimer);
958
+ }
959
+ debounceTimer = setTimeout(function () {
960
+ requestAnimationFrame(updateTabContentHeight);
961
+ }, delay || 50);
962
+ }
963
+
964
+ // 页面加载和窗口调整时更新高度
965
+ window.addEventListener('load', function () {
966
+ updateTabContentHeight();
967
+ // 延迟再次计算,确保 nav-trace 换行后的布局完成
968
+ setTimeout(updateTabContentHeight, 100);
969
+ });
970
+ window.addEventListener('resize', function () {
971
+ debouncedUpdate(100);
972
+ });
973
+
974
+ // 标签切换时重新计算高度(包括动态创建的标签)
975
+ document.addEventListener('click', function (e) {
976
+ var tab = e.target.closest('#top_level_tab_container a[data-toggle="tab"]');
977
+ if (tab) {
978
+ debouncedUpdate(50);
979
+ }
980
+ });
981
+
982
+ // 监听动态创建的簇视图容器,触发高度计算
983
+ var observer = new MutationObserver(function (mutations) {
984
+ var needsUpdate = mutations.some(function (mutation) {
985
+ return Array.prototype.some.call(mutation.addedNodes, function (node) {
986
+ return node.nodeType === 1 && (
987
+ (node.classList && node.classList.contains('hivtrace-network-svg-container')) ||
988
+ (node.querySelector && node.querySelector('.hivtrace-network-svg-container'))
989
+ );
990
+ });
991
+ });
992
+ if (needsUpdate) {
993
+ debouncedUpdate(50);
994
+ }
995
+ });
996
+
997
+ // 延迟启动观察器,确保 tab-content 已存在
998
+ window.addEventListener('load', function () {
999
+ var tabContent = document.querySelector('.tab-content');
1000
+ if (tabContent) {
1001
+ observer.observe(tabContent, { childList: true, subtree: true });
1002
+ }
1003
+ });
1004
+ })();
1005
+
917
1006
  var network_container = "#network_tag",
918
1007
  network_status_string = "#network_status_string",
919
1008
  network_warning = "#main-warning",
package/dist/hivtrace.css CHANGED
@@ -11950,14 +11950,14 @@ circle.cluster {
11950
11950
  stroke-opacity: 0.3;
11951
11951
  }
11952
11952
 
11953
- /* Network SVG container - only in main network tab */
11953
+ /* Network SVG container - only in main network tab (height set via JS) */
11954
11954
  #trace-results #network_tag {
11955
11955
  margin-top: 15px;
11956
11956
  overflow: scroll;
11957
- height: calc(100vh - 200px);
11958
11957
  position: relative;
11959
11958
  border: 1px solid #e5e7eb;
11960
11959
  border-radius: 6px;
11960
+ box-sizing: border-box;
11961
11961
  }
11962
11962
 
11963
11963
  /* Hide the cloned empty #network_tag in dynamic cluster views */
@@ -11965,14 +11965,14 @@ circle.cluster {
11965
11965
  display: none;
11966
11966
  }
11967
11967
 
11968
- /* SVG container for dynamic cluster views - same style as main network_tag */
11968
+ /* SVG container for dynamic cluster views - same style as main network_tag (height set via JS) */
11969
11969
  .hivtrace-network-svg-container {
11970
11970
  margin-top: 15px;
11971
11971
  overflow: scroll;
11972
- height: calc(100vh - 200px);
11973
11972
  position: relative;
11974
11973
  border: 1px solid #e5e7eb;
11975
11974
  border-radius: 6px;
11975
+ box-sizing: border-box;
11976
11976
  }
11977
11977
 
11978
11978
  /* Force scrollbar visibility on macOS/WebKit browsers */
@@ -12003,10 +12003,9 @@ circle.cluster {
12003
12003
  margin-top: 5px;
12004
12004
  }
12005
12005
 
12006
- /* Statistics tab - scrollable content area without affecting tabs */
12006
+ /* Statistics tab - height set dynamically via JavaScript */
12007
12007
  #trace-attributes {
12008
12008
  overflow-y: auto;
12009
- height: calc(100vh - 120px);
12010
12009
  }
12011
12010
 
12012
12011
  /* Checkbox and label vertical alignment - only for hide_filter addon */
@@ -12016,24 +12015,31 @@ input[data-hivtrace-ui-role="hide_filter"] {
12016
12015
  }
12017
12016
 
12018
12017
  .input-group-sm > .form-control, .input-group-sm > .input-group-addon, .input-group-sm > .input-group-btn > .btn{
12019
- height: 36px !important;
12018
+ height: 33px !important;
12019
+ line-height: normal !important;
12020
12020
  }
12021
12021
 
12022
+
12022
12023
  #network_ui_bar > .input-group-btn {
12023
12024
  padding-bottom: 5px;
12024
- height: 36px !important;
12025
+ height: 33px !important;
12025
12026
  }
12026
12027
 
12027
12028
  #network_ui_bar > .input-group-btn > .btn {
12028
- height: 36px !important;
12029
+ height: 33px !important;
12029
12030
  }
12030
12031
 
12031
12032
  #hivtrace-export-image {
12032
- height: 36px;
12033
+ height: 33px;
12034
+ display: flex;
12035
+ align-items: center;
12036
+ justify-content: center;
12037
+ border-radius: 3px !important;
12038
+ gap: 2px;
12033
12039
  }
12034
12040
 
12035
12041
  input.form-control {
12036
- height: 36px !important;
12042
+ height: 33px !important;
12037
12043
  }
12038
12044
 
12039
12045
  .hivtrace-download-button {
@@ -12495,33 +12501,6 @@ a[data-type="download-button"] i.fa-2x {
12495
12501
  }
12496
12502
 
12497
12503
  /* 下方:统计表格和直方图 - 响应式布局 */
12498
- .hivtrace-stats-content {
12499
- flex: 1;
12500
- display: flex;
12501
- flex-direction: column;
12502
- gap: 16px;
12503
- min-height: 0;
12504
- }
12505
-
12506
- /* 大屏幕(≥996px):左右布局 */
12507
- @media (min-width: 996px) {
12508
- .hivtrace-stats-content {
12509
- flex-direction: row;
12510
- }
12511
- }
12512
-
12513
- /* 统计面板 */
12514
- .hivtrace-stats-panel {
12515
- flex: 1;
12516
- min-width: 0;
12517
- }
12518
-
12519
- /* 直方图面板特殊居中 */
12520
- .hivtrace-stats-panel:last-child {
12521
- display: flex;
12522
- flex-direction: column;
12523
- align-items: center;
12524
- }
12525
12504
 
12526
12505
 
12527
12506
  /* Statistics table styling */