@jbrowse/plugin-linear-genome-view 3.6.5 → 4.0.0

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.
Files changed (392) hide show
  1. package/esm/BaseLinearDisplay/SVGLegend.d.ts +6 -0
  2. package/esm/BaseLinearDisplay/SVGLegend.js +17 -0
  3. package/esm/BaseLinearDisplay/calculateSvgLegendWidth.d.ts +2 -0
  4. package/esm/BaseLinearDisplay/calculateSvgLegendWidth.js +11 -0
  5. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +3 -3
  6. package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +13 -24
  7. package/esm/BaseLinearDisplay/components/Block.js +2 -2
  8. package/esm/BaseLinearDisplay/components/BlockErrorMessage.js +2 -2
  9. package/esm/BaseLinearDisplay/components/BlockMsg.js +11 -2
  10. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/CollapseIntronsDialog.d.ts +9 -0
  11. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/CollapseIntronsDialog.js +42 -0
  12. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/TranscriptTable.d.ts +11 -0
  13. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/TranscriptTable.js +40 -0
  14. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/util.d.ts +19 -0
  15. package/esm/BaseLinearDisplay/components/CollapseIntronsDialog/util.js +45 -0
  16. package/esm/BaseLinearDisplay/components/FloatingLabels.d.ts +5 -0
  17. package/esm/BaseLinearDisplay/components/FloatingLabels.js +89 -0
  18. package/esm/BaseLinearDisplay/components/FloatingLegend.d.ts +8 -0
  19. package/esm/BaseLinearDisplay/components/FloatingLegend.js +43 -0
  20. package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +1 -5
  21. package/esm/BaseLinearDisplay/components/LinearBlocks.js +5 -42
  22. package/esm/BaseLinearDisplay/components/LoadingOverlay.d.ts +4 -0
  23. package/esm/BaseLinearDisplay/components/LoadingOverlay.js +49 -0
  24. package/esm/BaseLinearDisplay/components/MaxHeightReachedIndicator.d.ts +4 -0
  25. package/esm/BaseLinearDisplay/components/MaxHeightReachedIndicator.js +26 -0
  26. package/esm/BaseLinearDisplay/components/MenuPage.d.ts +8 -0
  27. package/esm/BaseLinearDisplay/components/MenuPage.js +24 -0
  28. package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.d.ts +19 -0
  29. package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.js +48 -0
  30. package/esm/BaseLinearDisplay/components/RenderedBlocks.d.ts +12 -0
  31. package/esm/BaseLinearDisplay/components/RenderedBlocks.js +22 -0
  32. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +4 -4
  33. package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +5 -8
  34. package/esm/BaseLinearDisplay/components/TooLargeMessage.js +3 -3
  35. package/esm/BaseLinearDisplay/components/Tooltip.d.ts +2 -0
  36. package/esm/BaseLinearDisplay/components/Tooltip.js +10 -7
  37. package/esm/BaseLinearDisplay/components/types.d.ts +1 -0
  38. package/esm/BaseLinearDisplay/components/types.js +1 -0
  39. package/esm/BaseLinearDisplay/components/util.d.ts +21 -0
  40. package/esm/BaseLinearDisplay/components/util.js +116 -0
  41. package/esm/BaseLinearDisplay/index.d.ts +17 -8
  42. package/esm/BaseLinearDisplay/index.js +13 -6
  43. package/esm/BaseLinearDisplay/model.d.ts +1177 -0
  44. package/esm/BaseLinearDisplay/model.js +424 -0
  45. package/esm/BaseLinearDisplay/models/FeatureDensityMixin.d.ts +5 -5
  46. package/esm/BaseLinearDisplay/models/FeatureDensityMixin.js +11 -14
  47. package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.d.ts +21 -0
  48. package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.js +46 -0
  49. package/esm/BaseLinearDisplay/models/TrackHeightMixin.d.ts +3 -3
  50. package/esm/BaseLinearDisplay/models/TrackHeightMixin.js +2 -3
  51. package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.d.ts +1 -1
  52. package/esm/BaseLinearDisplay/models/autorunFeatureDensityStats.js +2 -3
  53. package/esm/BaseLinearDisplay/models/calculateLabelPositions.d.ts +24 -0
  54. package/esm/BaseLinearDisplay/models/calculateLabelPositions.js +60 -0
  55. package/esm/BaseLinearDisplay/models/configSchema.d.ts +2 -2
  56. package/esm/BaseLinearDisplay/models/configSchema.js +3 -3
  57. package/esm/BaseLinearDisplay/models/renderSvg.d.ts +3 -7
  58. package/esm/BaseLinearDisplay/models/renderSvg.js +22 -11
  59. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +37 -19
  60. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +151 -135
  61. package/esm/BaseLinearDisplay/models/util.d.ts +4 -4
  62. package/esm/BaseLinearDisplay/models/util.js +16 -13
  63. package/esm/BaseLinearDisplay/renderSvg.d.ts +3 -0
  64. package/esm/BaseLinearDisplay/renderSvg.js +59 -0
  65. package/esm/BaseLinearDisplay/types.d.ts +47 -0
  66. package/esm/BaseLinearDisplay/types.js +3 -0
  67. package/esm/BaseLinearDisplay/util.d.ts +15 -0
  68. package/esm/BaseLinearDisplay/util.js +61 -0
  69. package/esm/BasicTrack/configSchema.d.ts +16 -11
  70. package/esm/BasicTrack/index.js +1 -1
  71. package/esm/FeatureTrack/configSchema.d.ts +16 -11
  72. package/esm/FeatureTrack/index.js +1 -1
  73. package/esm/LaunchLinearGenomeView/index.js +12 -62
  74. package/esm/LinearBareDisplay/configSchema.d.ts +4 -4
  75. package/esm/LinearBareDisplay/configSchema.js +1 -1
  76. package/esm/LinearBareDisplay/index.d.ts +2 -2
  77. package/esm/LinearBareDisplay/index.js +5 -5
  78. package/esm/LinearBareDisplay/model.d.ts +959 -92
  79. package/esm/LinearBareDisplay/model.js +3 -6
  80. package/esm/LinearBasicDisplay/components/LinearBasicDisplayComponent.d.ts +5 -0
  81. package/esm/LinearBasicDisplay/components/LinearBasicDisplayComponent.js +9 -0
  82. package/esm/LinearBasicDisplay/configSchema.d.ts +4 -4
  83. package/esm/LinearBasicDisplay/configSchema.js +1 -1
  84. package/esm/LinearBasicDisplay/index.d.ts +2 -2
  85. package/esm/LinearBasicDisplay/index.js +6 -6
  86. package/esm/LinearBasicDisplay/model.d.ts +1134 -122
  87. package/esm/LinearBasicDisplay/model.js +116 -116
  88. package/esm/{LinearBasicDisplay → LinearFeatureDisplay}/components/AddFiltersDialog.js +2 -2
  89. package/esm/{LinearBasicDisplay → LinearFeatureDisplay}/components/SetMaxHeightDialog.js +3 -3
  90. package/{dist/LinearBasicDisplay → esm/LinearFeatureDisplay}/configSchema.d.ts +4 -4
  91. package/esm/LinearFeatureDisplay/configSchema.js +11 -0
  92. package/esm/LinearFeatureDisplay/index.d.ts +3 -0
  93. package/esm/LinearFeatureDisplay/index.js +2 -0
  94. package/esm/LinearFeatureDisplay/model.d.ts +1415 -0
  95. package/esm/LinearFeatureDisplay/model.js +265 -0
  96. package/esm/LinearGenomeView/SVGErrorBox.d.ts +5 -0
  97. package/esm/LinearGenomeView/SVGErrorBox.js +4 -0
  98. package/esm/LinearGenomeView/afterAttach.d.ts +5 -0
  99. package/esm/LinearGenomeView/afterAttach.js +95 -0
  100. package/esm/LinearGenomeView/components/CenterLine.js +6 -4
  101. package/esm/LinearGenomeView/components/Cytobands.js +4 -4
  102. package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +1 -1
  103. package/esm/LinearGenomeView/components/ExportSvgDialog.js +5 -1
  104. package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +8 -2
  105. package/esm/LinearGenomeView/components/GetSequenceDialog.js +13 -16
  106. package/esm/LinearGenomeView/components/Gridlines.js +18 -15
  107. package/esm/LinearGenomeView/components/Header.js +9 -9
  108. package/esm/LinearGenomeView/components/HeaderPanControls.js +2 -2
  109. package/esm/LinearGenomeView/components/HeaderRegionWidth.js +4 -5
  110. package/esm/LinearGenomeView/components/HeaderTrackSelectorButton.js +2 -2
  111. package/esm/LinearGenomeView/components/HeaderZoomControls.js +3 -3
  112. package/esm/LinearGenomeView/components/Highlight.d.ts +1 -1
  113. package/esm/LinearGenomeView/components/Highlight.js +6 -6
  114. package/esm/LinearGenomeView/components/ImportForm.d.ts +1 -1
  115. package/esm/LinearGenomeView/components/ImportForm.js +14 -12
  116. package/esm/LinearGenomeView/components/ImportFormRefNameAutocomplete.js +3 -3
  117. package/esm/LinearGenomeView/components/LinearGenomeView.js +7 -7
  118. package/esm/LinearGenomeView/components/LinearGenomeViewContainer.js +7 -8
  119. package/esm/LinearGenomeView/components/MiniControls.js +6 -6
  120. package/esm/LinearGenomeView/components/NoTracksActiveButton.js +2 -2
  121. package/esm/LinearGenomeView/components/OverviewHighlight.d.ts +1 -1
  122. package/esm/LinearGenomeView/components/OverviewHighlight.js +5 -5
  123. package/esm/LinearGenomeView/components/OverviewRubberband.js +4 -4
  124. package/esm/LinearGenomeView/components/OverviewRubberbandHoverTooltip.js +9 -5
  125. package/esm/LinearGenomeView/components/OverviewScalebar.js +36 -28
  126. package/esm/LinearGenomeView/components/OverviewScalebarPolygon.js +5 -5
  127. package/esm/LinearGenomeView/components/OverviewScalebarTickLabels.js +7 -7
  128. package/esm/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js +1 -1
  129. package/esm/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +1 -1
  130. package/esm/LinearGenomeView/components/RefNameAutocomplete/index.js +10 -10
  131. package/esm/LinearGenomeView/components/RegionWidthEditorDialog.d.ts +1 -1
  132. package/esm/LinearGenomeView/components/RegionWidthEditorDialog.js +6 -4
  133. package/esm/LinearGenomeView/components/Rubberband.js +9 -7
  134. package/esm/LinearGenomeView/components/RubberbandSpan.js +4 -5
  135. package/esm/LinearGenomeView/components/Scalebar.js +8 -10
  136. package/esm/LinearGenomeView/components/ScalebarCoordinateLabels.d.ts +1 -1
  137. package/esm/LinearGenomeView/components/ScalebarCoordinateLabels.js +50 -17
  138. package/esm/LinearGenomeView/components/ScalebarRefNameLabels.d.ts +1 -1
  139. package/esm/LinearGenomeView/components/ScalebarRefNameLabels.js +13 -11
  140. package/esm/LinearGenomeView/components/SearchBox.d.ts +1 -1
  141. package/esm/LinearGenomeView/components/SearchBox.js +8 -9
  142. package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +1 -1
  143. package/esm/LinearGenomeView/components/SearchResultsDialog.js +2 -2
  144. package/esm/LinearGenomeView/components/SearchResultsTable.d.ts +1 -1
  145. package/esm/LinearGenomeView/components/SearchResultsTable.js +4 -6
  146. package/esm/LinearGenomeView/components/SequenceSearchDialog.js +6 -6
  147. package/esm/LinearGenomeView/components/TrackContainer.js +32 -20
  148. package/esm/LinearGenomeView/components/TrackLabel.js +10 -11
  149. package/esm/LinearGenomeView/components/TrackLabelContainer.js +7 -8
  150. package/esm/LinearGenomeView/components/TrackLabelDragHandle.js +1 -1
  151. package/esm/LinearGenomeView/components/TrackLabelMenu.js +80 -68
  152. package/esm/LinearGenomeView/components/TrackRenderingContainer.d.ts +1 -2
  153. package/esm/LinearGenomeView/components/TrackRenderingContainer.js +5 -5
  154. package/esm/LinearGenomeView/components/TracksContainer.js +18 -15
  155. package/esm/LinearGenomeView/components/VerticalGuide.js +5 -3
  156. package/esm/LinearGenomeView/components/fetchSequence.d.ts +7 -2
  157. package/esm/LinearGenomeView/components/useRangeSelect.d.ts +27 -2
  158. package/esm/LinearGenomeView/components/useRangeSelect.js +26 -20
  159. package/esm/LinearGenomeView/components/useWheelScroll.js +22 -12
  160. package/esm/LinearGenomeView/components/util.d.ts +2 -13
  161. package/esm/LinearGenomeView/components/util.js +12 -31
  162. package/esm/LinearGenomeView/index.d.ts +1 -1
  163. package/esm/LinearGenomeView/index.js +3 -3
  164. package/esm/LinearGenomeView/keyboardHandler.d.ts +2 -0
  165. package/esm/LinearGenomeView/keyboardHandler.js +29 -0
  166. package/esm/LinearGenomeView/menuItems.d.ts +7 -0
  167. package/esm/LinearGenomeView/menuItems.js +299 -0
  168. package/esm/LinearGenomeView/model.d.ts +92 -89
  169. package/esm/LinearGenomeView/model.js +166 -414
  170. package/esm/LinearGenomeView/svgExportUtil.d.ts +9 -0
  171. package/esm/LinearGenomeView/svgExportUtil.js +6 -0
  172. package/{dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts → esm/LinearGenomeView/svgcomponents/SVGGridlines.d.ts} +2 -2
  173. package/esm/LinearGenomeView/svgcomponents/SVGGridlines.js +20 -0
  174. package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +5 -5
  175. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +4 -3
  176. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +24 -12
  177. package/esm/LinearGenomeView/svgcomponents/SVGRuler.js +13 -5
  178. package/esm/LinearGenomeView/svgcomponents/SVGTracks.js +2 -2
  179. package/esm/LinearGenomeView/types.d.ts +5 -1
  180. package/esm/LinearGenomeView/util.d.ts +2 -2
  181. package/esm/LinearGenomeView/util.js +8 -6
  182. package/esm/index.d.ts +975 -94
  183. package/esm/index.js +37 -38
  184. package/esm/searchUtils.d.ts +1 -1
  185. package/esm/searchUtils.js +6 -4
  186. package/package.json +28 -33
  187. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +0 -8
  188. package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +0 -72
  189. package/dist/BaseLinearDisplay/components/Block.d.ts +0 -14
  190. package/dist/BaseLinearDisplay/components/Block.js +0 -50
  191. package/dist/BaseLinearDisplay/components/BlockErrorMessage.d.ts +0 -7
  192. package/dist/BaseLinearDisplay/components/BlockErrorMessage.js +0 -27
  193. package/dist/BaseLinearDisplay/components/BlockLoadingMessage.d.ts +0 -6
  194. package/dist/BaseLinearDisplay/components/BlockLoadingMessage.js +0 -26
  195. package/dist/BaseLinearDisplay/components/BlockMsg.d.ts +0 -6
  196. package/dist/BaseLinearDisplay/components/BlockMsg.js +0 -20
  197. package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +0 -9
  198. package/dist/BaseLinearDisplay/components/LinearBlocks.js +0 -61
  199. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +0 -11
  200. package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +0 -59
  201. package/dist/BaseLinearDisplay/components/TooLargeMessage.d.ts +0 -10
  202. package/dist/BaseLinearDisplay/components/TooLargeMessage.js +0 -25
  203. package/dist/BaseLinearDisplay/components/Tooltip.d.ts +0 -11
  204. package/dist/BaseLinearDisplay/components/Tooltip.js +0 -24
  205. package/dist/BaseLinearDisplay/index.d.ts +0 -8
  206. package/dist/BaseLinearDisplay/index.js +0 -20
  207. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +0 -311
  208. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +0 -325
  209. package/dist/BaseLinearDisplay/models/FeatureDensityMixin.d.ts +0 -32
  210. package/dist/BaseLinearDisplay/models/FeatureDensityMixin.js +0 -122
  211. package/dist/BaseLinearDisplay/models/TrackHeightMixin.d.ts +0 -11
  212. package/dist/BaseLinearDisplay/models/TrackHeightMixin.js +0 -35
  213. package/dist/BaseLinearDisplay/models/autorunFeatureDensityStats.d.ts +0 -2
  214. package/dist/BaseLinearDisplay/models/autorunFeatureDensityStats.js +0 -33
  215. package/dist/BaseLinearDisplay/models/configSchema.d.ts +0 -29
  216. package/dist/BaseLinearDisplay/models/configSchema.js +0 -35
  217. package/dist/BaseLinearDisplay/models/renderSvg.d.ts +0 -7
  218. package/dist/BaseLinearDisplay/models/renderSvg.js +0 -80
  219. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +0 -78
  220. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +0 -229
  221. package/dist/BaseLinearDisplay/models/util.d.ts +0 -22
  222. package/dist/BaseLinearDisplay/models/util.js +0 -45
  223. package/dist/BasicTrack/configSchema.d.ts +0 -80
  224. package/dist/BasicTrack/configSchema.js +0 -10
  225. package/dist/BasicTrack/index.d.ts +0 -2
  226. package/dist/BasicTrack/index.js +0 -18
  227. package/dist/FeatureTrack/configSchema.d.ts +0 -80
  228. package/dist/FeatureTrack/configSchema.js +0 -10
  229. package/dist/FeatureTrack/index.d.ts +0 -2
  230. package/dist/FeatureTrack/index.js +0 -19
  231. package/dist/LaunchLinearGenomeView/index.d.ts +0 -2
  232. package/dist/LaunchLinearGenomeView/index.js +0 -70
  233. package/dist/LinearBareDisplay/configSchema.d.ts +0 -32
  234. package/dist/LinearBareDisplay/configSchema.js +0 -13
  235. package/dist/LinearBareDisplay/index.d.ts +0 -4
  236. package/dist/LinearBareDisplay/index.js +0 -26
  237. package/dist/LinearBareDisplay/model.d.ts +0 -309
  238. package/dist/LinearBareDisplay/model.js +0 -38
  239. package/dist/LinearBasicDisplay/components/AddFiltersDialog.js +0 -61
  240. package/dist/LinearBasicDisplay/components/SetMaxHeightDialog.js +0 -28
  241. package/dist/LinearBasicDisplay/configSchema.js +0 -13
  242. package/dist/LinearBasicDisplay/index.d.ts +0 -4
  243. package/dist/LinearBasicDisplay/index.js +0 -29
  244. package/dist/LinearBasicDisplay/model.d.ts +0 -346
  245. package/dist/LinearBasicDisplay/model.js +0 -192
  246. package/dist/LinearGenomeView/components/CenterLine.d.ts +0 -6
  247. package/dist/LinearGenomeView/components/CenterLine.js +0 -38
  248. package/dist/LinearGenomeView/components/Cytobands.d.ts +0 -9
  249. package/dist/LinearGenomeView/components/Cytobands.js +0 -89
  250. package/dist/LinearGenomeView/components/ExportSvgDialog.d.ts +0 -7
  251. package/dist/LinearGenomeView/components/ExportSvgDialog.js +0 -57
  252. package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +0 -6
  253. package/dist/LinearGenomeView/components/GetSequenceDialog.js +0 -109
  254. package/dist/LinearGenomeView/components/Gridlines.d.ts +0 -7
  255. package/dist/LinearGenomeView/components/Gridlines.js +0 -70
  256. package/dist/LinearGenomeView/components/Header.d.ts +0 -5
  257. package/dist/LinearGenomeView/components/Header.js +0 -38
  258. package/dist/LinearGenomeView/components/HeaderPanControls.d.ts +0 -6
  259. package/dist/LinearGenomeView/components/HeaderPanControls.js +0 -27
  260. package/dist/LinearGenomeView/components/HeaderRegionWidth.d.ts +0 -5
  261. package/dist/LinearGenomeView/components/HeaderRegionWidth.js +0 -21
  262. package/dist/LinearGenomeView/components/HeaderTrackSelectorButton.d.ts +0 -5
  263. package/dist/LinearGenomeView/components/HeaderTrackSelectorButton.js +0 -19
  264. package/dist/LinearGenomeView/components/HeaderZoomControls.d.ts +0 -5
  265. package/dist/LinearGenomeView/components/HeaderZoomControls.js +0 -109
  266. package/dist/LinearGenomeView/components/Highlight.d.ts +0 -12
  267. package/dist/LinearGenomeView/components/Highlight.js +0 -95
  268. package/dist/LinearGenomeView/components/ImportForm.d.ts +0 -6
  269. package/dist/LinearGenomeView/components/ImportForm.js +0 -80
  270. package/dist/LinearGenomeView/components/ImportFormRefNameAutocomplete.d.ts +0 -11
  271. package/dist/LinearGenomeView/components/ImportFormRefNameAutocomplete.js +0 -32
  272. package/dist/LinearGenomeView/components/LinearGenomeView.d.ts +0 -5
  273. package/dist/LinearGenomeView/components/LinearGenomeView.js +0 -57
  274. package/dist/LinearGenomeView/components/LinearGenomeViewContainer.d.ts +0 -5
  275. package/dist/LinearGenomeView/components/LinearGenomeViewContainer.js +0 -98
  276. package/dist/LinearGenomeView/components/MiniControls.d.ts +0 -5
  277. package/dist/LinearGenomeView/components/MiniControls.js +0 -36
  278. package/dist/LinearGenomeView/components/NoTracksActiveButton.d.ts +0 -5
  279. package/dist/LinearGenomeView/components/NoTracksActiveButton.js +0 -23
  280. package/dist/LinearGenomeView/components/OverviewHighlight.d.ts +0 -8
  281. package/dist/LinearGenomeView/components/OverviewHighlight.js +0 -50
  282. package/dist/LinearGenomeView/components/OverviewRubberband.d.ts +0 -9
  283. package/dist/LinearGenomeView/components/OverviewRubberband.js +0 -113
  284. package/dist/LinearGenomeView/components/OverviewRubberbandHoverTooltip.d.ts +0 -10
  285. package/dist/LinearGenomeView/components/OverviewRubberbandHoverTooltip.js +0 -28
  286. package/dist/LinearGenomeView/components/OverviewScalebar.d.ts +0 -7
  287. package/dist/LinearGenomeView/components/OverviewScalebar.js +0 -146
  288. package/dist/LinearGenomeView/components/OverviewScalebarPolygon.d.ts +0 -8
  289. package/dist/LinearGenomeView/components/OverviewScalebarPolygon.js +0 -41
  290. package/dist/LinearGenomeView/components/OverviewScalebarTickLabels.d.ts +0 -10
  291. package/dist/LinearGenomeView/components/OverviewScalebarTickLabels.js +0 -37
  292. package/dist/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.d.ts +0 -8
  293. package/dist/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js +0 -18
  294. package/dist/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.d.ts +0 -3
  295. package/dist/LinearGenomeView/components/RefNameAutocomplete/EndAdornment.js +0 -56
  296. package/dist/LinearGenomeView/components/RefNameAutocomplete/HelpDialog.d.ts +0 -3
  297. package/dist/LinearGenomeView/components/RefNameAutocomplete/HelpDialog.js +0 -11
  298. package/dist/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +0 -16
  299. package/dist/LinearGenomeView/components/RefNameAutocomplete/index.js +0 -127
  300. package/dist/LinearGenomeView/components/RefNameAutocomplete/util.d.ts +0 -10
  301. package/dist/LinearGenomeView/components/RefNameAutocomplete/util.js +0 -53
  302. package/dist/LinearGenomeView/components/RegionWidthEditorDialog.d.ts +0 -6
  303. package/dist/LinearGenomeView/components/RegionWidthEditorDialog.js +0 -30
  304. package/dist/LinearGenomeView/components/Rubberband.d.ts +0 -7
  305. package/dist/LinearGenomeView/components/Rubberband.js +0 -35
  306. package/dist/LinearGenomeView/components/RubberbandSpan.d.ts +0 -15
  307. package/dist/LinearGenomeView/components/RubberbandSpan.js +0 -39
  308. package/dist/LinearGenomeView/components/RubberbandTooltip.d.ts +0 -5
  309. package/dist/LinearGenomeView/components/RubberbandTooltip.js +0 -20
  310. package/dist/LinearGenomeView/components/Scalebar.d.ts +0 -10
  311. package/dist/LinearGenomeView/components/Scalebar.js +0 -40
  312. package/dist/LinearGenomeView/components/ScalebarCoordinateLabels.d.ts +0 -6
  313. package/dist/LinearGenomeView/components/ScalebarCoordinateLabels.js +0 -29
  314. package/dist/LinearGenomeView/components/ScalebarCoordinateTicks.d.ts +0 -6
  315. package/dist/LinearGenomeView/components/ScalebarCoordinateTicks.js +0 -38
  316. package/dist/LinearGenomeView/components/ScalebarRefNameLabels.d.ts +0 -6
  317. package/dist/LinearGenomeView/components/ScalebarRefNameLabels.js +0 -46
  318. package/dist/LinearGenomeView/components/SearchBox.d.ts +0 -6
  319. package/dist/LinearGenomeView/components/SearchBox.js +0 -88
  320. package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +0 -9
  321. package/dist/LinearGenomeView/components/SearchResultsDialog.js +0 -15
  322. package/dist/LinearGenomeView/components/SearchResultsTable.d.ts +0 -8
  323. package/dist/LinearGenomeView/components/SearchResultsTable.js +0 -74
  324. package/dist/LinearGenomeView/components/SequenceSearchDialog.d.ts +0 -8
  325. package/dist/LinearGenomeView/components/SequenceSearchDialog.js +0 -67
  326. package/dist/LinearGenomeView/components/TrackContainer.d.ts +0 -8
  327. package/dist/LinearGenomeView/components/TrackContainer.js +0 -51
  328. package/dist/LinearGenomeView/components/TrackLabel.d.ts +0 -7
  329. package/dist/LinearGenomeView/components/TrackLabel.js +0 -49
  330. package/dist/LinearGenomeView/components/TrackLabelContainer.d.ts +0 -8
  331. package/dist/LinearGenomeView/components/TrackLabelContainer.js +0 -31
  332. package/dist/LinearGenomeView/components/TrackLabelDragHandle.d.ts +0 -8
  333. package/dist/LinearGenomeView/components/TrackLabelDragHandle.js +0 -32
  334. package/dist/LinearGenomeView/components/TrackLabelMenu.d.ts +0 -5
  335. package/dist/LinearGenomeView/components/TrackLabelMenu.js +0 -93
  336. package/dist/LinearGenomeView/components/TrackRenderingContainer.d.ts +0 -9
  337. package/dist/LinearGenomeView/components/TrackRenderingContainer.js +0 -50
  338. package/dist/LinearGenomeView/components/TracksContainer.d.ts +0 -7
  339. package/dist/LinearGenomeView/components/TracksContainer.js +0 -84
  340. package/dist/LinearGenomeView/components/VerticalGuide.d.ts +0 -7
  341. package/dist/LinearGenomeView/components/VerticalGuide.js +0 -31
  342. package/dist/LinearGenomeView/components/fetchSequence.d.ts +0 -4
  343. package/dist/LinearGenomeView/components/fetchSequence.js +0 -29
  344. package/dist/LinearGenomeView/components/useRangeSelect.d.ts +0 -59
  345. package/dist/LinearGenomeView/components/useRangeSelect.js +0 -131
  346. package/dist/LinearGenomeView/components/useSideScroll.d.ts +0 -6
  347. package/dist/LinearGenomeView/components/useSideScroll.js +0 -60
  348. package/dist/LinearGenomeView/components/useWheelScroll.d.ts +0 -7
  349. package/dist/LinearGenomeView/components/useWheelScroll.js +0 -62
  350. package/dist/LinearGenomeView/components/util.d.ts +0 -25
  351. package/dist/LinearGenomeView/components/util.js +0 -49
  352. package/dist/LinearGenomeView/consts.d.ts +0 -7
  353. package/dist/LinearGenomeView/consts.js +0 -10
  354. package/dist/LinearGenomeView/index.d.ts +0 -3
  355. package/dist/LinearGenomeView/index.js +0 -53
  356. package/dist/LinearGenomeView/model.d.ts +0 -268
  357. package/dist/LinearGenomeView/model.js +0 -1109
  358. package/dist/LinearGenomeView/svgcomponents/SVGBackground.d.ts +0 -5
  359. package/dist/LinearGenomeView/svgcomponents/SVGBackground.js +0 -10
  360. package/dist/LinearGenomeView/svgcomponents/SVGHeader.d.ts +0 -7
  361. package/dist/LinearGenomeView/svgcomponents/SVGHeader.js +0 -47
  362. package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +0 -6
  363. package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +0 -42
  364. package/dist/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +0 -8
  365. package/dist/LinearGenomeView/svgcomponents/SVGRuler.d.ts +0 -7
  366. package/dist/LinearGenomeView/svgcomponents/SVGRuler.js +0 -39
  367. package/dist/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +0 -7
  368. package/dist/LinearGenomeView/svgcomponents/SVGScalebar.js +0 -17
  369. package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.d.ts +0 -7
  370. package/dist/LinearGenomeView/svgcomponents/SVGTrackLabel.js +0 -14
  371. package/dist/LinearGenomeView/svgcomponents/SVGTracks.d.ts +0 -21
  372. package/dist/LinearGenomeView/svgcomponents/SVGTracks.js +0 -32
  373. package/dist/LinearGenomeView/svgcomponents/util.d.ts +0 -8
  374. package/dist/LinearGenomeView/svgcomponents/util.js +0 -8
  375. package/dist/LinearGenomeView/types.d.ts +0 -43
  376. package/dist/LinearGenomeView/types.js +0 -2
  377. package/dist/LinearGenomeView/util.d.ts +0 -26
  378. package/dist/LinearGenomeView/util.js +0 -138
  379. package/dist/index.d.ts +0 -353
  380. package/dist/index.js +0 -120
  381. package/dist/searchUtils.d.ts +0 -26
  382. package/dist/searchUtils.js +0 -80
  383. package/esm/BaseLinearDisplay/components/BlockLoadingMessage.d.ts +0 -6
  384. package/esm/BaseLinearDisplay/components/BlockLoadingMessage.js +0 -24
  385. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +0 -311
  386. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +0 -286
  387. package/esm/LinearBasicDisplay/components/AddFiltersDialog.d.ts +0 -9
  388. package/esm/LinearBasicDisplay/components/SetMaxHeightDialog.d.ts +0 -8
  389. package/esm/LinearGenomeView/components/ScalebarCoordinateTicks.d.ts +0 -6
  390. package/esm/LinearGenomeView/components/ScalebarCoordinateTicks.js +0 -36
  391. /package/{dist/LinearBasicDisplay → esm/LinearFeatureDisplay}/components/AddFiltersDialog.d.ts +0 -0
  392. /package/{dist/LinearBasicDisplay → esm/LinearFeatureDisplay}/components/SetMaxHeightDialog.d.ts +0 -0
