higlass 1.13.6 → 2.0.1

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 (297) hide show
  1. package/app/scripts/AddTrackDialog.jsx +8 -1
  2. package/app/scripts/AddTrackPositionMenu.jsx +26 -5
  3. package/app/scripts/Annotations1dTrack.js +90 -251
  4. package/app/scripts/Annotations2dTrack.js +9 -2
  5. package/app/scripts/Autocomplete.jsx +1 -9
  6. package/app/scripts/BedLikeTrack.js +549 -441
  7. package/app/scripts/ContextMenuContainer.jsx +3 -0
  8. package/app/scripts/ContextMenuItem.jsx +13 -2
  9. package/app/scripts/FilledLine.js +349 -0
  10. package/app/scripts/GenomePositionSearchBox.jsx +178 -477
  11. package/app/scripts/HiGlassComponent.jsx +443 -349
  12. package/app/scripts/HiGlassComponentContext.js +5 -0
  13. package/app/scripts/SeriesListMenu.jsx +94 -44
  14. package/app/scripts/SeriesListSubmenuMixin.jsx +1 -0
  15. package/app/scripts/Tiled1DPixiTrack.js +0 -1
  16. package/app/scripts/TiledPixiTrack.js +72 -63
  17. package/app/scripts/TiledPlot.jsx +530 -77
  18. package/app/scripts/TrackRenderer.jsx +2 -2
  19. package/app/scripts/ViewContextMenu.jsx +50 -2
  20. package/app/scripts/ViewHeader.jsx +3 -2
  21. package/app/scripts/api.js +87 -6
  22. package/app/scripts/configs/index.js +6 -1
  23. package/app/scripts/configs/primitives.js +2 -0
  24. package/app/scripts/configs/tracks-info.js +1 -0
  25. package/app/scripts/data-fetchers/genbank-fetcher.js +9 -14
  26. package/app/scripts/data-fetchers/local-tile-fetcher.js +8 -2
  27. package/app/scripts/hglib.jsx +61 -70
  28. package/app/scripts/options-info.js +49 -11
  29. package/app/scripts/services/tile-proxy.js +0 -4
  30. package/app/scripts/services/worker.js +1 -0
  31. package/app/scripts/test-helpers/index.js +2 -1
  32. package/app/scripts/test-helpers/test-helpers.jsx +154 -66
  33. package/app/scripts/types.ts +68 -3
  34. package/app/scripts/utils/copy-text-to-clipboard.js +36 -0
  35. package/app/scripts/utils/decompress.js +33 -0
  36. package/app/scripts/utils/default-tracks.js +46 -0
  37. package/app/scripts/utils/get-default-track-for-datatype.js +2 -1
  38. package/app/scripts/utils/get-default-tracks-for-datatype.ts +46 -0
  39. package/app/scripts/utils/index.js +1 -0
  40. package/app/scripts/utils/positioned-tracks-to-all-tracks.js +55 -0
  41. package/app/scripts/utils/show-mouse-position.js +0 -16
  42. package/app/scripts/utils/visit-positioned-tracks.js +4 -1
  43. package/app/styles/AddTrackPositionMenu.module.scss +37 -0
  44. package/app/styles/HiGlass.module.scss +3 -1
  45. package/app/styles/TiledPlot.module.scss +20 -0
  46. package/dist/app/schema.json +525 -0
  47. package/dist/app/scripts/AddTrackDialog.d.ts +64 -0
  48. package/dist/app/scripts/AddTrackPositionMenu.d.ts +5 -0
  49. package/dist/app/scripts/Annotations1dTrack.d.ts +15 -0
  50. package/dist/app/scripts/Annotations2dTrack.d.ts +95 -0
  51. package/dist/app/scripts/ArrowheadDomainsTrack.d.ts +36 -0
  52. package/dist/app/scripts/Autocomplete.d.ts +102 -0
  53. package/dist/app/scripts/AxisPixi.d.ts +25 -0
  54. package/dist/app/scripts/BarTrack.d.ts +28 -0
  55. package/dist/app/scripts/BedLikeTrack.d.ts +84 -0
  56. package/dist/app/scripts/Button.d.ts +3 -0
  57. package/dist/app/scripts/CNVIntervalTrack.d.ts +12 -0
  58. package/dist/app/scripts/CenterTiledPlot.d.ts +3 -0
  59. package/dist/app/scripts/CenterTrack.d.ts +92 -0
  60. package/dist/app/scripts/Chromosome2DAnnotations.d.ts +10 -0
  61. package/dist/app/scripts/Chromosome2DLabels.d.ts +13 -0
  62. package/dist/app/scripts/ChromosomeGrid.d.ts +24 -0
  63. package/dist/app/scripts/ChromosomeInfo.d.ts +14 -0
  64. package/dist/app/scripts/CloseTrackMenu.d.ts +10 -0
  65. package/dist/app/scripts/CombinedTrack.d.ts +32 -0
  66. package/dist/app/scripts/ConfigTrackMenu.d.ts +10 -0
  67. package/dist/app/scripts/ConfigViewMenu.d.ts +34 -0
  68. package/dist/app/scripts/ConfigureSeriesMenu.d.ts +3 -0
  69. package/dist/app/scripts/ContextMenuContainer.d.ts +36 -0
  70. package/dist/app/scripts/ContextMenuItem.d.ts +34 -0
  71. package/dist/app/scripts/Cross.d.ts +3 -0
  72. package/dist/app/scripts/CrossRule.d.ts +24 -0
  73. package/dist/app/scripts/CustomTrackDialog.d.ts +17 -0
  74. package/dist/app/scripts/Dialog.d.ts +5 -0
  75. package/dist/app/scripts/DivergentBarTrack.d.ts +4 -0
  76. package/dist/app/scripts/DragListeningDiv.d.ts +32 -0
  77. package/dist/app/scripts/DraggableDiv.d.ts +63 -0
  78. package/dist/app/scripts/ExportLinkDialog.d.ts +21 -0
  79. package/dist/app/scripts/FilledLine.d.ts +5 -0
  80. package/dist/app/scripts/FixedTrack.d.ts +5 -0
  81. package/dist/app/scripts/GalleryTracks.d.ts +20 -0
  82. package/dist/app/scripts/GenomePositionSearchBox.d.ts +95 -0
  83. package/dist/app/scripts/HeatmapOptions.d.ts +30 -0
  84. package/dist/app/scripts/HeatmapTiledPixiTrack.d.ts +184 -0
  85. package/dist/app/scripts/HiGlassComponent.d.ts +762 -0
  86. package/dist/app/scripts/HiGlassComponentContext.d.ts +3 -0
  87. package/dist/app/scripts/HiGlassTrackComponent.d.ts +37 -0
  88. package/dist/app/scripts/Horizontal1dHeatmapTrack.d.ts +9 -0
  89. package/dist/app/scripts/Horizontal2DDomainsTrack.d.ts +21 -0
  90. package/dist/app/scripts/HorizontalChromosomeLabels.d.ts +47 -0
  91. package/dist/app/scripts/HorizontalGeneAnnotationsTrack.d.ts +25 -0
  92. package/dist/app/scripts/HorizontalHeatmapTrack.d.ts +12 -0
  93. package/dist/app/scripts/HorizontalItem.d.ts +3 -0
  94. package/dist/app/scripts/HorizontalLine1DPixiTrack.d.ts +23 -0
  95. package/dist/app/scripts/HorizontalMultivecTrack.d.ts +50 -0
  96. package/dist/app/scripts/HorizontalPoint1DPixiTrack.d.ts +5 -0
  97. package/dist/app/scripts/HorizontalRule.d.ts +22 -0
  98. package/dist/app/scripts/HorizontalTiled1DPixiTrack.d.ts +26 -0
  99. package/dist/app/scripts/HorizontalTiledPlot.d.ts +49 -0
  100. package/dist/app/scripts/HorizontalTrack.d.ts +6 -0
  101. package/dist/app/scripts/Id2DTiledPixiTrack.d.ts +10 -0
  102. package/dist/app/scripts/IdHorizontal1DTiledPixiTrack.d.ts +6 -0
  103. package/dist/app/scripts/IdVertical1DTiledPixiTrack.d.ts +7 -0
  104. package/dist/app/scripts/LeftAxisTrack.d.ts +9 -0
  105. package/dist/app/scripts/LeftTrackModifier.d.ts +29 -0
  106. package/dist/app/scripts/ListWrapper.d.ts +64 -0
  107. package/dist/app/scripts/MapboxTilesTrack.d.ts +9 -0
  108. package/dist/app/scripts/Modal.d.ts +5 -0
  109. package/dist/app/scripts/MoveableTrack.d.ts +18 -0
  110. package/dist/app/scripts/NestedContextMenu.d.ts +7 -0
  111. package/dist/app/scripts/OSMTileIdsTrack.d.ts +5 -0
  112. package/dist/app/scripts/OSMTilesTrack.d.ts +129 -0
  113. package/dist/app/scripts/OverlayTrack.d.ts +13 -0
  114. package/dist/app/scripts/PixiTrack.d.ts +174 -0
  115. package/dist/app/scripts/PlotTypeChooser.d.ts +25 -0
  116. package/dist/app/scripts/PopupMenu.d.ts +28 -0
  117. package/dist/app/scripts/RasterTilesTrack.d.ts +9 -0
  118. package/dist/app/scripts/RuleMixin.d.ts +2 -0
  119. package/dist/app/scripts/SVGTrack.d.ts +15 -0
  120. package/dist/app/scripts/SearchField.d.ts +13 -0
  121. package/dist/app/scripts/SeriesListItems.d.ts +2 -0
  122. package/dist/app/scripts/SeriesListMenu.d.ts +51 -0
  123. package/dist/app/scripts/SeriesListSubmenuMixin.d.ts +2 -0
  124. package/dist/app/scripts/SketchInlinePicker.d.ts +25 -0
  125. package/dist/app/scripts/SortableList.d.ts +22 -0
  126. package/dist/app/scripts/SquareMarkersTrack.d.ts +22 -0
  127. package/dist/app/scripts/Tiled1DPixiTrack.d.ts +60 -0
  128. package/dist/app/scripts/TiledPixiTrack.d.ts +369 -0
  129. package/dist/app/scripts/TiledPlot.d.ts +313 -0
  130. package/dist/app/scripts/TilesetFinder.d.ts +65 -0
  131. package/dist/app/scripts/TopAxisTrack.d.ts +9 -0
  132. package/dist/app/scripts/Track.d.ts +196 -0
  133. package/dist/app/scripts/TrackArea.d.ts +26 -0
  134. package/dist/app/scripts/TrackControl.d.ts +5 -0
  135. package/dist/app/scripts/TrackRenderer.d.ts +724 -0
  136. package/dist/app/scripts/UnknownPixiTrack.d.ts +7 -0
  137. package/dist/app/scripts/ValueIntervalTrack.d.ts +6 -0
  138. package/dist/app/scripts/VerticalItem.d.ts +3 -0
  139. package/dist/app/scripts/VerticalRule.d.ts +21 -0
  140. package/dist/app/scripts/VerticalTiled1DPixiTrack.d.ts +6 -0
  141. package/dist/app/scripts/VerticalTiledPlot.d.ts +50 -0
  142. package/dist/app/scripts/VerticalTrack.d.ts +6 -0
  143. package/dist/app/scripts/ViewConfigEditor.d.ts +53 -0
  144. package/dist/app/scripts/ViewContextMenu.d.ts +17 -0
  145. package/dist/app/scripts/ViewHeader.d.ts +75 -0
  146. package/dist/app/scripts/ViewportTracker2D.d.ts +17 -0
  147. package/dist/app/scripts/ViewportTracker2DPixi.d.ts +11 -0
  148. package/dist/app/scripts/ViewportTrackerHorizontal.d.ts +17 -0
  149. package/dist/app/scripts/ViewportTrackerVertical.d.ts +17 -0
  150. package/dist/app/scripts/api.d.ts +640 -0
  151. package/dist/app/scripts/configs/available-track-types.d.ts +2 -0
  152. package/dist/app/scripts/configs/colormaps.d.ts +2 -0
  153. package/dist/app/scripts/configs/datatype-to-track-type.d.ts +4 -0
  154. package/dist/app/scripts/configs/default-tracks-for-datatype.d.ts +38 -0
  155. package/dist/app/scripts/configs/dense-data-extrema-config.d.ts +2 -0
  156. package/dist/app/scripts/configs/globals.d.ts +5 -0
  157. package/dist/app/scripts/configs/index.d.ts +16 -0
  158. package/dist/app/scripts/configs/positions-by-datatype.d.ts +2 -0
  159. package/dist/app/scripts/configs/primitives.d.ts +20 -0
  160. package/dist/app/scripts/configs/themes.d.ts +3 -0
  161. package/dist/app/scripts/configs/tracks-info-by-type.d.ts +4 -0
  162. package/dist/app/scripts/configs/tracks-info.d.ts +24 -0
  163. package/dist/app/scripts/d3-context-menu.d.ts +2 -0
  164. package/dist/app/scripts/data-fetchers/DataFetcher.d.ts +151 -0
  165. package/dist/app/scripts/data-fetchers/genbank-fetcher.d.ts +86 -0
  166. package/dist/app/scripts/data-fetchers/index.d.ts +3 -0
  167. package/dist/app/scripts/data-fetchers/local-tile-fetcher.d.ts +47 -0
  168. package/dist/app/scripts/gosling-exports.d.ts +17 -0
  169. package/dist/app/scripts/hglib.d.ts +24 -0
  170. package/dist/app/scripts/hocs/with-modal.d.ts +19 -0
  171. package/dist/app/scripts/hocs/with-pub-sub.d.ts +22 -0
  172. package/dist/app/scripts/hocs/with-theme.d.ts +13 -0
  173. package/dist/app/scripts/icons.d.ts +161 -0
  174. package/dist/app/scripts/mixwith.d.ts +27 -0
  175. package/dist/app/scripts/options-info.d.ts +1355 -0
  176. package/dist/app/scripts/plugins/available-for-plugins.d.ts +2338 -0
  177. package/dist/app/scripts/plugins/get-data-fetcher.d.ts +2 -0
  178. package/dist/app/scripts/plugins/index.d.ts +2 -0
  179. package/dist/app/scripts/services/chrom-info.d.ts +10 -0
  180. package/dist/app/scripts/services/dom-event.d.ts +7 -0
  181. package/dist/app/scripts/services/element-resize-listener.d.ts +5 -0
  182. package/dist/app/scripts/services/index.d.ts +5 -0
  183. package/dist/app/scripts/services/tile-proxy.d.ts +180 -0
  184. package/dist/app/scripts/services/worker.d.ts +157 -0
  185. package/dist/app/scripts/symbol.d.ts +13 -0
  186. package/dist/app/scripts/test-helpers/index.d.ts +1 -0
  187. package/dist/app/scripts/test-helpers/test-helpers.d.ts +33 -0
  188. package/dist/app/scripts/track-utils.d.ts +73 -0
  189. package/dist/app/scripts/types.d.ts +199 -0
  190. package/dist/app/scripts/utils/DenseDataExtrema1D.d.ts +88 -0
  191. package/dist/app/scripts/utils/DenseDataExtrema2D.d.ts +97 -0
  192. package/dist/app/scripts/utils/LruCache.d.ts +44 -0
  193. package/dist/app/scripts/utils/abs-to-chr.d.ts +14 -0
  194. package/dist/app/scripts/utils/accessor-transposition.d.ts +14 -0
  195. package/dist/app/scripts/utils/add-arrays.d.ts +18 -0
  196. package/dist/app/scripts/utils/add-class.d.ts +8 -0
  197. package/dist/app/scripts/utils/add-event-listener-once.d.ts +11 -0
  198. package/dist/app/scripts/utils/assert.d.ts +17 -0
  199. package/dist/app/scripts/utils/background-task-scheduler.d.ts +47 -0
  200. package/dist/app/scripts/utils/base64-to-canvas.d.ts +9 -0
  201. package/dist/app/scripts/utils/chr-to-abs.d.ts +10 -0
  202. package/dist/app/scripts/utils/chrom-info-bisector.d.ts +4 -0
  203. package/dist/app/scripts/utils/clone-event.d.ts +12 -0
  204. package/dist/app/scripts/utils/color-domain-to-rgba-array.d.ts +13 -0
  205. package/dist/app/scripts/utils/color-to-hex.d.ts +9 -0
  206. package/dist/app/scripts/utils/color-to-rgba.d.ts +9 -0
  207. package/dist/app/scripts/utils/copy-text-to-clipboard.d.ts +2 -0
  208. package/dist/app/scripts/utils/data-to-genomic-loci.d.ts +11 -0
  209. package/dist/app/scripts/utils/debounce.d.ts +5 -0
  210. package/dist/app/scripts/utils/dec-to-hex-str.d.ts +8 -0
  211. package/dist/app/scripts/utils/decompress.d.ts +27 -0
  212. package/dist/app/scripts/utils/default-tracks.d.ts +3 -0
  213. package/dist/app/scripts/utils/dict-from-tuples.d.ts +11 -0
  214. package/dist/app/scripts/utils/dict-items.d.ts +18 -0
  215. package/dist/app/scripts/utils/dict-keys.d.ts +10 -0
  216. package/dist/app/scripts/utils/dict-values.d.ts +8 -0
  217. package/dist/app/scripts/utils/download.d.ts +7 -0
  218. package/dist/app/scripts/utils/expand-combined-tracks.d.ts +11 -0
  219. package/dist/app/scripts/utils/fake-pub-sub.d.ts +11 -0
  220. package/dist/app/scripts/utils/fill-in-min-widths.d.ts +44 -0
  221. package/dist/app/scripts/utils/flatten.d.ts +9 -0
  222. package/dist/app/scripts/utils/for-each.d.ts +9 -0
  223. package/dist/app/scripts/utils/forward-event.d.ts +7 -0
  224. package/dist/app/scripts/utils/genome-loci-to-pixels.d.ts +9 -0
  225. package/dist/app/scripts/utils/genomic-range-to-chromosome-chunks.d.ts +21 -0
  226. package/dist/app/scripts/utils/get-aggregation-function.d.ts +10 -0
  227. package/dist/app/scripts/utils/get-default-track-for-datatype.d.ts +21 -0
  228. package/dist/app/scripts/utils/get-default-tracks-for-datatype.d.ts +3 -0
  229. package/dist/app/scripts/utils/get-element-dim.d.ts +7 -0
  230. package/dist/app/scripts/utils/get-higlass-components.d.ts +7 -0
  231. package/dist/app/scripts/utils/get-track-by-uid.d.ts +7 -0
  232. package/dist/app/scripts/utils/get-track-conf-from-hgc.d.ts +10 -0
  233. package/dist/app/scripts/utils/get-track-obj-by-id.d.ts +2 -0
  234. package/dist/app/scripts/utils/get-track-position-by-uid.d.ts +13 -0
  235. package/dist/app/scripts/utils/get-xylofon.d.ts +2 -0
  236. package/dist/app/scripts/utils/gradient.d.ts +14 -0
  237. package/dist/app/scripts/utils/has-class.d.ts +8 -0
  238. package/dist/app/scripts/utils/has-parent.d.ts +9 -0
  239. package/dist/app/scripts/utils/hex-string-to-int.d.ts +14 -0
  240. package/dist/app/scripts/utils/index.d.ts +89 -0
  241. package/dist/app/scripts/utils/interval-tree.d.ts +109 -0
  242. package/dist/app/scripts/utils/into-the-void.d.ts +6 -0
  243. package/dist/app/scripts/utils/is-track-or-child-track.d.ts +7 -0
  244. package/dist/app/scripts/utils/is-track-range-selectable.d.ts +2 -0
  245. package/dist/app/scripts/utils/is-within.d.ts +12 -0
  246. package/dist/app/scripts/utils/lat-to-y.d.ts +9 -0
  247. package/dist/app/scripts/utils/lng-to-x.d.ts +8 -0
  248. package/dist/app/scripts/utils/load-chrom-infos.d.ts +8 -0
  249. package/dist/app/scripts/utils/map.d.ts +13 -0
  250. package/dist/app/scripts/utils/max-non-zero.d.ts +6 -0
  251. package/dist/app/scripts/utils/max.d.ts +10 -0
  252. package/dist/app/scripts/utils/min-non-zero.d.ts +6 -0
  253. package/dist/app/scripts/utils/min.d.ts +10 -0
  254. package/dist/app/scripts/utils/mod.d.ts +9 -0
  255. package/dist/app/scripts/utils/ndarray-assign.d.ts +2 -0
  256. package/dist/app/scripts/utils/ndarray-flatten.d.ts +2 -0
  257. package/dist/app/scripts/utils/ndarray-to-list.d.ts +2 -0
  258. package/dist/app/scripts/utils/numericify-version.d.ts +6 -0
  259. package/dist/app/scripts/utils/obj-vals.d.ts +8 -0
  260. package/dist/app/scripts/utils/or.d.ts +8 -0
  261. package/dist/app/scripts/utils/parse-chromsizes-rows.d.ts +34 -0
  262. package/dist/app/scripts/utils/pixi-text-to-svg.d.ts +2 -0
  263. package/dist/app/scripts/utils/positioned-tracks-to-all-tracks.d.ts +26 -0
  264. package/dist/app/scripts/utils/q.d.ts +18 -0
  265. package/dist/app/scripts/utils/rad-to-deg.d.ts +7 -0
  266. package/dist/app/scripts/utils/range-query-2d.d.ts +17 -0
  267. package/dist/app/scripts/utils/reduce.d.ts +14 -0
  268. package/dist/app/scripts/utils/rel-to-abs-chrom-pos.d.ts +10 -0
  269. package/dist/app/scripts/utils/remove-class.d.ts +7 -0
  270. package/dist/app/scripts/utils/reset-d3-brush-style.d.ts +10 -0
  271. package/dist/app/scripts/utils/rgb-to-hex.d.ts +8 -0
  272. package/dist/app/scripts/utils/scales-center-and-k.d.ts +12 -0
  273. package/dist/app/scripts/utils/scales-to-genome-loci.d.ts +3 -0
  274. package/dist/app/scripts/utils/segments-to-rows.d.ts +15 -0
  275. package/dist/app/scripts/utils/selected-items-to-cum-weights.d.ts +12 -0
  276. package/dist/app/scripts/utils/selected-items-to-size.d.ts +13 -0
  277. package/dist/app/scripts/utils/show-mouse-position.d.ts +54 -0
  278. package/dist/app/scripts/utils/some.d.ts +10 -0
  279. package/dist/app/scripts/utils/sum.d.ts +8 -0
  280. package/dist/app/scripts/utils/svg-line.d.ts +2 -0
  281. package/dist/app/scripts/utils/throttle-and-debounce.d.ts +33 -0
  282. package/dist/app/scripts/utils/tile-to-canvas.d.ts +9 -0
  283. package/dist/app/scripts/utils/timeout.d.ts +3 -0
  284. package/dist/app/scripts/utils/to-void.d.ts +3 -0
  285. package/dist/app/scripts/utils/total-track-pixel-height.d.ts +27 -0
  286. package/dist/app/scripts/utils/trim-trailing-slash.d.ts +7 -0
  287. package/dist/app/scripts/utils/type-guards.d.ts +36 -0
  288. package/dist/app/scripts/utils/value-to-color.d.ts +12 -0
  289. package/dist/app/scripts/utils/visit-positioned-tracks.d.ts +18 -0
  290. package/dist/app/scripts/utils/visit-tracks.d.ts +9 -0
  291. package/dist/esm.html +1 -3
  292. package/dist/hglib.js +65302 -79868
  293. package/dist/hglib.min.js +104 -112
  294. package/dist/higlass.mjs +64214 -78780
  295. package/dist/index.html +1 -3
  296. package/dist/package.json +134 -0
  297. package/package.json +13 -10
