higlass 1.13.5 → 2.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/README.md +48 -54
  2. package/app/globals.d.ts +1 -1
  3. package/app/missing-types.d.ts +4 -1
  4. package/app/scripts/AddTrackDialog.jsx +11 -4
  5. package/app/scripts/AddTrackPositionMenu.jsx +28 -7
  6. package/app/scripts/Annotations1dTrack.js +90 -251
  7. package/app/scripts/Annotations2dTrack.js +12 -7
  8. package/app/scripts/Autocomplete.jsx +13 -28
  9. package/app/scripts/AxisPixi.js +6 -10
  10. package/app/scripts/BarTrack.js +3 -3
  11. package/app/scripts/BedLikeTrack.js +556 -449
  12. package/app/scripts/Button.jsx +1 -1
  13. package/app/scripts/CNVIntervalTrack.js +1 -1
  14. package/app/scripts/CenterTrack.jsx +8 -7
  15. package/app/scripts/Chromosome2DAnnotations.js +1 -1
  16. package/app/scripts/Chromosome2DLabels.js +1 -1
  17. package/app/scripts/ChromosomeGrid.js +49 -38
  18. package/app/scripts/ChromosomeInfo.js +1 -1
  19. package/app/scripts/CombinedTrack.js +3 -1
  20. package/app/scripts/ConfigTrackMenu.jsx +1 -1
  21. package/app/scripts/ConfigViewMenu.jsx +2 -2
  22. package/app/scripts/ContextMenuContainer.jsx +4 -2
  23. package/app/scripts/ContextMenuItem.jsx +14 -2
  24. package/app/scripts/CrossRule.js +1 -1
  25. package/app/scripts/CustomTrackDialog.jsx +2 -2
  26. package/app/scripts/Dialog.jsx +2 -2
  27. package/app/scripts/DragListeningDiv.jsx +1 -1
  28. package/app/scripts/DraggableDiv.jsx +2 -3
  29. package/app/scripts/ExportLinkDialog.jsx +1 -1
  30. package/app/scripts/FilledLine.js +349 -0
  31. package/app/scripts/GalleryTracks.jsx +77 -78
  32. package/app/scripts/GenomePositionSearchBox.jsx +184 -482
  33. package/app/scripts/HeatmapOptions.jsx +4 -2
  34. package/app/scripts/HeatmapTiledPixiTrack.js +23 -32
  35. package/app/scripts/HiGlassComponent.jsx +515 -444
  36. package/app/scripts/HiGlassComponentContext.js +5 -0
  37. package/app/scripts/Horizontal1dHeatmapTrack.js +1 -1
  38. package/app/scripts/Horizontal2DDomainsTrack.js +1 -1
  39. package/app/scripts/HorizontalChromosomeLabels.js +28 -22
  40. package/app/scripts/HorizontalGeneAnnotationsTrack.js +1 -1
  41. package/app/scripts/HorizontalHeatmapTrack.js +2 -2
  42. package/app/scripts/HorizontalMultivecTrack.js +6 -7
  43. package/app/scripts/HorizontalRule.js +1 -2
  44. package/app/scripts/HorizontalTiled1DPixiTrack.js +4 -4
  45. package/app/scripts/HorizontalTiledPlot.jsx +9 -9
  46. package/app/scripts/LeftTrackModifier.js +4 -0
  47. package/app/scripts/ListWrapper.jsx +1 -2
  48. package/app/scripts/MapboxTilesTrack.js +1 -2
  49. package/app/scripts/Modal.jsx +2 -2
  50. package/app/scripts/MoveableTrack.jsx +10 -12
  51. package/app/scripts/NestedContextMenu.jsx +2 -1
  52. package/app/scripts/OSMTileIdsTrack.js +1 -1
  53. package/app/scripts/OverlayTrack.js +4 -4
  54. package/app/scripts/PixiTrack.js +27 -13
  55. package/app/scripts/PlotTypeChooser.jsx +3 -4
  56. package/app/scripts/SearchField.js +5 -5
  57. package/app/scripts/SeriesListItems.jsx +3 -4
  58. package/app/scripts/SeriesListMenu.jsx +95 -53
  59. package/app/scripts/SeriesListSubmenuMixin.jsx +2 -1
  60. package/app/scripts/SketchInlinePicker.jsx +2 -2
  61. package/app/scripts/SortableList.jsx +1 -1
  62. package/app/scripts/Tiled1DPixiTrack.js +4 -1
  63. package/app/scripts/TiledPixiTrack.js +244 -102
  64. package/app/scripts/TiledPlot.jsx +565 -118
  65. package/app/scripts/TilesetFinder.jsx +12 -4
  66. package/app/scripts/Track.js +1 -1
  67. package/app/scripts/TrackArea.jsx +4 -0
  68. package/app/scripts/TrackControl.jsx +2 -2
  69. package/app/scripts/TrackRenderer.jsx +32 -33
  70. package/app/scripts/ValueIntervalTrack.js +1 -1
  71. package/app/scripts/VerticalRule.js +2 -2
  72. package/app/scripts/VerticalTiledPlot.jsx +7 -7
  73. package/app/scripts/ViewConfigEditor.jsx +1 -1
  74. package/app/scripts/ViewContextMenu.jsx +53 -5
  75. package/app/scripts/ViewHeader.jsx +9 -9
  76. package/app/scripts/ViewportTracker2D.js +1 -1
  77. package/app/scripts/api.js +92 -12
  78. package/app/scripts/configs/available-track-types.js +1 -1
  79. package/app/scripts/configs/index.js +6 -1
  80. package/app/scripts/configs/positions-by-datatype.js +2 -2
  81. package/app/scripts/configs/primitives.js +2 -0
  82. package/app/scripts/configs/themes.js +0 -1
  83. package/app/scripts/configs/tracks-info-by-type.js +11 -8
  84. package/app/scripts/configs/tracks-info.js +3 -2
  85. package/app/scripts/d3-context-menu.js +3 -4
  86. package/app/scripts/data-fetchers/DataFetcher.js +35 -36
  87. package/app/scripts/data-fetchers/genbank-fetcher.js +13 -22
  88. package/app/scripts/data-fetchers/local-tile-fetcher.js +10 -8
  89. package/app/scripts/hglib.jsx +62 -71
  90. package/app/scripts/hocs/with-modal.jsx +32 -10
  91. package/app/scripts/hocs/with-pub-sub.js +12 -3
  92. package/app/scripts/hocs/with-theme.jsx +21 -14
  93. package/app/scripts/icons.jsx +3 -2
  94. package/app/scripts/mixwith.js +2 -2
  95. package/app/scripts/options-info.js +49 -11
  96. package/app/scripts/plugins/get-data-fetcher.js +2 -3
  97. package/app/scripts/services/chrom-info.js +32 -4
  98. package/app/scripts/services/element-resize-listener.js +2 -2
  99. package/app/scripts/services/index.js +0 -1
  100. package/app/scripts/services/tile-proxy.js +368 -285
  101. package/app/scripts/services/worker.js +31 -28
  102. package/app/scripts/test-helpers/index.js +2 -1
  103. package/app/scripts/test-helpers/test-helpers.jsx +157 -69
  104. package/app/scripts/types.ts +118 -47
  105. package/app/scripts/utils/LruCache.js +3 -2
  106. package/app/scripts/utils/assert.js +19 -0
  107. package/app/scripts/utils/background-task-scheduler.js +2 -0
  108. package/app/scripts/utils/color-domain-to-rgba-array.js +13 -3
  109. package/app/scripts/utils/copy-text-to-clipboard.js +36 -0
  110. package/app/scripts/utils/decompress.js +33 -0
  111. package/app/scripts/utils/default-tracks.js +46 -0
  112. package/app/scripts/utils/dict-items.js +1 -0
  113. package/app/scripts/utils/dict-keys.js +1 -0
  114. package/app/scripts/utils/dict-values.js +1 -0
  115. package/app/scripts/utils/expand-combined-tracks.js +11 -7
  116. package/app/scripts/utils/fill-in-min-widths.js +47 -21
  117. package/app/scripts/utils/flatten.js +0 -1
  118. package/app/scripts/utils/get-aggregation-function.js +1 -1
  119. package/app/scripts/utils/get-default-track-for-datatype.js +37 -10
  120. package/app/scripts/utils/get-default-tracks-for-datatype.ts +46 -0
  121. package/app/scripts/utils/get-higlass-components.js +27 -3
  122. package/app/scripts/utils/get-track-position-by-uid.js +8 -1
  123. package/app/scripts/utils/get-xylofon.js +12 -9
  124. package/app/scripts/utils/has-parent.js +5 -5
  125. package/app/scripts/utils/hex-string-to-int.js +1 -1
  126. package/app/scripts/utils/index.js +1 -0
  127. package/app/scripts/utils/interval-tree.js +222 -177
  128. package/app/scripts/utils/load-chrom-infos.js +4 -1
  129. package/app/scripts/utils/pixi-text-to-svg.js +5 -9
  130. package/app/scripts/utils/positioned-tracks-to-all-tracks.js +55 -0
  131. package/app/scripts/utils/range-query-2d.js +3 -3
  132. package/app/scripts/utils/reduce.js +12 -5
  133. package/app/scripts/utils/segments-to-rows.js +14 -11
  134. package/app/scripts/utils/svg-line.js +7 -8
  135. package/app/scripts/utils/type-guards.js +16 -7
  136. package/app/scripts/utils/visit-positioned-tracks.js +9 -4
  137. package/app/styles/AddTrackPositionMenu.module.scss +37 -0
  138. package/app/styles/HiGlass.module.scss +3 -1
  139. package/app/styles/d3-context-menu.css +0 -1
  140. package/app/styles/prism.css +1 -0
  141. package/dist/app/schema.json +525 -0
  142. package/dist/app/scripts/AddTrackDialog.d.ts +64 -0
  143. package/dist/app/scripts/AddTrackPositionMenu.d.ts +5 -0
  144. package/dist/app/scripts/Annotations1dTrack.d.ts +15 -0
  145. package/dist/app/scripts/Annotations2dTrack.d.ts +95 -0
  146. package/dist/app/scripts/ArrowheadDomainsTrack.d.ts +36 -0
  147. package/dist/app/scripts/Autocomplete.d.ts +102 -0
  148. package/dist/app/scripts/AxisPixi.d.ts +25 -0
  149. package/dist/app/scripts/BarTrack.d.ts +28 -0
  150. package/dist/app/scripts/BedLikeTrack.d.ts +84 -0
  151. package/dist/app/scripts/Button.d.ts +3 -0
  152. package/dist/app/scripts/CNVIntervalTrack.d.ts +12 -0
  153. package/dist/app/scripts/CenterTiledPlot.d.ts +3 -0
  154. package/dist/app/scripts/CenterTrack.d.ts +92 -0
  155. package/dist/app/scripts/Chromosome2DAnnotations.d.ts +10 -0
  156. package/dist/app/scripts/Chromosome2DLabels.d.ts +13 -0
  157. package/dist/app/scripts/ChromosomeGrid.d.ts +24 -0
  158. package/dist/app/scripts/ChromosomeInfo.d.ts +14 -0
  159. package/dist/app/scripts/CloseTrackMenu.d.ts +10 -0
  160. package/dist/app/scripts/CombinedTrack.d.ts +32 -0
  161. package/dist/app/scripts/ConfigTrackMenu.d.ts +10 -0
  162. package/dist/app/scripts/ConfigViewMenu.d.ts +34 -0
  163. package/dist/app/scripts/ConfigureSeriesMenu.d.ts +3 -0
  164. package/dist/app/scripts/ContextMenuContainer.d.ts +36 -0
  165. package/dist/app/scripts/ContextMenuItem.d.ts +34 -0
  166. package/dist/app/scripts/Cross.d.ts +3 -0
  167. package/dist/app/scripts/CrossRule.d.ts +24 -0
  168. package/dist/app/scripts/CustomTrackDialog.d.ts +17 -0
  169. package/dist/app/scripts/Dialog.d.ts +5 -0
  170. package/dist/app/scripts/DivergentBarTrack.d.ts +4 -0
  171. package/dist/app/scripts/DragListeningDiv.d.ts +32 -0
  172. package/dist/app/scripts/DraggableDiv.d.ts +63 -0
  173. package/dist/app/scripts/ExportLinkDialog.d.ts +21 -0
  174. package/dist/app/scripts/FilledLine.d.ts +5 -0
  175. package/dist/app/scripts/FixedTrack.d.ts +5 -0
  176. package/dist/app/scripts/GalleryTracks.d.ts +20 -0
  177. package/dist/app/scripts/GenomePositionSearchBox.d.ts +95 -0
  178. package/dist/app/scripts/HeatmapOptions.d.ts +30 -0
  179. package/dist/app/scripts/HeatmapTiledPixiTrack.d.ts +184 -0
  180. package/dist/app/scripts/HiGlassComponent.d.ts +762 -0
  181. package/dist/app/scripts/HiGlassComponentContext.d.ts +3 -0
  182. package/dist/app/scripts/HiGlassTrackComponent.d.ts +37 -0
  183. package/dist/app/scripts/Horizontal1dHeatmapTrack.d.ts +9 -0
  184. package/dist/app/scripts/Horizontal2DDomainsTrack.d.ts +21 -0
  185. package/dist/app/scripts/HorizontalChromosomeLabels.d.ts +47 -0
  186. package/dist/app/scripts/HorizontalGeneAnnotationsTrack.d.ts +25 -0
  187. package/dist/app/scripts/HorizontalHeatmapTrack.d.ts +12 -0
  188. package/dist/app/scripts/HorizontalItem.d.ts +3 -0
  189. package/dist/app/scripts/HorizontalLine1DPixiTrack.d.ts +23 -0
  190. package/dist/app/scripts/HorizontalMultivecTrack.d.ts +50 -0
  191. package/dist/app/scripts/HorizontalPoint1DPixiTrack.d.ts +5 -0
  192. package/dist/app/scripts/HorizontalRule.d.ts +22 -0
  193. package/dist/app/scripts/HorizontalTiled1DPixiTrack.d.ts +26 -0
  194. package/dist/app/scripts/HorizontalTiledPlot.d.ts +49 -0
  195. package/dist/app/scripts/HorizontalTrack.d.ts +6 -0
  196. package/dist/app/scripts/Id2DTiledPixiTrack.d.ts +10 -0
  197. package/dist/app/scripts/IdHorizontal1DTiledPixiTrack.d.ts +6 -0
  198. package/dist/app/scripts/IdVertical1DTiledPixiTrack.d.ts +7 -0
  199. package/dist/app/scripts/LeftAxisTrack.d.ts +9 -0
  200. package/dist/app/scripts/LeftTrackModifier.d.ts +29 -0
  201. package/dist/app/scripts/ListWrapper.d.ts +64 -0
  202. package/dist/app/scripts/MapboxTilesTrack.d.ts +9 -0
  203. package/dist/app/scripts/Modal.d.ts +5 -0
  204. package/dist/app/scripts/MoveableTrack.d.ts +18 -0
  205. package/dist/app/scripts/NestedContextMenu.d.ts +7 -0
  206. package/dist/app/scripts/OSMTileIdsTrack.d.ts +5 -0
  207. package/dist/app/scripts/OSMTilesTrack.d.ts +129 -0
  208. package/dist/app/scripts/OverlayTrack.d.ts +13 -0
  209. package/dist/app/scripts/PixiTrack.d.ts +174 -0
  210. package/dist/app/scripts/PlotTypeChooser.d.ts +25 -0
  211. package/dist/app/scripts/PopupMenu.d.ts +28 -0
  212. package/dist/app/scripts/RasterTilesTrack.d.ts +9 -0
  213. package/dist/app/scripts/RuleMixin.d.ts +2 -0
  214. package/dist/app/scripts/SVGTrack.d.ts +15 -0
  215. package/dist/app/scripts/SearchField.d.ts +13 -0
  216. package/dist/app/scripts/SeriesListItems.d.ts +2 -0
  217. package/dist/app/scripts/SeriesListMenu.d.ts +51 -0
  218. package/dist/app/scripts/SeriesListSubmenuMixin.d.ts +2 -0
  219. package/dist/app/scripts/SketchInlinePicker.d.ts +25 -0
  220. package/dist/app/scripts/SortableList.d.ts +22 -0
  221. package/dist/app/scripts/SquareMarkersTrack.d.ts +22 -0
  222. package/dist/app/scripts/Tiled1DPixiTrack.d.ts +60 -0
  223. package/dist/app/scripts/TiledPixiTrack.d.ts +369 -0
  224. package/dist/app/scripts/TiledPlot.d.ts +313 -0
  225. package/dist/app/scripts/TilesetFinder.d.ts +65 -0
  226. package/dist/app/scripts/TopAxisTrack.d.ts +9 -0
  227. package/dist/app/scripts/Track.d.ts +196 -0
  228. package/dist/app/scripts/TrackArea.d.ts +26 -0
  229. package/dist/app/scripts/TrackControl.d.ts +5 -0
  230. package/dist/app/scripts/TrackRenderer.d.ts +724 -0
  231. package/dist/app/scripts/UnknownPixiTrack.d.ts +7 -0
  232. package/dist/app/scripts/ValueIntervalTrack.d.ts +6 -0
  233. package/dist/app/scripts/VerticalItem.d.ts +3 -0
  234. package/dist/app/scripts/VerticalRule.d.ts +21 -0
  235. package/dist/app/scripts/VerticalTiled1DPixiTrack.d.ts +6 -0
  236. package/dist/app/scripts/VerticalTiledPlot.d.ts +50 -0
  237. package/dist/app/scripts/VerticalTrack.d.ts +6 -0
  238. package/dist/app/scripts/ViewConfigEditor.d.ts +53 -0
  239. package/dist/app/scripts/ViewContextMenu.d.ts +17 -0
  240. package/dist/app/scripts/ViewHeader.d.ts +75 -0
  241. package/dist/app/scripts/ViewportTracker2D.d.ts +17 -0
  242. package/dist/app/scripts/ViewportTracker2DPixi.d.ts +11 -0
  243. package/dist/app/scripts/ViewportTrackerHorizontal.d.ts +17 -0
  244. package/dist/app/scripts/ViewportTrackerVertical.d.ts +17 -0
  245. package/dist/app/scripts/api.d.ts +640 -0
  246. package/dist/app/scripts/configs/available-track-types.d.ts +2 -0
  247. package/dist/app/scripts/configs/colormaps.d.ts +2 -0
  248. package/dist/app/scripts/configs/datatype-to-track-type.d.ts +4 -0
  249. package/dist/app/scripts/configs/default-tracks-for-datatype.d.ts +38 -0
  250. package/dist/app/scripts/configs/dense-data-extrema-config.d.ts +2 -0
  251. package/dist/app/scripts/configs/globals.d.ts +5 -0
  252. package/dist/app/scripts/configs/index.d.ts +16 -0
  253. package/dist/app/scripts/configs/positions-by-datatype.d.ts +2 -0
  254. package/dist/app/scripts/configs/primitives.d.ts +20 -0
  255. package/dist/app/scripts/configs/themes.d.ts +3 -0
  256. package/dist/app/scripts/configs/tracks-info-by-type.d.ts +4 -0
  257. package/dist/app/scripts/configs/tracks-info.d.ts +24 -0
  258. package/dist/app/scripts/d3-context-menu.d.ts +2 -0
  259. package/dist/app/scripts/data-fetchers/DataFetcher.d.ts +151 -0
  260. package/dist/app/scripts/data-fetchers/genbank-fetcher.d.ts +86 -0
  261. package/dist/app/scripts/data-fetchers/index.d.ts +3 -0
  262. package/dist/app/scripts/data-fetchers/local-tile-fetcher.d.ts +47 -0
  263. package/dist/app/scripts/gosling-exports.d.ts +17 -0
  264. package/dist/app/scripts/hglib.d.ts +24 -0
  265. package/dist/app/scripts/hocs/with-modal.d.ts +19 -0
  266. package/dist/app/scripts/hocs/with-pub-sub.d.ts +22 -0
  267. package/dist/app/scripts/hocs/with-theme.d.ts +13 -0
  268. package/dist/app/scripts/icons.d.ts +161 -0
  269. package/dist/app/scripts/mixwith.d.ts +27 -0
  270. package/dist/app/scripts/options-info.d.ts +1355 -0
  271. package/dist/app/scripts/plugins/available-for-plugins.d.ts +2338 -0
  272. package/dist/app/scripts/plugins/get-data-fetcher.d.ts +2 -0
  273. package/dist/app/scripts/plugins/index.d.ts +2 -0
  274. package/dist/app/scripts/services/chrom-info.d.ts +10 -0
  275. package/dist/app/scripts/services/dom-event.d.ts +7 -0
  276. package/dist/app/scripts/services/element-resize-listener.d.ts +5 -0
  277. package/dist/app/scripts/services/index.d.ts +5 -0
  278. package/dist/app/scripts/services/tile-proxy.d.ts +180 -0
  279. package/dist/app/scripts/services/worker.d.ts +157 -0
  280. package/dist/app/scripts/symbol.d.ts +13 -0
  281. package/dist/app/scripts/test-helpers/index.d.ts +1 -0
  282. package/dist/app/scripts/test-helpers/test-helpers.d.ts +33 -0
  283. package/dist/app/scripts/track-utils.d.ts +73 -0
  284. package/dist/app/scripts/types.d.ts +199 -0
  285. package/dist/app/scripts/utils/DenseDataExtrema1D.d.ts +88 -0
  286. package/dist/app/scripts/utils/DenseDataExtrema2D.d.ts +97 -0
  287. package/dist/app/scripts/utils/LruCache.d.ts +44 -0
  288. package/dist/app/scripts/utils/abs-to-chr.d.ts +14 -0
  289. package/dist/app/scripts/utils/accessor-transposition.d.ts +14 -0
  290. package/dist/app/scripts/utils/add-arrays.d.ts +18 -0
  291. package/dist/app/scripts/utils/add-class.d.ts +8 -0
  292. package/dist/app/scripts/utils/add-event-listener-once.d.ts +11 -0
  293. package/dist/app/scripts/utils/assert.d.ts +17 -0
  294. package/dist/app/scripts/utils/background-task-scheduler.d.ts +47 -0
  295. package/dist/app/scripts/utils/base64-to-canvas.d.ts +9 -0
  296. package/dist/app/scripts/utils/chr-to-abs.d.ts +10 -0
  297. package/dist/app/scripts/utils/chrom-info-bisector.d.ts +4 -0
  298. package/dist/app/scripts/utils/clone-event.d.ts +12 -0
  299. package/dist/app/scripts/utils/color-domain-to-rgba-array.d.ts +13 -0
  300. package/dist/app/scripts/utils/color-to-hex.d.ts +9 -0
  301. package/dist/app/scripts/utils/color-to-rgba.d.ts +9 -0
  302. package/dist/app/scripts/utils/copy-text-to-clipboard.d.ts +2 -0
  303. package/dist/app/scripts/utils/data-to-genomic-loci.d.ts +11 -0
  304. package/dist/app/scripts/utils/debounce.d.ts +5 -0
  305. package/dist/app/scripts/utils/dec-to-hex-str.d.ts +8 -0
  306. package/dist/app/scripts/utils/decompress.d.ts +27 -0
  307. package/dist/app/scripts/utils/default-tracks.d.ts +3 -0
  308. package/dist/app/scripts/utils/dict-from-tuples.d.ts +11 -0
  309. package/dist/app/scripts/utils/dict-items.d.ts +18 -0
  310. package/dist/app/scripts/utils/dict-keys.d.ts +10 -0
  311. package/dist/app/scripts/utils/dict-values.d.ts +8 -0
  312. package/dist/app/scripts/utils/download.d.ts +7 -0
  313. package/dist/app/scripts/utils/expand-combined-tracks.d.ts +11 -0
  314. package/dist/app/scripts/utils/fake-pub-sub.d.ts +11 -0
  315. package/dist/app/scripts/utils/fill-in-min-widths.d.ts +44 -0
  316. package/dist/app/scripts/utils/flatten.d.ts +9 -0
  317. package/dist/app/scripts/utils/for-each.d.ts +9 -0
  318. package/dist/app/scripts/utils/forward-event.d.ts +7 -0
  319. package/dist/app/scripts/utils/genome-loci-to-pixels.d.ts +9 -0
  320. package/dist/app/scripts/utils/genomic-range-to-chromosome-chunks.d.ts +21 -0
  321. package/dist/app/scripts/utils/get-aggregation-function.d.ts +10 -0
  322. package/dist/app/scripts/utils/get-default-track-for-datatype.d.ts +21 -0
  323. package/dist/app/scripts/utils/get-default-tracks-for-datatype.d.ts +3 -0
  324. package/dist/app/scripts/utils/get-element-dim.d.ts +7 -0
  325. package/dist/app/scripts/utils/get-higlass-components.d.ts +7 -0
  326. package/dist/app/scripts/utils/get-track-by-uid.d.ts +7 -0
  327. package/dist/app/scripts/utils/get-track-conf-from-hgc.d.ts +10 -0
  328. package/dist/app/scripts/utils/get-track-obj-by-id.d.ts +2 -0
  329. package/dist/app/scripts/utils/get-track-position-by-uid.d.ts +13 -0
  330. package/dist/app/scripts/utils/get-xylofon.d.ts +2 -0
  331. package/dist/app/scripts/utils/gradient.d.ts +14 -0
  332. package/dist/app/scripts/utils/has-class.d.ts +8 -0
  333. package/dist/app/scripts/utils/has-parent.d.ts +9 -0
  334. package/dist/app/scripts/utils/hex-string-to-int.d.ts +14 -0
  335. package/dist/app/scripts/utils/index.d.ts +89 -0
  336. package/dist/app/scripts/utils/interval-tree.d.ts +109 -0
  337. package/dist/app/scripts/utils/into-the-void.d.ts +6 -0
  338. package/dist/app/scripts/utils/is-track-or-child-track.d.ts +7 -0
  339. package/dist/app/scripts/utils/is-track-range-selectable.d.ts +2 -0
  340. package/dist/app/scripts/utils/is-within.d.ts +12 -0
  341. package/dist/app/scripts/utils/lat-to-y.d.ts +9 -0
  342. package/dist/app/scripts/utils/lng-to-x.d.ts +8 -0
  343. package/dist/app/scripts/utils/load-chrom-infos.d.ts +8 -0
  344. package/dist/app/scripts/utils/map.d.ts +13 -0
  345. package/dist/app/scripts/utils/max-non-zero.d.ts +6 -0
  346. package/dist/app/scripts/utils/max.d.ts +10 -0
  347. package/dist/app/scripts/utils/min-non-zero.d.ts +6 -0
  348. package/dist/app/scripts/utils/min.d.ts +10 -0
  349. package/dist/app/scripts/utils/mod.d.ts +9 -0
  350. package/dist/app/scripts/utils/ndarray-assign.d.ts +2 -0
  351. package/dist/app/scripts/utils/ndarray-flatten.d.ts +2 -0
  352. package/dist/app/scripts/utils/ndarray-to-list.d.ts +2 -0
  353. package/dist/app/scripts/utils/numericify-version.d.ts +6 -0
  354. package/dist/app/scripts/utils/obj-vals.d.ts +8 -0
  355. package/dist/app/scripts/utils/or.d.ts +8 -0
  356. package/dist/app/scripts/utils/parse-chromsizes-rows.d.ts +34 -0
  357. package/dist/app/scripts/utils/pixi-text-to-svg.d.ts +2 -0
  358. package/dist/app/scripts/utils/positioned-tracks-to-all-tracks.d.ts +26 -0
  359. package/dist/app/scripts/utils/q.d.ts +18 -0
  360. package/dist/app/scripts/utils/rad-to-deg.d.ts +7 -0
  361. package/dist/app/scripts/utils/range-query-2d.d.ts +17 -0
  362. package/dist/app/scripts/utils/reduce.d.ts +14 -0
  363. package/dist/app/scripts/utils/rel-to-abs-chrom-pos.d.ts +10 -0
  364. package/dist/app/scripts/utils/remove-class.d.ts +7 -0
  365. package/dist/app/scripts/utils/reset-d3-brush-style.d.ts +10 -0
  366. package/dist/app/scripts/utils/rgb-to-hex.d.ts +8 -0
  367. package/dist/app/scripts/utils/scales-center-and-k.d.ts +12 -0
  368. package/dist/app/scripts/utils/scales-to-genome-loci.d.ts +3 -0
  369. package/dist/app/scripts/utils/segments-to-rows.d.ts +15 -0
  370. package/dist/app/scripts/utils/selected-items-to-cum-weights.d.ts +12 -0
  371. package/dist/app/scripts/utils/selected-items-to-size.d.ts +13 -0
  372. package/dist/app/scripts/utils/show-mouse-position.d.ts +54 -0
  373. package/dist/app/scripts/utils/some.d.ts +10 -0
  374. package/dist/app/scripts/utils/sum.d.ts +8 -0
  375. package/dist/app/scripts/utils/svg-line.d.ts +2 -0
  376. package/dist/app/scripts/utils/throttle-and-debounce.d.ts +33 -0
  377. package/dist/app/scripts/utils/tile-to-canvas.d.ts +9 -0
  378. package/dist/app/scripts/utils/timeout.d.ts +3 -0
  379. package/dist/app/scripts/utils/to-void.d.ts +3 -0
  380. package/dist/app/scripts/utils/total-track-pixel-height.d.ts +27 -0
  381. package/dist/app/scripts/utils/trim-trailing-slash.d.ts +7 -0
  382. package/dist/app/scripts/utils/type-guards.d.ts +36 -0
  383. package/dist/app/scripts/utils/value-to-color.d.ts +12 -0
  384. package/dist/app/scripts/utils/visit-positioned-tracks.d.ts +18 -0
  385. package/dist/app/scripts/utils/visit-tracks.d.ts +9 -0
  386. package/dist/esm.html +1 -3
  387. package/dist/hglib.js +86315 -100592
  388. package/dist/hglib.min.js +123 -131
  389. package/dist/higlass.mjs +88861 -103138
  390. package/dist/index.html +1 -3
  391. package/dist/package.json +134 -0
  392. package/package.json +25 -27