@@ -1,1109 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.renderToSvg = exports.SearchBox = exports.RefNameAutocomplete = exports.ReactComponent = exports.LinearGenomeView = void 0;
40
- exports.stateModelFactory = stateModelFactory;
41
- const react_1 = require("react");
42
- const configuration_1 = require("@jbrowse/core/configuration");
43
- const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
44
- const ui_1 = require("@jbrowse/core/ui");
45
- const Icons_1 = require("@jbrowse/core/ui/Icons");
46
- const util_1 = require("@jbrowse/core/util");
47
- const Base1DUtils_1 = require("@jbrowse/core/util/Base1DUtils");
48
- const Base1DViewModel_1 = __importDefault(require("@jbrowse/core/util/Base1DViewModel"));
49
- const calculateDynamicBlocks_1 = __importDefault(require("@jbrowse/core/util/calculateDynamicBlocks"));
50
- const calculateStaticBlocks_1 = __importDefault(require("@jbrowse/core/util/calculateStaticBlocks"));
51
- const tracks_1 = require("@jbrowse/core/util/tracks");
52
- const mst_1 = require("@jbrowse/core/util/types/mst");
53
- const product_core_1 = require("@jbrowse/product-core");
54
- const FolderOpen_1 = __importDefault(require("@mui/icons-material/FolderOpen"));
55
- const Label_1 = __importDefault(require("@mui/icons-material/Label"));
56
- const MenuOpen_1 = __importDefault(require("@mui/icons-material/MenuOpen"));
57
- const Palette_1 = __importDefault(require("@mui/icons-material/Palette"));
58
- const PhotoCamera_1 = __importDefault(require("@mui/icons-material/PhotoCamera"));
59
- const Search_1 = __importDefault(require("@mui/icons-material/Search"));
60
- const SyncAlt_1 = __importDefault(require("@mui/icons-material/SyncAlt"));
61
- const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
62
- const ZoomIn_1 = __importDefault(require("@mui/icons-material/ZoomIn"));
63
- const file_saver_1 = require("file-saver");
64
- const mobx_1 = require("mobx");
65
- const mobx_state_tree_1 = require("mobx-state-tree");
66
- const Header_1 = __importDefault(require("./components/Header"));
67
- const util_2 = require("./util");
68
- const searchUtils_1 = require("../searchUtils");
69
- const MiniControls_1 = __importDefault(require("./components/MiniControls"));
70
- const consts_1 = require("./consts");
71
- const ReturnToImportFormDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('@jbrowse/core/ui/ReturnToImportFormDialog'))));
72
- const SequenceSearchDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SequenceSearchDialog'))));
73
- const ExportSvgDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ExportSvgDialog'))));
74
- const GetSequenceDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/GetSequenceDialog'))));
75
- const SearchResultsDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SearchResultsDialog'))));
76
- function stateModelFactory(pluginManager) {
77
- return mobx_state_tree_1.types
78
- .compose('LinearGenomeView', models_1.BaseViewModel, mobx_state_tree_1.types.model({
79
- id: mst_1.ElementId,
80
- type: mobx_state_tree_1.types.literal('LinearGenomeView'),
81
- offsetPx: 0,
82
- bpPerPx: 1,
83
- displayedRegions: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.frozen(), []),
84
- tracks: mobx_state_tree_1.types.array(pluginManager.pluggableMstType('track', 'stateModel')),
85
- hideHeader: false,
86
- hideHeaderOverview: false,
87
- hideNoTracksActive: false,
88
- trackSelectorType: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.enumeration(['hierarchical']), 'hierarchical'),
89
- showCenterLine: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean, () => (0, util_1.localStorageGetBoolean)('lgv-showCenterLine', false)),
90
- showCytobandsSetting: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean, () => (0, util_1.localStorageGetBoolean)('lgv-showCytobands', true)),
91
- trackLabels: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.string, () => (0, util_1.localStorageGetItem)('lgv-trackLabels') || ''),
92
- showGridlines: true,
93
- highlight: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.array(mobx_state_tree_1.types.frozen()), []),
94
- colorByCDS: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean, () => (0, util_1.localStorageGetBoolean)('lgv-colorByCDS', false)),
95
- showTrackOutlines: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean, () => (0, util_1.localStorageGetBoolean)('lgv-showTrackOutlines', true)),
96
- init: mobx_state_tree_1.types.frozen(),
97
- }))
98
- .volatile(() => ({
99
- volatileWidth: undefined,
100
- minimumBlockWidth: 3,
101
- draggingTrackId: undefined,
102
- volatileError: undefined,
103
- afterDisplayedRegionsSetCallbacks: [],
104
- scaleFactor: 1,
105
- trackRefs: {},
106
- coarseDynamicBlocks: [],
107
- coarseTotalBp: 0,
108
- leftOffset: undefined,
109
- rightOffset: undefined,
110
- }))
111
- .views(self => ({
112
- get pinnedTracks() {
113
- return self.tracks.filter(t => t.pinned);
114
- },
115
- get unpinnedTracks() {
116
- return self.tracks.filter(t => !t.pinned);
117
- },
118
- get trackLabelsSetting() {
119
- const sessionSetting = (0, configuration_1.getConf)((0, util_1.getSession)(self), [
120
- 'LinearGenomeViewPlugin',
121
- 'trackLabels',
122
- ]);
123
- return self.trackLabels || sessionSetting;
124
- },
125
- get width() {
126
- if (self.volatileWidth === undefined) {
127
- throw new Error('width undefined, make sure to check for model.initialized');
128
- }
129
- return self.volatileWidth;
130
- },
131
- get interRegionPaddingWidth() {
132
- return consts_1.INTER_REGION_PADDING_WIDTH;
133
- },
134
- get assemblyNames() {
135
- return [
136
- ...new Set(self.displayedRegions.map(region => region.assemblyName)),
137
- ];
138
- },
139
- get assemblyDisplayNames() {
140
- const { assemblyManager } = (0, util_1.getSession)(self);
141
- return this.assemblyNames.map(assemblyName => {
142
- var _a;
143
- const assembly = assemblyManager.get(assemblyName);
144
- return (_a = assembly === null || assembly === void 0 ? void 0 : assembly.displayName) !== null && _a !== void 0 ? _a : assemblyName;
145
- });
146
- },
147
- get isTopLevelView() {
148
- const session = (0, util_1.getSession)(self);
149
- return session.views.some(r => r.id === self.id);
150
- },
151
- get stickyViewHeaders() {
152
- const session = (0, util_1.getSession)(self);
153
- return (0, product_core_1.isSessionWithMultipleViews)(session)
154
- ? this.isTopLevelView && session.stickyViewHeaders
155
- : false;
156
- },
157
- get rubberbandTop() {
158
- let pinnedTracksTop = 0;
159
- if (this.stickyViewHeaders) {
160
- pinnedTracksTop = ui_1.VIEW_HEADER_HEIGHT;
161
- if (!self.hideHeader) {
162
- pinnedTracksTop += consts_1.HEADER_BAR_HEIGHT;
163
- if (!self.hideHeaderOverview) {
164
- pinnedTracksTop += consts_1.HEADER_OVERVIEW_HEIGHT;
165
- }
166
- }
167
- }
168
- return pinnedTracksTop;
169
- },
170
- get pinnedTracksTop() {
171
- return this.rubberbandTop + consts_1.SCALE_BAR_HEIGHT;
172
- },
173
- }))
174
- .views(self => ({
175
- scaleBarDisplayPrefix() {
176
- return (0, mobx_state_tree_1.getParent)(self, 2).type === 'LinearSyntenyView'
177
- ? self.assemblyDisplayNames[0]
178
- : '';
179
- },
180
- MiniControlsComponent() {
181
- return MiniControls_1.default;
182
- },
183
- HeaderComponent() {
184
- return Header_1.default;
185
- },
186
- get assembliesNotFound() {
187
- const { assemblyManager } = (0, util_1.getSession)(self);
188
- const r0 = self.assemblyNames
189
- .map(a => (!assemblyManager.get(a) ? a : undefined))
190
- .filter(f => !!f)
191
- .join(',');
192
- return r0 ? `Assemblies ${r0} not found` : undefined;
193
- },
194
- get assemblyErrors() {
195
- const { assemblyManager } = (0, util_1.getSession)(self);
196
- return self.assemblyNames
197
- .map(a => { var _a; return (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.error; })
198
- .filter(f => !!f)
199
- .join(', ');
200
- },
201
- get assembliesInitialized() {
202
- const { assemblyManager } = (0, util_1.getSession)(self);
203
- return self.assemblyNames.every(a => { var _a; return (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.initialized; });
204
- },
205
- get initialized() {
206
- return self.volatileWidth !== undefined && this.assembliesInitialized;
207
- },
208
- get hasDisplayedRegions() {
209
- return self.displayedRegions.length > 0;
210
- },
211
- get scaleBarHeight() {
212
- return consts_1.SCALE_BAR_HEIGHT + consts_1.RESIZE_HANDLE_HEIGHT;
213
- },
214
- get headerHeight() {
215
- if (self.hideHeader) {
216
- return 0;
217
- }
218
- else if (self.hideHeaderOverview) {
219
- return consts_1.HEADER_BAR_HEIGHT;
220
- }
221
- else {
222
- return consts_1.HEADER_BAR_HEIGHT + consts_1.HEADER_OVERVIEW_HEIGHT;
223
- }
224
- },
225
- get trackHeights() {
226
- return (0, util_1.sum)(self.tracks.map(t => t.displays[0].height));
227
- },
228
- get trackHeightsWithResizeHandles() {
229
- return this.trackHeights + self.tracks.length * consts_1.RESIZE_HANDLE_HEIGHT;
230
- },
231
- get height() {
232
- return (this.trackHeightsWithResizeHandles +
233
- this.headerHeight +
234
- this.scaleBarHeight);
235
- },
236
- get totalBp() {
237
- return (0, util_1.sum)(self.displayedRegions.map(r => r.end - r.start));
238
- },
239
- get maxBpPerPx() {
240
- return this.totalBp / (self.width * 0.9);
241
- },
242
- get minBpPerPx() {
243
- return 1 / 50;
244
- },
245
- get error() {
246
- return (self.volatileError || this.assemblyErrors || this.assembliesNotFound);
247
- },
248
- get maxOffset() {
249
- const leftPadding = 10;
250
- return this.displayedRegionsTotalPx - leftPadding;
251
- },
252
- get minOffset() {
253
- const rightPadding = 30;
254
- return -self.width + rightPadding;
255
- },
256
- get displayedRegionsTotalPx() {
257
- return this.totalBp / self.bpPerPx;
258
- },
259
- renderProps() {
260
- return {
261
- ...(0, tracks_1.getParentRenderProps)(self),
262
- bpPerPx: self.bpPerPx,
263
- colorByCDS: self.colorByCDS,
264
- };
265
- },
266
- searchScope(assemblyName) {
267
- return {
268
- assemblyName,
269
- includeAggregateIndexes: true,
270
- tracks: self.tracks,
271
- };
272
- },
273
- getTrack(id) {
274
- return self.tracks.find(t => t.configuration.trackId === id);
275
- },
276
- rankSearchResults(results) {
277
- return results;
278
- },
279
- rewriteOnClicks(trackType, viewMenuActions) {
280
- for (const action of viewMenuActions) {
281
- if ('subMenu' in action) {
282
- this.rewriteOnClicks(trackType, action.subMenu);
283
- }
284
- if ('onClick' in action) {
285
- const holdOnClick = action.onClick;
286
- action.onClick = (...args) => {
287
- for (const track of self.tracks) {
288
- if (track.type === trackType) {
289
- holdOnClick.apply(track, [track, ...args]);
290
- }
291
- }
292
- };
293
- }
294
- }
295
- },
296
- get trackTypeActions() {
297
- const allActions = new Map();
298
- for (const track of self.tracks) {
299
- const trackInMap = allActions.get(track.type);
300
- if (!trackInMap) {
301
- const viewMenuActions = structuredClone(track.viewMenuActions);
302
- this.rewriteOnClicks(track.type, viewMenuActions);
303
- allActions.set(track.type, viewMenuActions);
304
- }
305
- }
306
- return allActions;
307
- },
308
- }))
309
- .actions(self => ({
310
- setShowTrackOutlines(arg) {
311
- self.showTrackOutlines = arg;
312
- },
313
- setColorByCDS(flag) {
314
- self.colorByCDS = flag;
315
- },
316
- setShowCytobands(flag) {
317
- self.showCytobandsSetting = flag;
318
- },
319
- setWidth(newWidth) {
320
- self.volatileWidth = newWidth;
321
- },
322
- setError(error) {
323
- self.volatileError = error;
324
- },
325
- setHideHeader(b) {
326
- self.hideHeader = b;
327
- },
328
- setHideHeaderOverview(b) {
329
- self.hideHeaderOverview = b;
330
- },
331
- setHideNoTracksActive(b) {
332
- self.hideNoTracksActive = b;
333
- },
334
- setShowGridlines(b) {
335
- self.showGridlines = b;
336
- },
337
- addToHighlights(highlight) {
338
- self.highlight.push(highlight);
339
- },
340
- setHighlight(highlight) {
341
- self.highlight = (0, mobx_state_tree_1.cast)(highlight);
342
- },
343
- removeHighlight(highlight) {
344
- self.highlight.remove(highlight);
345
- },
346
- scrollTo(offsetPx) {
347
- const newOffsetPx = (0, util_1.clamp)(offsetPx, self.minOffset, self.maxOffset);
348
- self.offsetPx = newOffsetPx;
349
- return newOffsetPx;
350
- },
351
- zoomTo(bpPerPx, offset = self.width / 2, centerAtOffset = false) {
352
- const newBpPerPx = (0, util_1.clamp)(bpPerPx, self.minBpPerPx, self.maxBpPerPx);
353
- if (newBpPerPx === self.bpPerPx) {
354
- return newBpPerPx;
355
- }
356
- const oldBpPerPx = self.bpPerPx;
357
- if (Math.abs(oldBpPerPx - newBpPerPx) < 0.000001) {
358
- console.warn('zoomTo bpPerPx rounding error');
359
- return oldBpPerPx;
360
- }
361
- self.bpPerPx = newBpPerPx;
362
- this.scrollTo(Math.round(((self.offsetPx + offset) * oldBpPerPx) / newBpPerPx -
363
- (centerAtOffset ? self.width / 2 : offset)));
364
- return newBpPerPx;
365
- },
366
- setOffsets(left, right) {
367
- self.leftOffset = left;
368
- self.rightOffset = right;
369
- },
370
- setSearchResults(searchResults, searchQuery, assemblyName) {
371
- (0, util_1.getSession)(self).queueDialog(handleClose => [
372
- SearchResultsDialog,
373
- {
374
- model: self,
375
- searchResults,
376
- searchQuery,
377
- handleClose,
378
- assemblyName,
379
- },
380
- ]);
381
- },
382
- setNewView(bpPerPx, offsetPx) {
383
- this.zoomTo(bpPerPx);
384
- this.scrollTo(offsetPx);
385
- },
386
- horizontallyFlip() {
387
- self.displayedRegions = (0, mobx_state_tree_1.cast)([...self.displayedRegions]
388
- .reverse()
389
- .map(region => ({ ...region, reversed: !region.reversed })));
390
- this.scrollTo(self.totalBp / self.bpPerPx - self.offsetPx - self.width);
391
- },
392
- showTrack(trackId, initialSnapshot = {}, displayInitialSnapshot = {}) {
393
- const schema = pluginManager.pluggableConfigSchemaType('track');
394
- const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
395
- if (!conf) {
396
- throw new Error(`Could not resolve identifier "${trackId}"`);
397
- }
398
- const trackType = pluginManager.getTrackType(conf === null || conf === void 0 ? void 0 : conf.type);
399
- if (!trackType) {
400
- throw new Error(`Unknown track type ${conf.type}`);
401
- }
402
- const viewType = pluginManager.getViewType(self.type);
403
- const supportedDisplays = new Set(viewType.displayTypes.map(d => d.name));
404
- const displayConf = conf.displays.find((d) => supportedDisplays.has(d.type));
405
- if (!displayConf) {
406
- throw new Error(`Could not find a compatible display for view type ${self.type}`);
407
- }
408
- const t = self.tracks.filter(t => t.configuration === conf);
409
- if (t.length === 0) {
410
- const track = trackType.stateModel.create({
411
- ...initialSnapshot,
412
- type: conf.type,
413
- configuration: conf,
414
- displays: [
415
- {
416
- type: displayConf.type,
417
- configuration: displayConf,
418
- ...displayInitialSnapshot,
419
- },
420
- ],
421
- });
422
- self.tracks.push(track);
423
- return track;
424
- }
425
- return t[0];
426
- },
427
- hideTrack(trackId) {
428
- const schema = pluginManager.pluggableConfigSchemaType('track');
429
- const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
430
- const tracks = self.tracks.filter(t => t.configuration === conf);
431
- (0, mobx_1.transaction)(() => {
432
- for (const track of tracks) {
433
- self.tracks.remove(track);
434
- }
435
- });
436
- return tracks.length;
437
- },
438
- }))
439
- .actions(self => ({
440
- moveTrackDown(id) {
441
- const idx = self.tracks.findIndex(v => v.id === id);
442
- if (idx === -1) {
443
- return;
444
- }
445
- if (idx !== -1 && idx < self.tracks.length - 1) {
446
- self.tracks.splice(idx, 2, self.tracks[idx + 1], self.tracks[idx]);
447
- }
448
- },
449
- moveTrackUp(id) {
450
- const idx = self.tracks.findIndex(track => track.id === id);
451
- if (idx > 0) {
452
- self.tracks.splice(idx - 1, 2, self.tracks[idx], self.tracks[idx - 1]);
453
- }
454
- },
455
- moveTrackToTop(id) {
456
- const idx = self.tracks.findIndex(track => track.id === id);
457
- self.tracks = (0, mobx_state_tree_1.cast)([
458
- self.tracks[idx],
459
- ...self.tracks.filter(track => track.id !== id),
460
- ]);
461
- },
462
- moveTrackToBottom(id) {
463
- const idx = self.tracks.findIndex(track => track.id === id);
464
- self.tracks = (0, mobx_state_tree_1.cast)([
465
- ...self.tracks.filter(track => track.id !== id),
466
- self.tracks[idx],
467
- ]);
468
- },
469
- moveTrack(movingId, targetId) {
470
- const oldIndex = self.tracks.findIndex(track => track.id === movingId);
471
- if (oldIndex === -1) {
472
- throw new Error(`Track ID ${movingId} not found`);
473
- }
474
- const newIndex = self.tracks.findIndex(track => track.id === targetId);
475
- if (newIndex === -1) {
476
- throw new Error(`Track ID ${targetId} not found`);
477
- }
478
- const tracks = self.tracks.filter((_, idx) => idx !== oldIndex);
479
- tracks.splice(newIndex, 0, self.tracks[oldIndex]);
480
- self.tracks = (0, mobx_state_tree_1.cast)(tracks);
481
- },
482
- toggleTrack(trackId) {
483
- const hiddenCount = self.hideTrack(trackId);
484
- if (!hiddenCount) {
485
- self.showTrack(trackId);
486
- return true;
487
- }
488
- return false;
489
- },
490
- setTrackLabels(setting) {
491
- localStorage.setItem('lgv-trackLabels', setting);
492
- self.trackLabels = setting;
493
- },
494
- setShowCenterLine(b) {
495
- self.showCenterLine = b;
496
- },
497
- setDisplayedRegions(regions) {
498
- self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
499
- self.zoomTo(self.bpPerPx);
500
- },
501
- activateTrackSelector() {
502
- if (self.trackSelectorType === 'hierarchical') {
503
- const session = (0, util_1.getSession)(self);
504
- if ((0, util_1.isSessionModelWithWidgets)(session)) {
505
- const selector = session.addWidget('HierarchicalTrackSelectorWidget', 'hierarchicalTrackSelector', { view: self });
506
- session.showWidget(selector);
507
- return selector;
508
- }
509
- }
510
- throw new Error(`invalid track selector type ${self.trackSelectorType}`);
511
- },
512
- getSelectedRegions(leftOffset, rightOffset) {
513
- const snap = (0, mobx_state_tree_1.getSnapshot)(self);
514
- const simView = Base1DViewModel_1.default.create({
515
- ...snap,
516
- interRegionPaddingWidth: self.interRegionPaddingWidth,
517
- });
518
- simView.setVolatileWidth(self.width);
519
- simView.moveTo(leftOffset, rightOffset);
520
- return simView.dynamicBlocks.contentBlocks.map(region => ({
521
- ...region,
522
- start: Math.floor(region.start),
523
- end: Math.ceil(region.end),
524
- }));
525
- },
526
- afterDisplayedRegionsSet(cb) {
527
- self.afterDisplayedRegionsSetCallbacks.push(cb);
528
- },
529
- horizontalScroll(distance) {
530
- const oldOffsetPx = self.offsetPx;
531
- const newOffsetPx = self.scrollTo(self.offsetPx + distance);
532
- return newOffsetPx - oldOffsetPx;
533
- },
534
- center() {
535
- const centerBp = self.totalBp / 2;
536
- const centerPx = centerBp / self.bpPerPx;
537
- self.scrollTo(Math.round(centerPx - self.width / 2));
538
- },
539
- showAllRegions() {
540
- self.zoomTo(self.maxBpPerPx);
541
- this.center();
542
- },
543
- showAllRegionsInAssembly(assemblyName) {
544
- const session = (0, util_1.getSession)(self);
545
- const { assemblyManager } = session;
546
- if (!assemblyName) {
547
- const names = new Set(self.displayedRegions.map(r => r.assemblyName));
548
- if (names.size > 1) {
549
- session.notify(`Can't perform operation with multiple assemblies currently`);
550
- return;
551
- }
552
- ;
553
- [assemblyName] = [...names];
554
- }
555
- const assembly = assemblyManager.get(assemblyName);
556
- if (assembly) {
557
- const { regions } = assembly;
558
- if (regions) {
559
- this.setDisplayedRegions(regions);
560
- self.zoomTo(self.maxBpPerPx);
561
- this.center();
562
- }
563
- }
564
- },
565
- setDraggingTrackId(idx) {
566
- self.draggingTrackId = idx;
567
- },
568
- setScaleFactor(factor) {
569
- self.scaleFactor = factor;
570
- },
571
- clearView() {
572
- this.setDisplayedRegions([]);
573
- self.tracks.clear();
574
- self.scrollTo(0);
575
- self.zoomTo(10);
576
- },
577
- setInit(arg) {
578
- self.init = arg;
579
- },
580
- async exportSvg(opts = {}) {
581
- const { renderToSvg } = await Promise.resolve().then(() => __importStar(require('./svgcomponents/SVGLinearGenomeView')));
582
- const html = await renderToSvg(self, opts);
583
- const blob = new Blob([html], { type: 'image/svg+xml' });
584
- (0, file_saver_1.saveAs)(blob, opts.filename || 'image.svg');
585
- },
586
- }))
587
- .actions(self => {
588
- let cancelLastAnimation = () => { };
589
- function slide(viewWidths) {
590
- const [animate, cancelAnimation] = (0, util_1.springAnimate)(self.offsetPx, self.offsetPx + self.width * viewWidths, self.scrollTo, undefined, undefined, 200);
591
- cancelLastAnimation();
592
- cancelLastAnimation = cancelAnimation;
593
- animate();
594
- }
595
- return { slide };
596
- })
597
- .actions(self => {
598
- let cancelLastAnimation = () => { };
599
- function zoom(targetBpPerPx) {
600
- self.zoomTo(self.bpPerPx);
601
- if ((targetBpPerPx < self.bpPerPx && self.bpPerPx === self.minBpPerPx) ||
602
- (targetBpPerPx > self.bpPerPx && self.bpPerPx === self.maxBpPerPx)) {
603
- return;
604
- }
605
- const factor = self.bpPerPx / targetBpPerPx;
606
- const [animate, cancelAnimation] = (0, util_1.springAnimate)(1, factor, self.setScaleFactor, () => {
607
- self.zoomTo(targetBpPerPx);
608
- self.setScaleFactor(1);
609
- });
610
- cancelLastAnimation();
611
- cancelLastAnimation = cancelAnimation;
612
- animate();
613
- }
614
- return { zoom };
615
- })
616
- .views(self => ({
617
- get canShowCytobands() {
618
- return self.displayedRegions.length === 1 && this.anyCytobandsExist;
619
- },
620
- get showCytobands() {
621
- return this.canShowCytobands && self.showCytobandsSetting;
622
- },
623
- get anyCytobandsExist() {
624
- const { assemblyManager } = (0, util_1.getSession)(self);
625
- return self.assemblyNames.some(a => { var _a, _b; return (_b = (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.cytobands) === null || _b === void 0 ? void 0 : _b.length; });
626
- },
627
- get cytobandOffset() {
628
- var _a;
629
- return this.showCytobands
630
- ? (0, util_1.measureText)(((_a = self.displayedRegions[0]) === null || _a === void 0 ? void 0 : _a.refName) || '', 12) + 15
631
- : 0;
632
- },
633
- }))
634
- .views(self => ({
635
- menuItems() {
636
- const { canShowCytobands, showCytobands } = self;
637
- const session = (0, util_1.getSession)(self);
638
- const menuItems = [
639
- {
640
- label: 'Return to import form',
641
- onClick: () => {
642
- (0, util_1.getSession)(self).queueDialog(handleClose => [
643
- ReturnToImportFormDialog,
644
- { model: self, handleClose },
645
- ]);
646
- },
647
- icon: FolderOpen_1.default,
648
- },
649
- ...((0, util_1.isSessionWithAddTracks)(session)
650
- ? [
651
- {
652
- label: 'Sequence search',
653
- icon: Search_1.default,
654
- onClick: () => {
655
- (0, util_1.getSession)(self).queueDialog(handleClose => [
656
- SequenceSearchDialog,
657
- {
658
- model: self,
659
- handleClose,
660
- },
661
- ]);
662
- },
663
- },
664
- ]
665
- : []),
666
- {
667
- label: 'Export SVG',
668
- icon: PhotoCamera_1.default,
669
- onClick: () => {
670
- (0, util_1.getSession)(self).queueDialog(handleClose => [
671
- ExportSvgDialog,
672
- {
673
- model: self,
674
- handleClose,
675
- },
676
- ]);
677
- },
678
- },
679
- {
680
- label: 'Open track selector',
681
- onClick: self.activateTrackSelector,
682
- icon: Icons_1.TrackSelector,
683
- },
684
- {
685
- label: 'Horizontally flip',
686
- icon: SyncAlt_1.default,
687
- onClick: self.horizontallyFlip,
688
- },
689
- {
690
- label: 'Color by CDS',
691
- type: 'checkbox',
692
- checked: self.colorByCDS,
693
- icon: Palette_1.default,
694
- onClick: () => {
695
- self.setColorByCDS(!self.colorByCDS);
696
- },
697
- },
698
- {
699
- label: 'Show...',
700
- icon: Visibility_1.default,
701
- subMenu: [
702
- {
703
- label: 'Show all regions in assembly',
704
- onClick: self.showAllRegionsInAssembly,
705
- },
706
- {
707
- label: 'Show center line',
708
- type: 'checkbox',
709
- checked: self.showCenterLine,
710
- onClick: () => {
711
- self.setShowCenterLine(!self.showCenterLine);
712
- },
713
- },
714
- {
715
- label: 'Show header',
716
- type: 'checkbox',
717
- checked: !self.hideHeader,
718
- onClick: () => {
719
- self.setHideHeader(!self.hideHeader);
720
- },
721
- },
722
- {
723
- label: 'Show track outlines',
724
- type: 'checkbox',
725
- checked: self.showTrackOutlines,
726
- onClick: () => {
727
- self.setShowTrackOutlines(!self.showTrackOutlines);
728
- },
729
- },
730
- {
731
- label: 'Show header overview',
732
- type: 'checkbox',
733
- checked: !self.hideHeaderOverview,
734
- onClick: () => {
735
- self.setHideHeaderOverview(!self.hideHeaderOverview);
736
- },
737
- disabled: self.hideHeader,
738
- },
739
- {
740
- label: 'Show no tracks active button',
741
- type: 'checkbox',
742
- checked: !self.hideNoTracksActive,
743
- onClick: () => {
744
- self.setHideNoTracksActive(!self.hideNoTracksActive);
745
- },
746
- },
747
- {
748
- label: 'Show guidelines',
749
- type: 'checkbox',
750
- checked: self.showGridlines,
751
- onClick: () => {
752
- self.setShowGridlines(!self.showGridlines);
753
- },
754
- },
755
- ...(canShowCytobands
756
- ? [
757
- {
758
- label: 'Show ideogram',
759
- type: 'checkbox',
760
- checked: self.showCytobands,
761
- onClick: () => {
762
- self.setShowCytobands(!showCytobands);
763
- },
764
- },
765
- ]
766
- : []),
767
- ],
768
- },
769
- {
770
- label: 'Track labels',
771
- icon: Label_1.default,
772
- subMenu: [
773
- {
774
- label: 'Overlapping',
775
- icon: Visibility_1.default,
776
- type: 'radio',
777
- checked: self.trackLabelsSetting === 'overlapping',
778
- onClick: () => {
779
- self.setTrackLabels('overlapping');
780
- },
781
- },
782
- {
783
- label: 'Offset',
784
- icon: Visibility_1.default,
785
- type: 'radio',
786
- checked: self.trackLabelsSetting === 'offset',
787
- onClick: () => {
788
- self.setTrackLabels('offset');
789
- },
790
- },
791
- {
792
- label: 'Hidden',
793
- icon: Visibility_1.default,
794
- type: 'radio',
795
- checked: self.trackLabelsSetting === 'hidden',
796
- onClick: () => {
797
- self.setTrackLabels('hidden');
798
- },
799
- },
800
- ],
801
- },
802
- ];
803
- for (const [key, value] of self.trackTypeActions.entries()) {
804
- if (value.length) {
805
- menuItems.push({ type: 'divider' }, { type: 'subHeader', label: key });
806
- for (const action of value) {
807
- menuItems.push(action);
808
- }
809
- }
810
- }
811
- return menuItems;
812
- },
813
- }))
814
- .views(self => {
815
- let currentlyCalculatedStaticBlocks;
816
- let stringifiedCurrentlyCalculatedStaticBlocks = '';
817
- return {
818
- get staticBlocks() {
819
- const ret = (0, calculateStaticBlocks_1.default)(self);
820
- const sret = JSON.stringify(ret);
821
- if (stringifiedCurrentlyCalculatedStaticBlocks !== sret) {
822
- currentlyCalculatedStaticBlocks = ret;
823
- stringifiedCurrentlyCalculatedStaticBlocks = sret;
824
- }
825
- return currentlyCalculatedStaticBlocks;
826
- },
827
- get dynamicBlocks() {
828
- return (0, calculateDynamicBlocks_1.default)(self);
829
- },
830
- get roundedDynamicBlocks() {
831
- return this.dynamicBlocks.contentBlocks.map(block => ({
832
- ...block,
833
- start: Math.floor(block.start),
834
- end: Math.ceil(block.end),
835
- }));
836
- },
837
- get visibleLocStrings() {
838
- return (0, util_2.calculateVisibleLocStrings)(this.dynamicBlocks.contentBlocks);
839
- },
840
- get coarseVisibleLocStrings() {
841
- return (0, util_2.calculateVisibleLocStrings)(self.coarseDynamicBlocks);
842
- },
843
- };
844
- })
845
- .actions(self => ({
846
- setCoarseDynamicBlocks(blocks) {
847
- self.coarseDynamicBlocks = blocks.contentBlocks;
848
- self.coarseTotalBp = blocks.totalBp;
849
- },
850
- }))
851
- .actions(self => ({
852
- moveTo(start, end) {
853
- (0, Base1DUtils_1.moveTo)(self, start, end);
854
- },
855
- async navToLocString(input, optAssemblyName, grow) {
856
- const { assemblyNames } = self;
857
- const { assemblyManager } = (0, util_1.getSession)(self);
858
- const assemblyName = optAssemblyName || assemblyNames[0];
859
- if (assemblyName) {
860
- await assemblyManager.waitForAssembly(assemblyName);
861
- }
862
- return this.navToLocations((0, util_2.parseLocStrings)(input, assemblyName, (ref, asm) => assemblyManager.isValidRefName(ref, asm)), assemblyName, grow);
863
- },
864
- async navToSearchString({ input, assembly, }) {
865
- await (0, searchUtils_1.handleSelectedRegion)({
866
- input,
867
- assembly,
868
- model: self,
869
- });
870
- },
871
- async navToLocation(parsedLocString, assemblyName, grow) {
872
- return this.navToLocations([parsedLocString], assemblyName, grow);
873
- },
874
- async navToLocations(regions, assemblyName, grow) {
875
- const { assemblyManager } = (0, util_1.getSession)(self);
876
- await (0, mobx_1.when)(() => self.volatileWidth !== undefined);
877
- const locations = await (0, util_2.generateLocations)({
878
- regions,
879
- assemblyManager,
880
- assemblyName,
881
- grow,
882
- });
883
- if (locations.length === 1) {
884
- const location = locations[0];
885
- const { reversed, parentRegion, start, end } = location;
886
- self.setDisplayedRegions([
887
- {
888
- reversed,
889
- ...parentRegion,
890
- },
891
- ]);
892
- this.navTo({
893
- ...location,
894
- start: (0, util_1.clamp)(start !== null && start !== void 0 ? start : 0, 0, parentRegion.end),
895
- end: (0, util_1.clamp)(end !== null && end !== void 0 ? end : parentRegion.end, 0, parentRegion.end),
896
- });
897
- }
898
- else {
899
- self.setDisplayedRegions(locations.map(location => {
900
- const { start, end } = location;
901
- return start === undefined || end === undefined
902
- ? location.parentRegion
903
- : {
904
- ...location,
905
- start,
906
- end,
907
- };
908
- }));
909
- self.showAllRegions();
910
- }
911
- },
912
- navTo(query) {
913
- this.navToMultiple([query]);
914
- },
915
- navToMultiple(locations) {
916
- if (locations.some(l => l.start !== undefined && l.end !== undefined && l.start > l.end)) {
917
- throw new Error('found start greater than end');
918
- }
919
- const firstLocation = locations.at(0);
920
- const lastLocation = locations.at(-1);
921
- if (!firstLocation || !lastLocation) {
922
- return;
923
- }
924
- const defaultAssemblyName = self.assemblyNames[0];
925
- const { assemblyManager } = (0, util_1.getSession)(self);
926
- const firstAssembly = assemblyManager.get(firstLocation.assemblyName || defaultAssemblyName);
927
- const firstRefName = (firstAssembly === null || firstAssembly === void 0 ? void 0 : firstAssembly.getCanonicalRefName(firstLocation.refName)) ||
928
- firstLocation.refName;
929
- const firstRegion = self.displayedRegions.find(r => r.refName === firstRefName);
930
- const lastAssembly = assemblyManager.get(lastLocation.assemblyName || defaultAssemblyName);
931
- const lastRefName = (lastAssembly === null || lastAssembly === void 0 ? void 0 : lastAssembly.getCanonicalRefName(lastLocation.refName)) ||
932
- lastLocation.refName;
933
- const lastRegion = (0, util_1.findLast)(self.displayedRegions, r => r.refName === lastRefName);
934
- if (!firstRegion) {
935
- throw new Error(`could not find a region with refName "${firstRefName}"`);
936
- }
937
- if (!lastRegion) {
938
- throw new Error(`could not find a region with refName "${lastRefName}"`);
939
- }
940
- const firstStart = firstLocation.start === undefined
941
- ? firstRegion.start
942
- : firstLocation.start;
943
- const firstEnd = firstLocation.end === undefined ? firstRegion.end : firstLocation.end;
944
- const lastStart = lastLocation.start === undefined
945
- ? lastRegion.start
946
- : lastLocation.start;
947
- const lastEnd = lastLocation.end === undefined ? lastRegion.end : lastLocation.end;
948
- const firstIndex = self.displayedRegions.findIndex(r => firstRefName === r.refName &&
949
- firstStart >= r.start &&
950
- firstStart <= r.end &&
951
- firstEnd <= r.end &&
952
- firstEnd >= r.start);
953
- const lastIndex = self.displayedRegions.findIndex(r => lastRefName === r.refName &&
954
- lastStart >= r.start &&
955
- lastStart <= r.end &&
956
- lastEnd <= r.end &&
957
- lastEnd >= r.start);
958
- if (firstIndex === -1 || lastIndex === -1) {
959
- throw new Error(`could not find a region that contained "${locations.map(l => (0, util_1.assembleLocString)(l))}"`);
960
- }
961
- const startDisplayedRegion = self.displayedRegions[firstIndex];
962
- const endDisplayedRegion = self.displayedRegions[lastIndex];
963
- const startOffset = startDisplayedRegion.reversed
964
- ? startDisplayedRegion.end - firstEnd
965
- : firstStart - startDisplayedRegion.start;
966
- const endOffset = endDisplayedRegion.reversed
967
- ? endDisplayedRegion.end - lastStart
968
- : lastEnd - endDisplayedRegion.start;
969
- this.moveTo({
970
- index: firstIndex,
971
- offset: startOffset,
972
- }, {
973
- index: lastIndex,
974
- offset: endOffset,
975
- });
976
- },
977
- }))
978
- .views(self => ({
979
- rubberBandMenuItems() {
980
- return [
981
- {
982
- label: 'Zoom to region',
983
- icon: ZoomIn_1.default,
984
- onClick: () => {
985
- self.moveTo(self.leftOffset, self.rightOffset);
986
- },
987
- },
988
- {
989
- label: 'Get sequence',
990
- icon: MenuOpen_1.default,
991
- onClick: () => {
992
- (0, util_1.getSession)(self).queueDialog(handleClose => [
993
- GetSequenceDialog,
994
- { model: self, handleClose },
995
- ]);
996
- },
997
- },
998
- ];
999
- },
1000
- bpToPx({ refName, coord, regionNumber, }) {
1001
- return (0, Base1DUtils_1.bpToPx)({ refName, coord, regionNumber, self });
1002
- },
1003
- centerAt(coord, refName, regionNumber) {
1004
- const centerPx = this.bpToPx({
1005
- refName,
1006
- coord,
1007
- regionNumber,
1008
- });
1009
- if (centerPx !== undefined) {
1010
- self.scrollTo(Math.round(centerPx.offsetPx - self.width / 2));
1011
- }
1012
- },
1013
- pxToBp(px) {
1014
- return (0, Base1DUtils_1.pxToBp)(self, px);
1015
- },
1016
- get centerLineInfo() {
1017
- return self.displayedRegions.length > 0
1018
- ? this.pxToBp(self.width / 2)
1019
- : undefined;
1020
- },
1021
- }))
1022
- .actions(self => ({
1023
- afterCreate() {
1024
- function handler(e) {
1025
- const session = (0, util_1.getSession)(self);
1026
- if (session.focusedViewId === self.id && (e.ctrlKey || e.metaKey)) {
1027
- if (e.code === 'ArrowLeft') {
1028
- e.preventDefault();
1029
- self.slide(-0.9);
1030
- }
1031
- else if (e.code === 'ArrowRight') {
1032
- e.preventDefault();
1033
- self.slide(0.9);
1034
- }
1035
- else if (e.code === 'ArrowUp' && self.scaleFactor === 1) {
1036
- e.preventDefault();
1037
- self.zoom(self.bpPerPx / 2);
1038
- }
1039
- else if (e.code === 'ArrowDown' && self.scaleFactor === 1) {
1040
- e.preventDefault();
1041
- self.zoom(self.bpPerPx * 2);
1042
- }
1043
- }
1044
- }
1045
- document.addEventListener('keydown', handler);
1046
- (0, mobx_state_tree_1.addDisposer)(self, () => {
1047
- document.removeEventListener('keydown', handler);
1048
- });
1049
- },
1050
- afterAttach() {
1051
- (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
1052
- var _a;
1053
- const { init } = self;
1054
- if (init) {
1055
- self
1056
- .navToLocString(init.loc, init.assembly)
1057
- .catch((e) => {
1058
- console.error(init, e);
1059
- (0, util_1.getSession)(self).notifyError(`${e}`, e);
1060
- });
1061
- (_a = init.tracks) === null || _a === void 0 ? void 0 : _a.map(t => self.showTrack(t));
1062
- self.setInit(undefined);
1063
- }
1064
- }));
1065
- (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
1066
- if (self.initialized) {
1067
- self.setCoarseDynamicBlocks(self.dynamicBlocks);
1068
- }
1069
- }, { delay: 150 }));
1070
- (0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
1071
- const s = (s) => JSON.stringify(s);
1072
- const { showCytobandsSetting, showCenterLine, colorByCDS } = self;
1073
- (0, util_1.localStorageSetItem)('lgv-showCytobands', s(showCytobandsSetting));
1074
- (0, util_1.localStorageSetItem)('lgv-showCenterLine', s(showCenterLine));
1075
- (0, util_1.localStorageSetItem)('lgv-colorByCDS', s(colorByCDS));
1076
- }));
1077
- },
1078
- }))
1079
- .preProcessSnapshot(snap => {
1080
- if (!snap) {
1081
- return snap;
1082
- }
1083
- const { highlight, ...rest } = snap;
1084
- return {
1085
- highlight: Array.isArray(highlight) || highlight === undefined
1086
- ? highlight
1087
- : [highlight],
1088
- ...rest,
1089
- };
1090
- })
1091
- .postProcessSnapshot(snap => {
1092
- if (!snap) {
1093
- return snap;
1094
- }
1095
- else {
1096
- const { init, ...rest } = snap;
1097
- return rest;
1098
- }
1099
- });
1100
- }
1101
- var LinearGenomeView_1 = require("./components/LinearGenomeView");
1102
- Object.defineProperty(exports, "LinearGenomeView", { enumerable: true, get: function () { return __importDefault(LinearGenomeView_1).default; } });
1103
- Object.defineProperty(exports, "ReactComponent", { enumerable: true, get: function () { return __importDefault(LinearGenomeView_1).default; } });
1104
- var RefNameAutocomplete_1 = require("./components/RefNameAutocomplete");
1105
- Object.defineProperty(exports, "RefNameAutocomplete", { enumerable: true, get: function () { return __importDefault(RefNameAutocomplete_1).default; } });
1106
- var SearchBox_1 = require("./components/SearchBox");
1107
- Object.defineProperty(exports, "SearchBox", { enumerable: true, get: function () { return __importDefault(SearchBox_1).default; } });
1108
- var SVGLinearGenomeView_1 = require("./svgcomponents/SVGLinearGenomeView");
1109
- Object.defineProperty(exports, "renderToSvg", { enumerable: true, get: function () { return SVGLinearGenomeView_1.renderToSvg; } });