@@ -1,9 +1,11 @@
1
1
  // @ts-nocheck
2
+ import clsx from 'clsx';
2
3
  import { ElementQueries, ResizeSensor } from 'css-element-queries';
3
- import { pointer } from 'd3-selection';
4
+ import { brush, brushX, brushY } from 'd3-brush';
5
+ import { format } from 'd3-format';
6
+ import { pointer, select } from 'd3-selection';
4
7
  import PropTypes from 'prop-types';
5
8
  import React from 'react';
6
- import ReactDOM from 'react-dom';
7
9
  import slugid from 'slugid';
8
10
 
9
11
  import AddTrackDialog from './AddTrackDialog';
@@ -37,11 +39,12 @@ import {
37
39
  sum,
38
40
  visitPositionedTracks,
39
41
  } from './utils';
42
+ import getDefaultTracksForDataType from './utils/get-default-tracks-for-datatype';
40
43
 
41
44
  // Configs
42
45
  import {
43
- DEFAULT_TRACKS_FOR_DATATYPE,
44
46
  MOUSE_TOOL_SELECT,
47
+ MOUSE_TOOL_TRACK_SELECT,
45
48
  TRACKS_INFO_BY_TYPE,
46
49
  TRACK_LOCATIONS,
47
50
  } from './configs';