package/README.md CHANGED
@@ -7,20 +7,31 @@
7
7
 
8
8
  ### Introduction
9
9
 
10
- HiGlass is a web-based viewer for datasets too large to view at once.
11
- It features synchronized navigation of multiple views as well as continuous zooming and panning
12
- for navigation across genomic loci and resolutions. It supports visual comparison of
13
- genomic (e.g., Hi-C, ChIP-seq, or bed annotations) and other data (e.g., geographic maps, gigapixel images, or abstract 1D and 2D sequential data) from different experimental conditions and can be used to efficiently
14
- identify salient outcomes of experimental perturbations, generate new hypotheses, and share
15
- the results with the community.
16
-
17
- A live instance can be found at [https://higlass.io](https://higlass.io). A [Docker container](https://github.com/higlass/higlass-docker) is available for running an instance locally, although we recommend using the [higlass-manage](https://github.com/pkerpedjiev/higlass-manage) package to start, stop and configure local instances.
18
-
19
- For documentation about how to use and install HiGlass, please visit [https://docs.higlass.io](https://docs.higlass.io).
10
+ HiGlass is a web-based viewer for datasets too large to view at once. It
11
+ features synchronized navigation of multiple views as well as continuous
12
+ zooming and panning for navigation across genomic loci and resolutions. It
13
+ supports visual comparison of genomic (e.g., Hi-C, ChIP-seq, or bed
14
+ annotations) and other data (e.g., geographic maps, gigapixel images, or
15
+ abstract 1D and 2D sequential data) from different experimental conditions and
16
+ can be used to efficiently identify salient outcomes of experimental
17
+ perturbations, generate new hypotheses, and share the results with the
18
+ community.
19
+
20
+ A live instance can be found at [https://higlass.io](https://higlass.io). A
21
+ [Docker container](https://github.com/higlass/higlass-docker) is available for
22
+ running an instance locally, although we recommend using the
23
+ [higlass-manage](https://github.com/pkerpedjiev/higlass-manage) package to
24
+ start, stop and configure local instances.
25
+
26
+ For documentation about how to use and install HiGlass, please visit
27
+ [https://docs.higlass.io](https://docs.higlass.io).
20
28
 
21
29
  ### Citation
22
30
 
23
- Kerpedjiev, P., Abdennur, N., Lekschas, F., McCallum, C., Dinkla, K., Strobelt, H., ... & Gehlenborg, N. *HiGlass: Web-based Visual Exploration and Analysis of Genome Interaction Maps.* Genome Biology (2018): 19:125. https://doi.org/10.1186/s13059-018-1486-1
31
+ Kerpedjiev, P., Abdennur, N., Lekschas, F., McCallum, C., Dinkla, K., Strobelt,
32
+ H., ... & Gehlenborg, N. *HiGlass: Web-based Visual Exploration and Analysis of
33
+ Genome Interaction Maps.* Genome Biology (2018): 19:125.
34
+ https://doi.org/10.1186/s13059-018-1486-1
24
35
 
25
36
  ### Example
26
37
 
@@ -34,7 +45,7 @@ To run higlass from its source code simply run the following:
34
45
 
35
46
  ```
36
47
  npm clean-install // use --legacy-peer-deps if you get peer dependency errors
37
- npm run start
48
+ npm start
38
49
  ```
39
50
 
40
51
  This starts a server in development mode at http://localhost:5173/.
@@ -44,26 +55,16 @@ This starts a server in development mode at http://localhost:5173/.
44
55
  > Once started, a list of the examples can be found at [http://localhost:8080/examples.html](http://localhost:8080/examples.html).
45
56
  > Template viewconfs located at `/docs/examples/viewconfs` can viewed directly at urls such as [http://localhost:8080/apis/svg.html?/viewconfs/overlay-tracks.json](http://localhost:8080/apis/svg.html?/viewconfs/overlay-tracks.json).
46
57
 
47
-
48
58
  ### Tests
49
59
 
50
- The tests for the React components and API functions are located in the `test` directory.
51
- Tests are run with [`web-test-runner`](https://modern-web.dev/docs/test-runner/overview/), which you can learn more about the CLI in the [documentation](https://modern-web.dev/docs/test-runner/cli-and-configuration/#test-runner-cli-and-configuration).
60
+ The tests for the React components and API functions are located in the `test`
61
+ directory. Tests are run with [`vitest`](https://vitest.dev/).
52
62
 
53
63
  Useful commands:
54
64
 
55
- - Run all tests: `npm test`
56
- - Run all tests in interactive "watch" mode: `npm test -- --watch`
57
- - Run a specific test or "glob" of tests: `npm test -- test/APITests.js [--watch]`
58
- - Manually run individual tests in an open browser window: `npm test -- --manual`
59
-
60
- **Troubleshooting:**
61
-
62
- - If the installation fails due to `sharp` > `node-gyp` try installing the node packages using `python2`:
65
+ - Run all tests in the browser: `npm test -- --browser.headless=false`
63
66
 
64
- ```
65
- npm ci --python=/usr/bin/python2 && rm -rf node_modules/node-sass && npm ci
66
- ```
67
+ See the [contributing guide](./CONTRIBUTING.md) to learn more.
67
68
 
68
69
  ### API
69
70
 
@@ -71,34 +72,27 @@ HiGlass provides an API for controlling the component from with JavaScript. Belo
71
72
 
72
73
  ```html
73
74
  <!DOCTYPE html>
74
- <head>
75
- <meta charset="utf-8">
76
- <title>Minimal Working Example &middot; HiGlass</title>
77
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
78
- <link rel="stylesheet" href="https://unpkg.com/higlass@1.6.6/dist/hglib.css">
79
-
80
- <style type="text/css">
81
- html, body {
82
- width: 100vw;
83
- height: 100vh;
84
- overflow: hidden;
85
- }
86
- </style>
87
-
88
- <script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
89
- <script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
90
- <script crossorigin src="https://unpkg.com/pixi.js@5/dist/pixi.min.js"></script>
91
- <script crossorigin src="https://unpkg.com/react-bootstrap@0.32.1/dist/react-bootstrap.min.js"></script>
92
- <script crossorigin src="https://unpkg.com/higlass@1.6.6/dist/hglib.min.js"></script>
93
- </head>
94
- <body></body>
95
- <script>
96
- const hgApi = window.hglib.viewer(
97
- document.body,
98
- 'https://higlass.io/api/v1/viewconfs/?d=default',
99
- { bounded: true },
100
- );
101
- </script>
75
+ <head>
76
+ <meta charset="utf-8">
77
+ <title>Minimal Working Example &middot; HiGlass</title>
78
+ <style type="text/css">
79
+ html, body {
80
+ width: 100vw;
81
+ height: 100vh;
82
+ overflow: hidden;
83
+ }
84
+ </style>
85
+ </head>
86
+ <body></body>
87
+ <script type="module">
88
+ import * as hglib from "https://esm.sh/higlass@1.13";
89
+
90
+ const api = hglib.viewer(
91
+ document.body,
92
+ 'https://higlass.io/api/v1/viewconfs/?d=default',
93
+ { bounded: true },
94
+ );
95
+ </script>
102
96
  </html>
103
97
  ```
104
98
 
package/app/globals.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export {};
2
- /* eslint-disable */
2
+
3
3
  declare global {
4
4
  interface Window {
5
5
  higlassTracksByType?: {
@@ -1,9 +1,10 @@
1
- /* eslint-disable */
2
1
  // https://www.npmjs.com/package/pub-sub-es
3
2
  declare module 'pub-sub-es' {
3
+ // biome-ignore lint/suspicious/noExplicitAny: Inherited API
4
4
  type EventMap = { [name: string]: any };
5
5
  export type Subscription = {
6
6
  event: string;
7
+ // biome-ignore lint/suspicious/noExplicitAny: Inherited API
7
8
  handler: (news: any) => void;
8
9
  };
9
10
  type PublishOptions = {
@@ -11,7 +12,9 @@ declare module 'pub-sub-es' {
11
12
  isNoGlobalBroadCast?: boolean;
12
13
  };
13
14
  export type PubSub = {
15
+ // biome-ignore lint/suspicious/noExplicitAny: Inherited API
14
16
  publish(event: string, news?: any, options?: PublishOptions): void;
17
+ // biome-ignore lint/suspicious/noExplicitAny: Inherited API
15
18
  subscribe(event: string, handler: (news: any) => void): Subscription;
16
19
  unsubscribe(subscription: Subscription): void;
17
20
  clear(): void;
@@ -1,10 +1,10 @@
1
1
  // @ts-nocheck
2
- import React from 'react';
3
2
  import PropTypes from 'prop-types';
3
+ import React from 'react';
4
4
 
5
5
  import Dialog from './Dialog';
6
- import TilesetFinder from './TilesetFinder';
7
6
  import PlotTypeChooser from './PlotTypeChooser';
7
+ import TilesetFinder from './TilesetFinder';
8
8
 
9
9
  // Configs
10
10
  import { AVAILABLE_TRACK_TYPES } from './configs';
@@ -15,7 +15,7 @@ import { getDefaultTrackForDatatype } from './utils';
15
15
  // Styles
16
16
  import '../styles/AddTrackDialog.module.scss';
17
17
 
18
- class AddTrackDialog extends React.Component {
18
+ export class AddTrackDialog extends React.Component {
19
19
  constructor(props) {
20
20
  super(props);
21
21
 
@@ -67,6 +67,7 @@ class AddTrackDialog extends React.Component {
67
67
  this.props.onTracksChosen(
68
68
  this.state.selectedTilesets,
69
69
  this.props.position,
70
+ this.props.extent,
70
71
  this.props.host,
71
72
  );
72
73
  }
@@ -86,6 +87,7 @@ class AddTrackDialog extends React.Component {
86
87
  this.props.onTracksChosen(
87
88
  this.state.selectedTilesets,
88
89
  this.props.position,
90
+ this.props.extent,
89
91
  this.props.host,
90
92
  );
91
93
  }
@@ -172,7 +174,11 @@ class AddTrackDialog extends React.Component {
172
174
  datatype={this.props.datatype}
173
175
  onDoubleClick={this.handleTilesetPickerDoubleClick.bind(this)}
174
176
  onTracksChosen={(value) =>
175
- this.props.onTracksChosen(value, this.props.position)
177
+ this.props.onTracksChosen(
178
+ value,
179
+ this.props.position,
180
+ this.props.extent,
181
+ )
176
182
  }
177
183
  orientation={orientation}
178
184
  selectedTilesetChanged={this.selectedTilesetsChanged.bind(this)}
@@ -223,6 +229,7 @@ AddTrackDialog.defaultProps = {
223
229
 
224
230
  AddTrackDialog.propTypes = {
225
231
  datatype: PropTypes.string,
232
+ extent: PropTypes.string,
226
233
  host: PropTypes.string,
227
234
  onCancel: PropTypes.func.isRequired,
228
235
  onTracksChosen: PropTypes.func.isRequired,
@@ -1,10 +1,10 @@
1
1
  // @ts-nocheck
2
+ import clsx from 'clsx';
2
3
  import PropTypes from 'prop-types';
3
4
  import React from 'react';
4
- import clsx from 'clsx';
5
5
 
6
- import withTheme from './hocs/with-theme';
7
6
  import { THEME_DARK } from './configs';
7
+ import withTheme from './hocs/with-theme';
8
8
 
9
9
  import classes from '../styles/AddTrackPositionMenu.module.scss';
10
10
 
@@ -42,11 +42,32 @@ function AddTrackPositionMenu(props) {
42
42
  >
43
43
  left
44
44
  </td>
45
- <td
46
- className={classes['add-track-position-middle-middle']}
47
- onClick={() => props.onTrackPositionChosen('center')}
48
- >
49
- center
45
+ <td className={classes['add-track-position-middle-middle']}>
46
+ <span
47
+ onClick={() => props.onTrackPositionChosen('center')}
48
+ className={classes['add-track-position-middle-middle-full']}
49
+ data-testid="add-track-center"
50
+ >
51
+ center
52
+ </span>
53
+ <span
54
+ onClick={() =>
55
+ props.onTrackPositionChosen('center', 'upper-right')
56
+ }
57
+ className={
58
+ classes['add-track-position-middle-middle-upper-right']
59
+ }
60
+ data-testid="add-track-upper-right"
61
+ />
62
+ <span
63
+ onClick={() =>
64
+ props.onTrackPositionChosen('center', 'lower-left')
65
+ }
66
+ className={
67
+ classes['add-track-position-middle-middle-lower-left']
68
+ }
69
+ data-testid="add-track-lower-left"
70
+ />
50
71
  </td>
51
72
  <td
52
73
  className={classes['add-track-position-middle-right']}
@@ -1,271 +1,110 @@
1
1
  // @ts-nocheck
2
- import { color } from 'd3-color';
3
- import PixiTrack from './PixiTrack';
2
+ import polygonArea from 'area-polygon';
3
+ import classifyPoint from 'robust-point-in-polygon';
4
+
5
+ import BedLikeTrack, { polyToPoly } from './BedLikeTrack';
6
+
7
+ /** Find out which rects are under a point.
8
+ *
9
+ * @param {track} The track object
10
+ * @param {x} x position to check (relative to track)
11
+ * @param {y} y position to check (relative to track)
12
+ * @return {[]} An array of drawnRects that are under that point
13
+ */
14
+ export const rectsAtPoint = (track, x, y) => {
15
+ const drawnRects = Object.values(track.drawnRects);
16
+ const point = [x, y];
17
+ const payloads = [];
18
+ const g = track.rectGraphics;
19
+
20
+ for (const drawnRect of drawnRects) {
21
+ // copy the rect because polyToPoly is destructive
22
+ const rect = drawnRect[0].slice(0);
23
+
24
+ const poly = polyToPoly(
25
+ rect,
26
+ g.scale.x,
27
+ g.position.x,
28
+ g.scale.y,
29
+ g.position.y,
30
+ );
31
+ const area = polygonArea(poly);
32
+
33
+ if (classifyPoint(poly, point) === -1) {
34
+ const payload = drawnRect[1];
35
+ payload.area = area;
36
+
37
+ payloads.push(payload);
38
+ }
39
+ }
4
40
 
5
- // Maximum delay in ms between mousedown and mouseup that is registered as a
6
- // click. Note we need to use mousedown and mouseup as PIXI doesn't recognize
7
- // click events with out current setup. Since most UIs treat long clicks as
8
- // either something special or a cancelation we follow best practices and
9
- // implement a threshold on the delay as well.
10
- import { GLOBALS, MAX_CLICK_DELAY } from './configs';
41
+ return payloads;
42
+ };
11
43
 
12
- class Annotations1dTrack extends PixiTrack {
44
+ class Annotations1dTrack extends BedLikeTrack {
13
45
  constructor(context, options, isVertical) {
14
46
  super(context, options);
15
-
16
- this.pubSub = context.pubSub;
17
- this.options = options;
18
- this.isVertical = isVertical;
19
-
20
- this.rects = {};
21
-
22
- this.defaultColor = color('red');
23
47
  }
24
48
 
25
- draw() {
26
- const globalMinRectWidth =
27
- typeof this.options.minRectWidth !== 'undefined'
28
- ? this.options.minRectWidth
29
- : 10;
30
-
31
- const globalFill =
32
- typeof this.options.fill !== 'undefined'
33
- ? color(this.options.fill)
34
- : this.defaultColor;
35
-
36
- const globalFillOpacity =
37
- typeof this.options.fillOpacity !== 'undefined'
38
- ? +this.options.fillOpacity
39
- : 0.2;
40
-
41
- const globalStroke =
42
- typeof this.options.stroke !== 'undefined'
43
- ? color(this.options.stroke)
44
- : this.defaultColor;
45
-
46
- const globalStrokeWidth =
47
- typeof this.options.strokeWidth !== 'undefined'
48
- ? +this.options.strokeWidth
49
- : 1;
50
-
51
- const globalStrokeOpacity =
52
- typeof this.options.strokeOpacity !== 'undefined'
53
- ? +this.options.strokeOpacity
54
- : 0;
55
-
56
- let strokePos;
57
- if (this.options.strokePos && this.options.strokePos.length) {
58
- strokePos = Array.isArray(this.options.strokePos)
59
- ? this.options.strokePos
60
- : [this.options.strokePos];
49
+ rerender(options, force) {
50
+ if (options && options.projectUid !== this.options.projectUid) {
51
+ // we're filtering by a new project id so we have to
52
+ // re-fetch the tiles
53
+ this.options = options;
54
+ this.fetchedTiles = {};
55
+ this.refreshTiles();
56
+ return;
61
57
  }
62
58
 
63
- super.draw();
64
- const graphics = this.pMain;
65
- graphics.clear();
66
-
67
- // The time stamp is used to keep track which rectangles have been drawn per
68
- // draw call. Each rectangle previously drawn that is not visible anymore
69
- // (i.e., is not drawn in the current draw call) will be removed at the end
70
- // by checking against the time stamp.
71
- const timeStamp = performance.now();
72
-
73
- // Regions have to follow the following form:
74
- // start, end, fill, stroke, fillOpacity, strokeOpcaity, min-size
75
- // If `color-line` is not given, `color-fill` is used
76
- this.options.regions.forEach((region) => {
77
- const id = `${region[0]}-${region[1]}`;
78
-
79
- if (!this.rects[id]) {
80
- this.rects[id] = { graphics: new GLOBALS.PIXI.Graphics() };
81
- graphics.addChild(this.rects[id].graphics);
82
- }
83
-
84
- this.rects[id].timeStamp = timeStamp;
85
-
86
- const fill = color(region[2]) || globalFill;
87
- let stroke = color(region[3]) || globalStroke;
88
-
89
- if (!stroke) {
90
- stroke = fill;
91
- }
92
-
93
- const fillHex = GLOBALS.PIXI.utils.rgb2hex([
94
- fill.r / 255.0,
95
- fill.g / 255.0,
96
- fill.b / 255.0,
97
- ]);
98
- const strokeHex = GLOBALS.PIXI.utils.rgb2hex([
99
- stroke.r / 255.0,
100
- stroke.g / 255.0,
101
- stroke.b / 255.0,
102
- ]);
103
-
104
- if (strokePos) {
105
- graphics.lineStyle(1, strokeHex, 0);
106
- graphics.beginFill(strokeHex, +region[5] || globalStrokeOpacity);
107
- } else {
108
- graphics.lineStyle(
109
- globalStrokeWidth,
110
- strokeHex,
111
- +region[5] || globalStrokeOpacity,
112
- );
113
- graphics.beginFill(fillHex, +region[4] || globalFillOpacity);
114
- }
115
-
116
- const scale = this.isVertical ? this._yScale : this._xScale;
117
-
118
- let start = scale(+region[0]);
119
- const end = scale(+region[1]);
120
-
121
- let width = end - start;
122
-
123
- const minRectWidth =
124
- typeof region[6] !== 'undefined' ? region[6] : globalMinRectWidth;
125
-
126
- if (width < minRectWidth) {
127
- // this region is too small to draw so center it on the location
128
- // where it would be drawn
129
- start = (start + end) / 2 - minRectWidth / 2;
130
- width = minRectWidth;
131
- }
132
-
133
- if (strokePos) {
134
- graphics.lineStyle(1, strokeHex, 0);
135
- graphics.beginFill(strokeHex, +region[5] || globalStrokeOpacity);
136
-
137
- strokePos.forEach((pos) => {
138
- if (pos === 'top' || pos === 'around') {
139
- if (this.isVertical) {
140
- graphics.drawRect(0, start, globalStrokeWidth, width);
141
- } else {
142
- graphics.drawRect(start, 0, width, globalStrokeWidth);
143
- }
144
- }
145
-
146
- if (pos === 'right' || pos === 'around') {
147
- if (this.isVertical) {
148
- graphics.drawRect(
149
- 0,
150
- start,
151
- this.dimensions[0],
152
- globalStrokeWidth,
153
- );
154
- } else {
155
- graphics.drawRect(
156
- start,
157
- 0,
158
- globalStrokeWidth,
159
- this.dimensions[1],
160
- );
161
- }
162
- }
163
-
164
- if (pos === 'bottom' || pos === 'around') {
165
- if (this.isVertical) {
166
- graphics.drawRect(
167
- this.dimensions[0] - globalStrokeWidth,
168
- start,
169
- globalStrokeWidth,
170
- width,
171
- );
172
- } else {
173
- graphics.drawRect(
174
- start,
175
- this.dimensions[1] - globalStrokeWidth,
176
- width,
177
- globalStrokeWidth,
178
- );
179
- }
180
- }
181
-
182
- if (pos === 'left' || pos === 'around') {
183
- if (this.isVertical) {
184
- graphics.drawRect(
185
- 0,
186
- start + width - globalStrokeWidth,
187
- this.dimensions[0],
188
- globalStrokeWidth,
189
- );
190
- } else {
191
- graphics.drawRect(
192
- start + width - globalStrokeWidth,
193
- 0,
194
- globalStrokeWidth,
195
- this.dimensions[1],
196
- );
197
- }
198
- }
199
- });
200
- } else {
201
- graphics.lineStyle(
202
- globalStrokeWidth,
203
- strokeHex,
204
- +region[5] || globalStrokeOpacity,
205
- );
206
- }
207
-
208
- // Make annotation clickable
209
- this.rects[id].graphics.clear();
210
- this.rects[id].graphics.interactive = true;
211
- this.rects[id].graphics.buttonMode = true;
212
-
213
- graphics.beginFill(fillHex, +region[4] || globalFillOpacity);
214
- if (this.isVertical) {
215
- graphics.drawRect(0, start, this.dimensions[0], width);
216
- this.rects[id].graphics.hitArea = new GLOBALS.PIXI.Rectangle(
217
- 0,
218
- start,
219
- this.dimensions[0],
220
- width,
221
- );
222
- } else {
223
- graphics.drawRect(start, 0, width, this.dimensions[1]);
224
- this.rects[id].graphics.hitArea = new GLOBALS.PIXI.Rectangle(
225
- start,
226
- 0,
227
- width,
228
- this.dimensions[1],
229
- );
230
- }
59
+ super.rerender(options, force);
60
+ }
231
61
 
232
- this.rects[id].graphics.mousedown = () => {
233
- this.rects[id].mouseDownTime = performance.now();
234
- };
62
+ /*
63
+ * The local tile identifier
64
+ */
65
+ tileToLocalId(tile) {
66
+ // tile contains [zoomLevel, xPos, yPos]
67
+ return this.tileToRemoteId(tile);
68
+ }
235
69
 
236
- this.rects[id].graphics.mouseup = (event) => {
237
- if (
238
- performance.now() - this.rects[id].mouseDownTime <
239
- MAX_CLICK_DELAY
240
- ) {
241
- this.pubSub.publish('app.click', {
242
- type: 'annotation',
243
- event,
244
- payload: region,
245
- });
246
- }
247
- };
248
- });
70
+ /**
71
+ * The tile identifier used on the server
72
+ */
73
+ tileToRemoteId(tile) {
74
+ // tile contains [zoomLevel, xPos, yPos]
75
+ let tileId = `${tile.join('.')}`;
76
+
77
+ if (this.options.projectUid) {
78
+ // include the projectUid in the options
79
+ // (resgen feature)
80
+ tileId = `${tileId}.ui=${this.options.projectUid}`;
81
+ }
249
82
 
250
- // Remove outdated rects, i.e., rects whose time stamp is not the current
251
- // time stamp stored above.
252
- Object.values(this.rects)
253
- .filter((rect) => rect.timeStamp !== timeStamp)
254
- .forEach((rect) => graphics.removeChild(rect.graphics));
83
+ return tileId;
255
84
  }
256
85
 
257
- setPosition(newPosition) {
258
- super.setPosition(newPosition);
86
+ /**
87
+ * @param {x} x position of the evt relative to the track
88
+ * @param {y} y position of the evt relative to the track
89
+ */
90
+ click(x, y) {
91
+ const rects = rectsAtPoint(this, x, y);
92
+
93
+ if (!rects.length) {
94
+ this.selectRect(null);
95
+ } else {
96
+ this.selectRect(rects[0].value.uid);
97
+ }
259
98
 
260
- this.pMain.position.y = this.position[1];
261
- this.pMain.position.x = this.position[0];
99
+ return {
100
+ type: '1d-annotations',
101
+ event: null,
102
+ payload: rects,
103
+ };
262
104
  }
263
105
 
264
- zoomed(newXScale, newYScale) {
265
- this.xScale(newXScale);
266
- this.yScale(newYScale);
267
-
268
- this.draw();
106
+ render() {
107
+ super.render();
269
108
  }
270
109
  }
271
110
 
@@ -1,4 +1,5 @@
1
1
  // @ts-nocheck
2
+
2
3
  import createPubSub from 'pub-sub-es';
3
4
 
4
5
  import TiledPixiTrack from './TiledPixiTrack';
@@ -41,13 +42,11 @@ class Annotations2dTrack extends TiledPixiTrack {
41
42
  /* --------------------------- Getter / Setter ---------------------------- */
42
43
 
43
44
  get minX() {
44
- return this.tilesetInfo && this.tilesetInfo.min_pos
45
- ? this.tilesetInfo.min_pos[0]
46
- : 0;
45
+ return this.tilesetInfo?.min_pos ? this.tilesetInfo.min_pos[0] : 0;
47
46
  }
48
47
 
49
48
  get maxX() {
50
- return this.tilesetInfo && this.tilesetInfo.max_pos
49
+ return this.tilesetInfo?.max_pos
51
50
  ? this.tilesetInfo.max_pos[0]
52
51
  : this.tilesetInfo.max_width || this.tilesetInfo.max_size;
53
52
  }
@@ -420,7 +419,10 @@ class Annotations2dTrack extends TiledPixiTrack {
420
419
  prevUid = this.selectedAnno.uid;
421
420
  }
422
421
 
423
- this.selectedAnno = { graphics, uid };
422
+ this.selectedAnno = {
423
+ graphics,
424
+ uid,
425
+ };
424
426
  this.focus(graphics, viewPos, uid);
425
427
 
426
428
  if (this.options.onSelect && !silent) {
@@ -468,8 +470,11 @@ class Annotations2dTrack extends TiledPixiTrack {
468
470
  track.appendChild(output);
469
471
 
470
472
  this.visibleAndFetchedTiles()
471
- .filter((tile) => tile.tileData && tile.tileData.length)
472
- .map((tile) => ({ graphics: tile.graphics, td: tile.tileData }))
473
+ .filter((tile) => tile.tileData?.length)
474
+ .map((tile) => ({
475
+ graphics: tile.graphics,
476
+ td: tile.tileData,
477
+ }))
473
478
  .forEach(({ td, graphics }) => {
474
479
  const gTile = document.createElement('g');
475
480