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
@@ -67,6 +67,7 @@ export 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 @@ export 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 @@ export 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,
@@ -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?.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';
@@ -418,7 +419,10 @@ class Annotations2dTrack extends TiledPixiTrack {
418
419
  prevUid = this.selectedAnno.uid;
419
420
  }
420
421
 
421
- this.selectedAnno = { graphics, uid };
422
+ this.selectedAnno = {
423
+ graphics,
424
+ uid,
425
+ };
422
426
  this.focus(graphics, viewPos, uid);
423
427
 
424
428
  if (this.options.onSelect && !silent) {
@@ -467,7 +471,10 @@ class Annotations2dTrack extends TiledPixiTrack {
467
471
 
468
472
  this.visibleAndFetchedTiles()
469
473
  .filter((tile) => tile.tileData?.length)
470
- .map((tile) => ({ graphics: tile.graphics, td: tile.tileData }))
474
+ .map((tile) => ({
475
+ graphics: tile.graphics,
476
+ td: tile.tileData,
477
+ }))
471
478
  .forEach(({ td, graphics }) => {
472
479
  const gTile = document.createElement('g');
473
480
 
@@ -1,9 +1,7 @@
1
1
  // @ts-nocheck
2
2
 
3
- import scrollIntoView from 'dom-scroll-into-view';
4
3
  import PropTypes from 'prop-types';
5
4
  import React from 'react';
6
- import { findDOMNode } from 'react-dom';
7
5
 
8
6
  const _debugStates = [];
9
7
 
@@ -142,13 +140,7 @@ class Autocomplete extends React.Component {
142
140
  maybeScrollItemIntoView() {
143
141
  if (this.state.isOpen === true && this.state.highlightedIndex !== null) {
144
142
  const itemNode = this.refs[`item-${this.state.highlightedIndex}`];
145
-
146
- const menuNode = this.refs.menu;
147
- if (itemNode) {
148
- scrollIntoView(findDOMNode(itemNode), findDOMNode(menuNode), {
149
- onlyScrollIfNeeded: true,
150
- });
151
- }
143
+ itemNode?.scrollIntoView({ block: 'nearest', behavior: 'smooth' });
152
144
  }
153
145
  }
154
146