@@ -57,6 +60,8 @@ export class TiledPlot extends React.Component {
57
60
  this.closing = false;
58
61
  // that the tracks will be drawn on
59
62
 
63
+ this.brushX = brushX();
64
+
60
65
  const { tracks } = this.props;
61
66
  this.canvasElement = null;
62
67
 
@@ -79,6 +84,8 @@ export class TiledPlot extends React.Component {
79
84
  }
80
85
  });
81
86
 
87
+ this.annotationUid = null;
88
+ this.annotationCreatedNotified = false;
82
89
  this.xScale = null;
83
90
  this.yScale = null;
84
91
 
@@ -88,8 +95,8 @@ export class TiledPlot extends React.Component {
88
95
  this.trackToReplace = null;
89
96
  this.trackRenderer = null;
90
97
 
98
+ this.brushSelection = null;
91
99
  this.configTrackMenu = null;
92
-
93
100
  /*
94
101
  let trackOptions = this.props.editable ?
95
102
  {'track': this.props.tracks.center[0].contents[0],
@@ -105,6 +112,7 @@ export class TiledPlot extends React.Component {
105
112
 
106
113
  tracks,
107
114
  init: false,
115
+ addTrackExtent: null,
108
116
  addTrackPosition: null,
109
117
  customDialog: null,
110
118
  mouseOverOverlayUid: null,
@@ -150,6 +158,10 @@ export class TiledPlot extends React.Component {
150
158
  this.dragTimeout = null;
151
159
  this.previousPropsStr = '';
152
160
 
161
+ this.brushesCreated = {};
162
+
163
+ this.appZoomedBound = this.appZoomed.bind(this);
164
+ this.handleClickBound = this.handleClick.bind(this);
153
165
  this.contextMenuHandlerBound = this.contextMenuHandler.bind(this);
154
166
  this.handleNoTrackAddedBound = this.handleNoTrackAdded.bind(this);
155
167
  this.handleTracksAddedBound = this.handleTracksAdded.bind(this);
@@ -172,7 +184,7 @@ export class TiledPlot extends React.Component {
172
184
  waitForDOMAttachment(callback) {
173
185
  if (!this.mounted) return;
174
186
 
175
- const thisElement = ReactDOM.findDOMNode(this);
187
+ const thisElement = this.divTiledPlot;
176
188
 
177
189
  if (document.body.contains(thisElement)) {
178
190
  callback();
@@ -183,8 +195,7 @@ export class TiledPlot extends React.Component {
183
195
 
184
196
  componentDidMount() {
185
197
  this.mounted = true;
186
- this.element = ReactDOM.findDOMNode(this);
187
- this.canvasElement = ReactDOM.findDOMNode(this.props.canvasElement);
198
+ this.element = this.divTiledPlot;
188
199
 
189
200
  // new ResizeSensor(this.element, this.measureSize.bind(this));
190
201
  this.waitForDOMAttachment(() => {
@@ -205,6 +216,456 @@ export class TiledPlot extends React.Component {
205
216
  this.pubSubs.push(
206
217
  this.props.pubSub.subscribe('contextmenu', this.contextMenuHandlerBound),
207
218
  );
219
+
220
+ // this.pubSubs.push(
221
+ // this.props.pubSub.subscribe('click', evt => {
222
+ // if (this.brushEl) {
223
+ // const pos = pointer(evt, this.brushEl);
224
+
225
+ // console.log('click pos:', pos);
226
+ // console.log('this.brushEl', this.brushEl.node());
227
+ // }
228
+ // }),
229
+ // );
230
+ }
231
+
232
+ /** Get the data in the selection */
233
+ getTracksData(positionedTracks, extent) {
234
+ let tracks = [];
235
+
236
+ const allTrackObjs = this.listAllTrackObjects();
237
+
238
+ // get a list of viewconf track defs
239
+ for (const track of positionedTracks) {
240
+ if (track.track.contents) {
241
+ tracks = [...tracks, ...track.track.contents];
242
+ } else {
243
+ tracks = [...tracks, track.track];
244
+ }
245
+ }
246
+
247
+ const trackDatas = [];
248
+
249
+ // get data
250
+ for (const track of tracks) {
251
+ if (track.type === 'heatmap') {
252
+ const trackObj = allTrackObjs.filter((x) => x.id === track.uid)[0];
253
+
254
+ const x1 = trackObj._xScale(extent[0][0]);
255
+ const x2 = trackObj._xScale(extent[1][0]);
256
+
257
+ const y1 = trackObj._yScale(extent[0][1]);
258
+ const y2 = trackObj._yScale(extent[1][1]);
259
+
260
+ const height = y2 - y1;
261
+ const width = x2 - x1;
262
+
263
+ const data = trackObj.getVisibleRectangleData(x1, y1, height, width);
264
+ const sumValue = data.data.reduce((a, b) => a + b, 0);
265
+ const mean = sumValue / data.data.length;
266
+
267
+ trackDatas.push({
268
+ name: track.options.name,
269
+ mean,
270
+ trackUid: track.uid,
271
+ });
272
+ }
273
+ }
274
+
275
+ return trackDatas;
276
+ }
277
+
278
+ appZoomed() {
279
+ if (this.brushCurrent && this.brushEl) {
280
+ if (this.brushType === 'horizontal') {
281
+ const newSelection = [
282
+ this.xScale(this.brushSelection[0]) + this.brushTrack.left,
283
+ this.xScale(this.brushSelection[1]) + this.brushTrack.left,
284
+ ];
285
+
286
+ this.brushEl.call(this.brushCurrent.move, newSelection);
287
+ }
288
+
289
+ if (this.brushType === 'vertical') {
290
+ const newSelection = [
291
+ this.yScale(this.brushSelection[0]) + this.brushTrack.top,
292
+ this.yScale(this.brushSelection[1]) + this.brushTrack.top,
293
+ ];
294
+
295
+ this.brushEl.call(this.brushCurrent.move, newSelection);
296
+ }
297
+
298
+ if (this.brushType === '2d') {
299
+ const newSelection = [
300
+ [
301
+ this.xScale(this.brushSelection[0][0]) + this.brushTrack.left,
302
+ this.yScale(this.brushSelection[0][1]) + this.brushTrack.top,
303
+ ],
304
+ [
305
+ this.xScale(this.brushSelection[1][0]) + this.brushTrack.left,
306
+ this.yScale(this.brushSelection[1][1]) + this.brushTrack.top,
307
+ ],
308
+ ];
309
+
310
+ this.brushEl.call(this.brushCurrent.move, newSelection);
311
+ }
312
+ }
313
+ }
314
+
315
+ clearOtherBrushes(myBrush) {
316
+ for (const aBrush of Object.values(this.brushes)) {
317
+ aBrush.on('brush', null);
318
+ }
319
+
320
+ for (const trackUid in this.brushes) {
321
+ const otherBrush = this.brushes[trackUid];
322
+
323
+ if (otherBrush !== myBrush) {
324
+ this.brushEls[trackUid].call(otherBrush.move, null);
325
+ // this.brushEls[trackUid].selectAll('.selection').remove();
326
+ }
327
+ }
328
+
329
+ for (const aBrush of Object.values(this.brushes)) {
330
+ aBrush.on('brush', () => this.clearOtherBrushes(aBrush));
331
+ }
332
+ }
333
+
334
+ handleClick(evt) {
335
+ const pos = pointer(evt, this.divTiledPlot);
336
+ let inside = false;
337
+
338
+ if (this.brushEl) {
339
+ const selection = this.brushSelectionRaw;
340
+
341
+ const track = this.brushTrack;
342
+
343
+ if (this.brushType === '2d') {
344
+ if (
345
+ pos[0] >= selection[0][0] &&
346
+ pos[0] <= selection[1][0] &&
347
+ pos[1] >= selection[0][1] &&
348
+ pos[1] <= selection[1][1]
349
+ ) {
350
+ inside = true;
351
+ }
352
+ } else if (this.brushType === 'horizontal') {
353
+ if (
354
+ pos[0] >= selection[0] &&
355
+ pos[0] <= selection[1] &&
356
+ pos[1] >= track.top &&
357
+ pos[1] <= track.top + track.height
358
+ ) {
359
+ inside = true;
360
+ }
361
+ } else if (this.brushType === 'vertical') {
362
+ if (
363
+ pos[1] >= selection[0] &&
364
+ pos[1] <= selection[1] &&
365
+ pos[0] >= track.left &&
366
+ pos[0] <= track.left + track.width
367
+ ) {
368
+ inside = true;
369
+ }
370
+ }
371
+
372
+ if (!inside) {
373
+ this.cancelBrushes();
374
+ }
375
+ }
376
+ }
377
+
378
+ cancelBrushes() {
379
+ this.brushEl.call(this.brushCurrent.move, null);
380
+ this.brushEl = null;
381
+ this.props.apiPublish('annotationRemoved', this.annotationUid);
382
+ this.annotationUid = null;
383
+ this.annotationCreatedNotified = false;
384
+
385
+ this.removeBrushText();
386
+ }
387
+
388
+ removeBrushText() {
389
+ select(this.divTiledPlot)
390
+ .selectAll('.brush-svg')
391
+ .selectAll('.data-values')
392
+ .remove();
393
+ }
394
+
395
+ enableBrushes() {
396
+ const overlays = select(this.divTiledPlot)
397
+ .selectAll('.brush-svg')
398
+ .selectAll('.overlay');
399
+
400
+ overlays.style('pointer-events', 'all');
401
+ }
402
+
403
+ disableBrushes() {
404
+ select(this.divTiledPlot)
405
+ // .selectAll('.brush-svg')
406
+ .selectAll('.overlay')
407
+ .attr('pointer-events', 'none');
408
+
409
+ select(this.divTiledPlot)
410
+ .selectAll('.brush-rect')
411
+ .attr('pointer-events', 'none');
412
+
413
+ select(this.divTiledPlot)
414
+ .selectAll('.selection')
415
+ .attr('pointer-events', 'all');
416
+
417
+ select(this.divTiledPlot)
418
+ .selectAll('.brush-svg')
419
+ .attr('pointer-events', 'none');
420
+ }
421
+
422
+ createBrushes(positionedTracks) {
423
+ const brushes = {};
424
+ this.brushCurrent = null;
425
+
426
+ const apiPublish = this.props.apiPublish;
427
+ const tiledPlot = this;
428
+
429
+ for (const track of positionedTracks) {
430
+ if (brushes[track.track.uid]) continue;
431
+
432
+ let myBrush = null;
433
+
434
+ if (['top', 'bottom'].includes(track.track.position)) {
435
+ myBrush = brushX();
436
+ myBrush.on('brush', (event) => {
437
+ if (!event.selection) {
438
+ return;
439
+ }
440
+ this.brushCurrent = myBrush;
441
+ this.brushType = 'horizontal';
442
+ this.brushTrack = track;
443
+ this.brushSelectionRaw = event.selection;
444
+ this.brushSelection = [
445
+ this.xScale.invert(event.selection[0] - track.left),
446
+ this.xScale.invert(event.selection[1] - track.left),
447
+ ];
448
+
449
+ apiPublish('annotationChanged', {
450
+ annotationUid: this.annotationUid,
451
+ viewUid: this.props.uid,
452
+ track: track.track,
453
+ extent: [this.brushSelection, [null, null]],
454
+ });
455
+ });
456
+
457
+ myBrush.on('end', (evt) => {
458
+ if (!this.annotationCreatedNotified) {
459
+ apiPublish('annotationCreated', {
460
+ annotationUid: tiledPlot.annotationUid,
461
+ track: track.track,
462
+ viewUid: this.props.uid,
463
+ extent: [this.brushSelection, [null, null]],
464
+ });
465
+ }
466
+ });
467
+ } else if (['left', 'right'].includes(track.track.position)) {
468
+ myBrush = brushY();
469
+ myBrush.on('brush', (event) => {
470
+ if (!event.selection) {
471
+ return;
472
+ }
473
+ this.brushCurrent = myBrush;
474
+ this.brushType = 'vertical';
475
+ this.brushTrack = track;
476
+ this.brushSelectionRaw = event.selection;
477
+ this.brushSelection = [
478
+ this.yScale.invert(event.selection[0] - track.top),
479
+ this.yScale.invert(event.selection[1] - track.top),
480
+ ];
481
+
482
+ apiPublish('annotationChanged', {
483
+ annotationUid: this.annotationUid,
484
+ track: track.track,
485
+ viewUid: this.props.uid,
486
+ extent: [[null, null], this.brushSelection],
487
+ });
488
+ });
489
+
490
+ myBrush.on('end', (evt) => {
491
+ if (!this.annotationCreatedNotified) {
492
+ apiPublish('annotationCreated', {
493
+ annotationUid: tiledPlot.annotationUid,
494
+ track: track.track,
495
+ viewUid: this.props.uid,
496
+ extent: [[null, null], this.brushSelection],
497
+ });
498
+ }
499
+ });
500
+ } else {
501
+ myBrush = brush();
502
+ myBrush.on('brush', (event) => {
503
+ if (!event.selection) {
504
+ return;
505
+ }
506
+ this.brushCurrent = myBrush;
507
+ this.brushType = '2d';
508
+ this.brushTrack = track;
509
+ this.brushSelectionRaw = event.selection;
510
+ this.brushSelection = [
511
+ [
512
+ this.xScale.invert(event.selection[0][0] - track.left),
513
+ this.yScale.invert(event.selection[0][1] - track.top),
514
+ ],
515
+ [
516
+ this.xScale.invert(event.selection[1][0] - track.left),
517
+ this.yScale.invert(event.selection[1][1] - track.top),
518
+ ],
519
+ ];
520
+
521
+ const tracksData = this.getTracksData(
522
+ positionedTracks.filter((t) => t.track.position === 'center'),
523
+ this.brushSelection,
524
+ );
525
+
526
+ const dataValues = Object.values(tracksData)
527
+ .filter((x) => x.mean !== undefined)
528
+ .map((x) => x.mean);
529
+
530
+ if (dataValues.length) {
531
+ const selection = select(this.divTiledPlot)
532
+ .selectAll('.brush-svg')
533
+ .selectAll('.data-values')
534
+ .data(dataValues);
535
+
536
+ selection.enter().append('text').classed('data-values', true);
537
+
538
+ const numFormat = format('.3f');
539
+
540
+ select(this.divTiledPlot)
541
+ .selectAll('.data-values')
542
+ .attr('x', event.selection[0][0])
543
+ .attr('y', event.selection[0][1])
544
+ .text((x) => `mean: ${numFormat(x)}`);
545
+ }
546
+
547
+ apiPublish('annotationChanged', {
548
+ annotationUid: this.annotationUid,
549
+ extent: this.brushSelection,
550
+ data: tracksData,
551
+ track: track.track,
552
+ viewUid: this.props.uid,
553
+ });
554
+ });
555
+
556
+ myBrush.on('end', (evt) => {
557
+ let tracksData = {};
558
+
559
+ if (this.brushSelection?.[0].length) {
560
+ tracksData = this.getTracksData(
561
+ positionedTracks.filter((t) => t.track.position === 'center'),
562
+ this.brushSelection,
563
+ );
564
+ }
565
+
566
+ if (!this.annotationCreatedNotified) {
567
+ apiPublish('annotationCreated', {
568
+ annotationUid: tiledPlot.annotationUid,
569
+ track: track.track,
570
+ viewUid: this.props.uid,
571
+ extent: this.brushSelection,
572
+ data: tracksData,
573
+ });
574
+ this.annotationCreatedNotified = true;
575
+ } else if (!evt.selection) {
576
+ this.removeBrushText();
577
+ }
578
+ });
579
+ }
580
+
581
+ // turn off d3-brush's control of the shift, meta, ctrl keys
582
+ myBrush.keyModifiers(false);
583
+ myBrush.extent([
584
+ [track.left, track.top],
585
+ [track.left + track.width, track.top + track.height],
586
+ ]);
587
+
588
+ myBrush.on('start', function (event) {
589
+ if (!tiledPlot.annotationUid) {
590
+ tiledPlot.annotationUid = slugid.nice();
591
+ track.annotationUid = tiledPlot.annotationUid;
592
+ }
593
+ tiledPlot.brushEl = select(this);
594
+ });
595
+
596
+ brushes[track.track.uid] = myBrush;
597
+ }
598
+
599
+ return brushes;
600
+ }
601
+
602
+ removeBrushes() {
603
+ select(this.divTiledPlot).selectAll('.brush-svg').remove();
604
+ }
605
+
606
+ addBrushes() {
607
+ if (this.annotationUid) {
608
+ // we already have a selection, no need to create a new one
609
+ return;
610
+ }
611
+
612
+ // get all tracks and remove the ones that are in the
613
+ // "whole" position (e.g. rules)
614
+ const positionedTracks = this.positionedTracks().filter(
615
+ (x) => x.track.position !== 'whole',
616
+ );
617
+
618
+ const brushes = this.createBrushes(positionedTracks);
619
+ this.brushes = brushes;
620
+ const brushEls = {};
621
+ this.brushEls = brushEls;
622
+
623
+ select(this.divTiledPlot).selectAll('.brush').remove();
624
+
625
+ select(this.divTiledPlot)
626
+ .selectAll('.brush-svg')
627
+ .data([1])
628
+ .enter()
629
+ .append('svg')
630
+ .classed('brush-svg', true)
631
+ .style('position', 'absolute')
632
+ .style('left', 0)
633
+ .style('top', 0)
634
+ .style('z-index', 101);
635
+
636
+ const brushG = select(this.divTiledPlot)
637
+ .select('.brush-svg')
638
+ .selectAll('.brush')
639
+ .data(positionedTracks, (d) => d.track.uid)
640
+ .enter()
641
+ .append('g')
642
+ .attr('class', 'brush');
643
+
644
+ select(this.divTiledPlot)
645
+ .selectAll('.brush-svg')
646
+ .attr('width', this.state.width)
647
+ .attr('height', this.state.height);
648
+
649
+ select(this.divTiledPlot)
650
+ .selectAll('.brush-rect')
651
+ .attr('x', (d) => d.left)
652
+ .attr('y', (d) => d.top)
653
+ .style('stroke', '1px solid black')
654
+ .style('fill', 'transparent')
655
+ .attr('width', (d) => d.width)
656
+ .attr('height', (d) => d.height);
657
+
658
+ brushG.each(function (d) {
659
+ brushEls[d.track.uid] = select(this);
660
+ brushEls[d.track.uid].call(brushes[d.track.uid]);
661
+ });
662
+
663
+ // select(this.divTiledPlot).on('click', () => console.log('yyclick'));
664
+ // select(this.divTiledPlot)
665
+ // .select('.brush-svg')
666
+ // .selectAll('.brush');
667
+
668
+ // .attr('x', d => d.)
208
669
  }
209
670
 
210
671
  UNSAFE_componentWillReceiveProps(newProps) {
@@ -247,14 +708,15 @@ export class TiledPlot extends React.Component {
247
708
 
248
709
  if (!this.numTracks) this.tracksByUidInit = {};
249
710
 
250
- return toUpdate;
251
- }
711
+ if (nextProps.mouseTool === MOUSE_TOOL_TRACK_SELECT) {
712
+ // this.enableBrushes();
713
+ this.addBrushes();
714
+ } else {
715
+ this.disableBrushes();
716
+ // this.removeBrushes();
717
+ }
252
718
 
253
- UNSAFE_componentWillUpdate() {
254
- /**
255
- * Need to determine the offset of this element relative to the canvas on which stuff
256
- * will be drawn
257
- */
719
+ return toUpdate;
258
720
  }
259
721
 
260
722
  componentDidUpdate(prevProps, prevState) {
@@ -289,7 +751,7 @@ export class TiledPlot extends React.Component {
289
751
 
290
752
  this.props.modal.open(
291
753
  <CustomTrackDialog
292
- // biome-ignore lint/correctness/noChildrenProp:
754
+ // biome-ignore lint/correctness/noChildrenProp: We should consider refactoring
293
755
  children={componentArray}
294
756
  bodyProps={bodyPropsArray}
295
757
  onCancel={this.props.closeCustomDialog}
@@ -306,6 +768,7 @@ export class TiledPlot extends React.Component {
306
768
  if (this.state.addTrackPosition || this.props.addTrackPosition) {
307
769
  this.props.modal.open(
308
770
  <AddTrackDialog
771
+ extent={this.state.addTrackExtent || this.props.addTrackExtent}
309
772
  host={this.state.addTrackHost}
310
773
  onCancel={this.handleNoTrackAddedBound}
311
774
  onTracksChosen={this.handleTracksAddedBound}
@@ -432,6 +895,8 @@ export class TiledPlot extends React.Component {
432
895
  this.xScale = x;
433
896
  this.yScale = y;
434
897
 
898
+ this.appZoomed();
899
+
435
900
  this.props.onScalesChanged(x, y);
436
901
  }
437
902
 
@@ -470,6 +935,9 @@ export class TiledPlot extends React.Component {
470
935
  } else {
471
936
  track.maxZoom = tilesetInfo.max_zoom;
472
937
  }
938
+ if (tilesetInfo.row_infos) {
939
+ track.row_infos = tilesetInfo.row_infos;
940
+ }
473
941
  track.coordSystem = tilesetInfo.coordSystem;
474
942
  track.datatype = tilesetInfo.datatype;
475
943
  }
@@ -523,6 +991,7 @@ export class TiledPlot extends React.Component {
523
991
  this.setState({
524
992
  mouseOverOverlayUid: uid,
525
993
  });
994
+ this.props.setOverTrackChooser(true);
526
995
  }
527
996
 
528
997
  handleOverlayMouseLeave(uid) {
@@ -531,11 +1000,12 @@ export class TiledPlot extends React.Component {
531
1000
  mouseOverOverlayUid: null,
532
1001
  });
533
1002
  }
1003
+ this.props.setOverTrackChooser(false);
534
1004
  }
535
1005
 
536
- handleTrackPositionChosen(pTrack) {
1006
+ handleTrackPositionChosen(pTrack, evt) {
537
1007
  this.setState({ mouseOverOverlayUid: null });
538
- this.props.chooseTrackHandler(pTrack.track.uid);
1008
+ this.props.chooseTrackHandler(pTrack.track.uid, evt);
539
1009
  }
540
1010
 
541
1011
  handleNoTrackAdded() {
@@ -548,6 +1018,7 @@ export class TiledPlot extends React.Component {
548
1018
  this.props.onNoTrackAdded();
549
1019
 
550
1020
  this.setState({
1021
+ addTrackExtent: null,
551
1022
  addTrackPosition: null,
552
1023
  addTrackHost: null,
553
1024
  });
@@ -619,8 +1090,9 @@ export class TiledPlot extends React.Component {
619
1090
  this.handleAddTrack(orientation);
620
1091
  }
621
1092
 
622
- handleAddTrack(position) {
1093
+ handleAddTrack(position, extent) {
623
1094
  this.setState({
1095
+ addTrackExtent: extent,
624
1096
  addTrackPosition: position,
625
1097
  addTrackHost: null,
626
1098
  });
@@ -694,7 +1166,7 @@ export class TiledPlot extends React.Component {
694
1166
  this.props.onChangeTrackData(uid, newData);
695
1167
  }
696
1168
 
697
- handleTracksAdded(newTracks, position, host) {
1169
+ handleTracksAdded(newTracks, position, extent, host) {
698
1170
  /**
699
1171
  * Arguments
700
1172
  * ---------
@@ -722,9 +1194,10 @@ export class TiledPlot extends React.Component {
722
1194
 
723
1195
  // if host is defined, then we're adding a new series
724
1196
  // further down the chain a combined track will be created
725
- this.props.onTracksAdded(newTracks, position, host);
1197
+ this.props.onTracksAdded(newTracks, position, extent, host);
726
1198
 
727
1199
  this.setState({
1200
+ addTrackExtent: null,
728
1201
  addTrackPosition: null,
729
1202
  addTrackHost: null,
730
1203
  });
@@ -955,8 +1428,6 @@ export class TiledPlot extends React.Component {
955
1428
  track.offsetLeft = left;
956
1429
 
957
1430
  break;
958
-
959
- // case 'whole':
960
1431
  default:
961
1432
  width = this.leftWidth + this.centerWidth + this.rightWidth;
962
1433
  height = this.topHeight + this.centerHeight + this.bottomHeight;
@@ -1367,6 +1838,7 @@ export class TiledPlot extends React.Component {
1367
1838
  overlays: props.overlays,
1368
1839
  viewOptions: props.viewOptions,
1369
1840
  uid: props.uid,
1841
+ addTrackExtent: props.addTrackExtent,
1370
1842
  addTrackPosition: props.addTrackPosition,
1371
1843
  editable: props.editable,
1372
1844
  marginTop: props.marginTop,
@@ -1580,16 +2052,23 @@ export class TiledPlot extends React.Component {
1580
2052
  return (
1581
2053
  <PopupMenu onMenuClosed={this.closeMenusBound}>
1582
2054
  <ViewContextMenu
2055
+ apiPublish={this.props.apiPublish}
1583
2056
  closeMenu={this.closeMenusBound}
1584
2057
  coords={[this.state.contextMenuDataX, this.state.contextMenuDataY]}
1585
2058
  customItems={this.state.contextMenuCustomItems}
2059
+ genomePositionSearchBox={this.props.genomePositionSearchBox}
1586
2060
  onAddDivisor={this.handleAddDivisorBound}
1587
2061
  onAddSeries={this.handleAddSeriesBound}
1588
2062
  // Can only add one new track at a time
1589
2063
  // because "whole" tracks are always drawn on top of each other,
1590
2064
  // the notion of Series is unnecessary and so 'host' is null
1591
2065
  onAddTrack={(newTrack) => {
1592
- this.props.onTracksAdded([newTrack], newTrack.position, null);
2066
+ this.props.onTracksAdded(
2067
+ [newTrack],
2068
+ newTrack.position,
2069
+ null,
2070
+ null,
2071
+ );
1593
2072
  this.handleCloseContextMenu();
1594
2073
  }}
1595
2074
  onChangeTrackData={this.handleChangeTrackDataBound}
@@ -1604,8 +2083,8 @@ export class TiledPlot extends React.Component {
1604
2083
  orientation="right"
1605
2084
  position={this.state.contextMenuPosition}
1606
2085
  theme={this.props.theme}
1607
- tracks={relevantTracks}
1608
2086
  trackRenderer={this.trackRenderer}
2087
+ tracks={relevantTracks}
1609
2088
  trackSourceServers={this.props.trackSourceServers}
1610
2089
  />
1611
2090
  </PopupMenu>
@@ -1621,41 +2100,15 @@ export class TiledPlot extends React.Component {
1621
2100
  */
1622
2101
  getIdealizedTrackPositionsOverlay() {
1623
2102
  const evtJson = this.props.draggingHappening;
2103
+ const { datatype } = evtJson;
1624
2104
 
1625
- // For whatever reason, evtJson is sometimes a boolean. This rest of
1626
- // this code block assumes it's an object, so we return undefined if
1627
- // it's not.
1628
- if (typeof evtJson === 'boolean') {
1629
- return undefined;
1630
- }
1631
-
1632
- const datatype = evtJson.datatype;
1633
-
1634
- if (!(datatype in DEFAULT_TRACKS_FOR_DATATYPE) && !evtJson.defaultTracks) {
1635
- console.warn('unknown data type:', evtJson.higlassTrack);
1636
- return undefined;
1637
- }
1638
-
1639
- const orientationToPositions = {
1640
- '1d-horizontal': ['top', 'bottom', 'left', 'right'],
1641
- '2d': ['center'],
1642
- '1d-vertical': ['left', 'right'],
1643
- };
1644
-
1645
- const defaultTracks = DEFAULT_TRACKS_FOR_DATATYPE[datatype] || {};
2105
+ const defaultTracks = getDefaultTracksForDataType(
2106
+ datatype,
2107
+ evtJson.defaultTracks,
2108
+ );
1646
2109
 
1647
- if (evtJson.defaultTracks) {
1648
- for (const trackType of evtJson.defaultTracks) {
1649
- if (!TRACKS_INFO_BY_TYPE[trackType]) {
1650
- console.warn('unknown track type', trackType);
1651
- } else {
1652
- for (const position of orientationToPositions[
1653
- TRACKS_INFO_BY_TYPE[trackType].orientation
1654
- ]) {
1655
- defaultTracks[position] = trackType;
1656
- }
1657
- }
1658
- }
2110
+ if (!defaultTracks) {
2111
+ return null;
1659
2112
  }
1660
2113
 
1661
2114
  const presentTracks = new Set(
@@ -1856,12 +2309,13 @@ export class TiledPlot extends React.Component {
1856
2309
  const verticalPadding = this.props.paddingTop + this.props.paddingBottom;
1857
2310
  const horizontalPadding = this.props.paddingLeft + this.props.paddingRight;
1858
2311
 
2312
+ // Maintain at least 1 minimum center width to avoid degenerate (range: [0,0]) scales
1859
2313
  this.centerHeight = Math.max(
1860
- 0,
2314
+ 1,
1861
2315
  this.state.height - this.topHeight - this.bottomHeight - verticalPadding,
1862
2316
  );
1863
2317
  this.centerWidth = Math.max(
1864
- 0,
2318
+ 1,
1865
2319
  this.state.width - this.leftWidth - this.rightWidth - horizontalPadding,
1866
2320
  );
1867
2321
 
@@ -2049,10 +2503,10 @@ export class TiledPlot extends React.Component {
2049
2503
 
2050
2504
  let centerTrack = (
2051
2505
  <div
2052
- className={[
2506
+ className={clsx(
2053
2507
  'center-track-container',
2054
2508
  stylesCenterTrack['center-track-container'],
2055
- ].join(' ')}
2509
+ )}
2056
2510
  style={{
2057
2511
  left: this.leftWidth + this.props.paddingLeft,
2058
2512
  top: this.topHeight + this.props.paddingTop,
@@ -2066,10 +2520,10 @@ export class TiledPlot extends React.Component {
2066
2520
  if (this.props.tracks.center.length) {
2067
2521
  centerTrack = (
2068
2522
  <div
2069
- className={[
2523
+ className={clsx(
2070
2524
  'center-track-container',
2071
2525
  stylesCenterTrack['center-track-container'],
2072
- ].join(' ')}
2526
+ )}
2073
2527
  style={{
2074
2528
  left: this.leftWidth + this.props.paddingLeft,
2075
2529
  top: this.topHeight + this.props.paddingTop,
@@ -2134,7 +2588,7 @@ export class TiledPlot extends React.Component {
2134
2588
  this.checkAllTilesetInfoReceived();
2135
2589
  }}
2136
2590
  // Custom props
2137
- canvasElement={this.canvasElement}
2591
+ canvasElement={this.props.canvasElement}
2138
2592
  centerHeight={this.centerHeight}
2139
2593
  centerWidth={this.centerWidth}
2140
2594
  disableTrackMenu={this.props.disableTrackMenu}
@@ -2201,6 +2655,7 @@ export class TiledPlot extends React.Component {
2201
2655
  ref={(c) => {
2202
2656
  this.configTrackMenu = c;
2203
2657
  }}
2658
+ apiPublish={this.props.apiPublish}
2204
2659
  closeMenu={this.closeMenusBound}
2205
2660
  onAddDivisor={this.handleAddDivisorBound}
2206
2661
  onAddSeries={this.handleAddSeriesBound}
@@ -2253,23 +2708,24 @@ export class TiledPlot extends React.Component {
2253
2708
  overlays = positionedTracks
2254
2709
  .filter((pTrack) => pTrack.track.position !== 'whole')
2255
2710
  .map((pTrack) => {
2256
- let background = 'transparent';
2257
- let border = 'none';
2711
+ let className = 'tiled-plot-track-overlay-animate';
2712
+
2713
+ if (this.state.mouseOverOverlayUid || this.props.overTrackChooser) {
2714
+ className = 'tiled-plot-track-overlay-plain';
2715
+ }
2258
2716
 
2259
2717
  if (this.state.mouseOverOverlayUid === pTrack.track.uid) {
2260
- background = 'yellow';
2261
- border = '1px solid black';
2718
+ className = 'tiled-plot-track-overlay-selected';
2262
2719
  }
2263
2720
 
2264
2721
  return (
2265
2722
  <div
2723
+ className={styles[className]}
2266
2724
  key={pTrack.track.uid}
2267
- className="tiled-plot-track-overlay"
2268
2725
  // we want to remove the mouseOverOverlayUid so that next time we try
2269
2726
  // to choose an overlay track, the previously selected one isn't
2270
2727
  // automatically highlighted
2271
-
2272
- onClick={() => this.handleTrackPositionChosen(pTrack)}
2728
+ onClick={(evt) => this.handleTrackPositionChosen(pTrack, evt)}
2273
2729
  onDragEnter={(evt) => {
2274
2730
  this.handleOverlayMouseEnter(pTrack.track.uid);
2275
2731
  evt.preventDefault();
@@ -2289,9 +2745,6 @@ export class TiledPlot extends React.Component {
2289
2745
  top: pTrack.top,
2290
2746
  width: pTrack.width,
2291
2747
  height: pTrack.height,
2292
- background,
2293
- opacity: 0.4,
2294
- border,
2295
2748
  zIndex: 1,
2296
2749
  }}
2297
2750
  />
@@ -2339,7 +2792,8 @@ export class TiledPlot extends React.Component {
2339
2792
  ref={(c) => {
2340
2793
  this.divTiledPlot = c;
2341
2794
  }}
2342
- className={['tiled-plot-div', styles['tiled-plot']].join(' ')}
2795
+ className={clsx('tiled-plot-div', styles['tiled-plot'])}
2796
+ onClick={this.handleClickBound}
2343
2797
  style={{
2344
2798
  marginBottom: this.props.marginBottom,
2345
2799
  marginLeft: this.props.marginLeft,
@@ -2378,13 +2832,13 @@ export class TiledPlot extends React.Component {
2378
2832
 
2379
2833
  TiledPlot.defaultProps = {
2380
2834
  isShowGlobalMousePosition: false,
2381
- pluginDataFetchers: {},
2382
2835
  pluginTracks: {},
2383
2836
  metaTracks: [],
2384
2837
  zoomable: true,
2385
2838
  };
2386
2839
 
2387
2840
  TiledPlot.propTypes = {
2841
+ addTrackExtent: PropTypes.string,
2388
2842
  addTrackPosition: PropTypes.string,
2389
2843
  canvasElement: PropTypes.object,
2390
2844
  chooseTrackHandler: PropTypes.func,
@@ -2431,7 +2885,6 @@ TiledPlot.propTypes = {
2431
2885
  openModal: PropTypes.func,
2432
2886
  pixiRenderer: PropTypes.object,
2433
2887
  pixiStage: PropTypes.object,
2434
- pluginDataFetchers: PropTypes.object,
2435
2888
  pluginTracks: PropTypes.object,
2436
2889
  pubSub: PropTypes.object.isRequired,
2437
2890
  rangeSelection1dSize: PropTypes.array,