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.
- package/app/scripts/AddTrackDialog.jsx +8 -1
- package/app/scripts/AddTrackPositionMenu.jsx +26 -5
- package/app/scripts/Annotations1dTrack.js +90 -251
- package/app/scripts/Annotations2dTrack.js +9 -2
- package/app/scripts/Autocomplete.jsx +1 -9
- package/app/scripts/BedLikeTrack.js +549 -441
- package/app/scripts/ContextMenuContainer.jsx +3 -0
- package/app/scripts/ContextMenuItem.jsx +13 -2
- package/app/scripts/FilledLine.js +349 -0
- package/app/scripts/GenomePositionSearchBox.jsx +178 -477
- package/app/scripts/HiGlassComponent.jsx +443 -349
- package/app/scripts/HiGlassComponentContext.js +5 -0
- package/app/scripts/SeriesListMenu.jsx +94 -44
- package/app/scripts/SeriesListSubmenuMixin.jsx +1 -0
- package/app/scripts/Tiled1DPixiTrack.js +0 -1
- package/app/scripts/TiledPixiTrack.js +72 -63
- package/app/scripts/TiledPlot.jsx +530 -77
- package/app/scripts/TrackRenderer.jsx +2 -2
- package/app/scripts/ViewContextMenu.jsx +50 -2
- package/app/scripts/ViewHeader.jsx +3 -2
- package/app/scripts/api.js +87 -6
- package/app/scripts/configs/index.js +6 -1
- package/app/scripts/configs/primitives.js +2 -0
- package/app/scripts/configs/tracks-info.js +1 -0
- package/app/scripts/data-fetchers/genbank-fetcher.js +9 -14
- package/app/scripts/data-fetchers/local-tile-fetcher.js +8 -2
- package/app/scripts/hglib.jsx +61 -70
- package/app/scripts/options-info.js +49 -11
- package/app/scripts/services/tile-proxy.js +0 -4
- package/app/scripts/services/worker.js +1 -0
- package/app/scripts/test-helpers/index.js +2 -1
- package/app/scripts/test-helpers/test-helpers.jsx +154 -66
- package/app/scripts/types.ts +68 -3
- package/app/scripts/utils/copy-text-to-clipboard.js +36 -0
- package/app/scripts/utils/decompress.js +33 -0
- package/app/scripts/utils/default-tracks.js +46 -0
- package/app/scripts/utils/get-default-track-for-datatype.js +2 -1
- package/app/scripts/utils/get-default-tracks-for-datatype.ts +46 -0
- package/app/scripts/utils/index.js +1 -0
- package/app/scripts/utils/positioned-tracks-to-all-tracks.js +55 -0
- package/app/scripts/utils/show-mouse-position.js +0 -16
- package/app/scripts/utils/visit-positioned-tracks.js +4 -1
- package/app/styles/AddTrackPositionMenu.module.scss +37 -0
- package/app/styles/HiGlass.module.scss +3 -1
- package/app/styles/TiledPlot.module.scss +20 -0
- package/dist/app/schema.json +525 -0
- package/dist/app/scripts/AddTrackDialog.d.ts +64 -0
- package/dist/app/scripts/AddTrackPositionMenu.d.ts +5 -0
- package/dist/app/scripts/Annotations1dTrack.d.ts +15 -0
- package/dist/app/scripts/Annotations2dTrack.d.ts +95 -0
- package/dist/app/scripts/ArrowheadDomainsTrack.d.ts +36 -0
- package/dist/app/scripts/Autocomplete.d.ts +102 -0
- package/dist/app/scripts/AxisPixi.d.ts +25 -0
- package/dist/app/scripts/BarTrack.d.ts +28 -0
- package/dist/app/scripts/BedLikeTrack.d.ts +84 -0
- package/dist/app/scripts/Button.d.ts +3 -0
- package/dist/app/scripts/CNVIntervalTrack.d.ts +12 -0
- package/dist/app/scripts/CenterTiledPlot.d.ts +3 -0
- package/dist/app/scripts/CenterTrack.d.ts +92 -0
- package/dist/app/scripts/Chromosome2DAnnotations.d.ts +10 -0
- package/dist/app/scripts/Chromosome2DLabels.d.ts +13 -0
- package/dist/app/scripts/ChromosomeGrid.d.ts +24 -0
- package/dist/app/scripts/ChromosomeInfo.d.ts +14 -0
- package/dist/app/scripts/CloseTrackMenu.d.ts +10 -0
- package/dist/app/scripts/CombinedTrack.d.ts +32 -0
- package/dist/app/scripts/ConfigTrackMenu.d.ts +10 -0
- package/dist/app/scripts/ConfigViewMenu.d.ts +34 -0
- package/dist/app/scripts/ConfigureSeriesMenu.d.ts +3 -0
- package/dist/app/scripts/ContextMenuContainer.d.ts +36 -0
- package/dist/app/scripts/ContextMenuItem.d.ts +34 -0
- package/dist/app/scripts/Cross.d.ts +3 -0
- package/dist/app/scripts/CrossRule.d.ts +24 -0
- package/dist/app/scripts/CustomTrackDialog.d.ts +17 -0
- package/dist/app/scripts/Dialog.d.ts +5 -0
- package/dist/app/scripts/DivergentBarTrack.d.ts +4 -0
- package/dist/app/scripts/DragListeningDiv.d.ts +32 -0
- package/dist/app/scripts/DraggableDiv.d.ts +63 -0
- package/dist/app/scripts/ExportLinkDialog.d.ts +21 -0
- package/dist/app/scripts/FilledLine.d.ts +5 -0
- package/dist/app/scripts/FixedTrack.d.ts +5 -0
- package/dist/app/scripts/GalleryTracks.d.ts +20 -0
- package/dist/app/scripts/GenomePositionSearchBox.d.ts +95 -0
- package/dist/app/scripts/HeatmapOptions.d.ts +30 -0
- package/dist/app/scripts/HeatmapTiledPixiTrack.d.ts +184 -0
- package/dist/app/scripts/HiGlassComponent.d.ts +762 -0
- package/dist/app/scripts/HiGlassComponentContext.d.ts +3 -0
- package/dist/app/scripts/HiGlassTrackComponent.d.ts +37 -0
- package/dist/app/scripts/Horizontal1dHeatmapTrack.d.ts +9 -0
- package/dist/app/scripts/Horizontal2DDomainsTrack.d.ts +21 -0
- package/dist/app/scripts/HorizontalChromosomeLabels.d.ts +47 -0
- package/dist/app/scripts/HorizontalGeneAnnotationsTrack.d.ts +25 -0
- package/dist/app/scripts/HorizontalHeatmapTrack.d.ts +12 -0
- package/dist/app/scripts/HorizontalItem.d.ts +3 -0
- package/dist/app/scripts/HorizontalLine1DPixiTrack.d.ts +23 -0
- package/dist/app/scripts/HorizontalMultivecTrack.d.ts +50 -0
- package/dist/app/scripts/HorizontalPoint1DPixiTrack.d.ts +5 -0
- package/dist/app/scripts/HorizontalRule.d.ts +22 -0
- package/dist/app/scripts/HorizontalTiled1DPixiTrack.d.ts +26 -0
- package/dist/app/scripts/HorizontalTiledPlot.d.ts +49 -0
- package/dist/app/scripts/HorizontalTrack.d.ts +6 -0
- package/dist/app/scripts/Id2DTiledPixiTrack.d.ts +10 -0
- package/dist/app/scripts/IdHorizontal1DTiledPixiTrack.d.ts +6 -0
- package/dist/app/scripts/IdVertical1DTiledPixiTrack.d.ts +7 -0
- package/dist/app/scripts/LeftAxisTrack.d.ts +9 -0
- package/dist/app/scripts/LeftTrackModifier.d.ts +29 -0
- package/dist/app/scripts/ListWrapper.d.ts +64 -0
- package/dist/app/scripts/MapboxTilesTrack.d.ts +9 -0
- package/dist/app/scripts/Modal.d.ts +5 -0
- package/dist/app/scripts/MoveableTrack.d.ts +18 -0
- package/dist/app/scripts/NestedContextMenu.d.ts +7 -0
- package/dist/app/scripts/OSMTileIdsTrack.d.ts +5 -0
- package/dist/app/scripts/OSMTilesTrack.d.ts +129 -0
- package/dist/app/scripts/OverlayTrack.d.ts +13 -0
- package/dist/app/scripts/PixiTrack.d.ts +174 -0
- package/dist/app/scripts/PlotTypeChooser.d.ts +25 -0
- package/dist/app/scripts/PopupMenu.d.ts +28 -0
- package/dist/app/scripts/RasterTilesTrack.d.ts +9 -0
- package/dist/app/scripts/RuleMixin.d.ts +2 -0
- package/dist/app/scripts/SVGTrack.d.ts +15 -0
- package/dist/app/scripts/SearchField.d.ts +13 -0
- package/dist/app/scripts/SeriesListItems.d.ts +2 -0
- package/dist/app/scripts/SeriesListMenu.d.ts +51 -0
- package/dist/app/scripts/SeriesListSubmenuMixin.d.ts +2 -0
- package/dist/app/scripts/SketchInlinePicker.d.ts +25 -0
- package/dist/app/scripts/SortableList.d.ts +22 -0
- package/dist/app/scripts/SquareMarkersTrack.d.ts +22 -0
- package/dist/app/scripts/Tiled1DPixiTrack.d.ts +60 -0
- package/dist/app/scripts/TiledPixiTrack.d.ts +369 -0
- package/dist/app/scripts/TiledPlot.d.ts +313 -0
- package/dist/app/scripts/TilesetFinder.d.ts +65 -0
- package/dist/app/scripts/TopAxisTrack.d.ts +9 -0
- package/dist/app/scripts/Track.d.ts +196 -0
- package/dist/app/scripts/TrackArea.d.ts +26 -0
- package/dist/app/scripts/TrackControl.d.ts +5 -0
- package/dist/app/scripts/TrackRenderer.d.ts +724 -0
- package/dist/app/scripts/UnknownPixiTrack.d.ts +7 -0
- package/dist/app/scripts/ValueIntervalTrack.d.ts +6 -0
- package/dist/app/scripts/VerticalItem.d.ts +3 -0
- package/dist/app/scripts/VerticalRule.d.ts +21 -0
- package/dist/app/scripts/VerticalTiled1DPixiTrack.d.ts +6 -0
- package/dist/app/scripts/VerticalTiledPlot.d.ts +50 -0
- package/dist/app/scripts/VerticalTrack.d.ts +6 -0
- package/dist/app/scripts/ViewConfigEditor.d.ts +53 -0
- package/dist/app/scripts/ViewContextMenu.d.ts +17 -0
- package/dist/app/scripts/ViewHeader.d.ts +75 -0
- package/dist/app/scripts/ViewportTracker2D.d.ts +17 -0
- package/dist/app/scripts/ViewportTracker2DPixi.d.ts +11 -0
- package/dist/app/scripts/ViewportTrackerHorizontal.d.ts +17 -0
- package/dist/app/scripts/ViewportTrackerVertical.d.ts +17 -0
- package/dist/app/scripts/api.d.ts +640 -0
- package/dist/app/scripts/configs/available-track-types.d.ts +2 -0
- package/dist/app/scripts/configs/colormaps.d.ts +2 -0
- package/dist/app/scripts/configs/datatype-to-track-type.d.ts +4 -0
- package/dist/app/scripts/configs/default-tracks-for-datatype.d.ts +38 -0
- package/dist/app/scripts/configs/dense-data-extrema-config.d.ts +2 -0
- package/dist/app/scripts/configs/globals.d.ts +5 -0
- package/dist/app/scripts/configs/index.d.ts +16 -0
- package/dist/app/scripts/configs/positions-by-datatype.d.ts +2 -0
- package/dist/app/scripts/configs/primitives.d.ts +20 -0
- package/dist/app/scripts/configs/themes.d.ts +3 -0
- package/dist/app/scripts/configs/tracks-info-by-type.d.ts +4 -0
- package/dist/app/scripts/configs/tracks-info.d.ts +24 -0
- package/dist/app/scripts/d3-context-menu.d.ts +2 -0
- package/dist/app/scripts/data-fetchers/DataFetcher.d.ts +151 -0
- package/dist/app/scripts/data-fetchers/genbank-fetcher.d.ts +86 -0
- package/dist/app/scripts/data-fetchers/index.d.ts +3 -0
- package/dist/app/scripts/data-fetchers/local-tile-fetcher.d.ts +47 -0
- package/dist/app/scripts/gosling-exports.d.ts +17 -0
- package/dist/app/scripts/hglib.d.ts +24 -0
- package/dist/app/scripts/hocs/with-modal.d.ts +19 -0
- package/dist/app/scripts/hocs/with-pub-sub.d.ts +22 -0
- package/dist/app/scripts/hocs/with-theme.d.ts +13 -0
- package/dist/app/scripts/icons.d.ts +161 -0
- package/dist/app/scripts/mixwith.d.ts +27 -0
- package/dist/app/scripts/options-info.d.ts +1355 -0
- package/dist/app/scripts/plugins/available-for-plugins.d.ts +2338 -0
- package/dist/app/scripts/plugins/get-data-fetcher.d.ts +2 -0
- package/dist/app/scripts/plugins/index.d.ts +2 -0
- package/dist/app/scripts/services/chrom-info.d.ts +10 -0
- package/dist/app/scripts/services/dom-event.d.ts +7 -0
- package/dist/app/scripts/services/element-resize-listener.d.ts +5 -0
- package/dist/app/scripts/services/index.d.ts +5 -0
- package/dist/app/scripts/services/tile-proxy.d.ts +180 -0
- package/dist/app/scripts/services/worker.d.ts +157 -0
- package/dist/app/scripts/symbol.d.ts +13 -0
- package/dist/app/scripts/test-helpers/index.d.ts +1 -0
- package/dist/app/scripts/test-helpers/test-helpers.d.ts +33 -0
- package/dist/app/scripts/track-utils.d.ts +73 -0
- package/dist/app/scripts/types.d.ts +199 -0
- package/dist/app/scripts/utils/DenseDataExtrema1D.d.ts +88 -0
- package/dist/app/scripts/utils/DenseDataExtrema2D.d.ts +97 -0
- package/dist/app/scripts/utils/LruCache.d.ts +44 -0
- package/dist/app/scripts/utils/abs-to-chr.d.ts +14 -0
- package/dist/app/scripts/utils/accessor-transposition.d.ts +14 -0
- package/dist/app/scripts/utils/add-arrays.d.ts +18 -0
- package/dist/app/scripts/utils/add-class.d.ts +8 -0
- package/dist/app/scripts/utils/add-event-listener-once.d.ts +11 -0
- package/dist/app/scripts/utils/assert.d.ts +17 -0
- package/dist/app/scripts/utils/background-task-scheduler.d.ts +47 -0
- package/dist/app/scripts/utils/base64-to-canvas.d.ts +9 -0
- package/dist/app/scripts/utils/chr-to-abs.d.ts +10 -0
- package/dist/app/scripts/utils/chrom-info-bisector.d.ts +4 -0
- package/dist/app/scripts/utils/clone-event.d.ts +12 -0
- package/dist/app/scripts/utils/color-domain-to-rgba-array.d.ts +13 -0
- package/dist/app/scripts/utils/color-to-hex.d.ts +9 -0
- package/dist/app/scripts/utils/color-to-rgba.d.ts +9 -0
- package/dist/app/scripts/utils/copy-text-to-clipboard.d.ts +2 -0
- package/dist/app/scripts/utils/data-to-genomic-loci.d.ts +11 -0
- package/dist/app/scripts/utils/debounce.d.ts +5 -0
- package/dist/app/scripts/utils/dec-to-hex-str.d.ts +8 -0
- package/dist/app/scripts/utils/decompress.d.ts +27 -0
- package/dist/app/scripts/utils/default-tracks.d.ts +3 -0
- package/dist/app/scripts/utils/dict-from-tuples.d.ts +11 -0
- package/dist/app/scripts/utils/dict-items.d.ts +18 -0
- package/dist/app/scripts/utils/dict-keys.d.ts +10 -0
- package/dist/app/scripts/utils/dict-values.d.ts +8 -0
- package/dist/app/scripts/utils/download.d.ts +7 -0
- package/dist/app/scripts/utils/expand-combined-tracks.d.ts +11 -0
- package/dist/app/scripts/utils/fake-pub-sub.d.ts +11 -0
- package/dist/app/scripts/utils/fill-in-min-widths.d.ts +44 -0
- package/dist/app/scripts/utils/flatten.d.ts +9 -0
- package/dist/app/scripts/utils/for-each.d.ts +9 -0
- package/dist/app/scripts/utils/forward-event.d.ts +7 -0
- package/dist/app/scripts/utils/genome-loci-to-pixels.d.ts +9 -0
- package/dist/app/scripts/utils/genomic-range-to-chromosome-chunks.d.ts +21 -0
- package/dist/app/scripts/utils/get-aggregation-function.d.ts +10 -0
- package/dist/app/scripts/utils/get-default-track-for-datatype.d.ts +21 -0
- package/dist/app/scripts/utils/get-default-tracks-for-datatype.d.ts +3 -0
- package/dist/app/scripts/utils/get-element-dim.d.ts +7 -0
- package/dist/app/scripts/utils/get-higlass-components.d.ts +7 -0
- package/dist/app/scripts/utils/get-track-by-uid.d.ts +7 -0
- package/dist/app/scripts/utils/get-track-conf-from-hgc.d.ts +10 -0
- package/dist/app/scripts/utils/get-track-obj-by-id.d.ts +2 -0
- package/dist/app/scripts/utils/get-track-position-by-uid.d.ts +13 -0
- package/dist/app/scripts/utils/get-xylofon.d.ts +2 -0
- package/dist/app/scripts/utils/gradient.d.ts +14 -0
- package/dist/app/scripts/utils/has-class.d.ts +8 -0
- package/dist/app/scripts/utils/has-parent.d.ts +9 -0
- package/dist/app/scripts/utils/hex-string-to-int.d.ts +14 -0
- package/dist/app/scripts/utils/index.d.ts +89 -0
- package/dist/app/scripts/utils/interval-tree.d.ts +109 -0
- package/dist/app/scripts/utils/into-the-void.d.ts +6 -0
- package/dist/app/scripts/utils/is-track-or-child-track.d.ts +7 -0
- package/dist/app/scripts/utils/is-track-range-selectable.d.ts +2 -0
- package/dist/app/scripts/utils/is-within.d.ts +12 -0
- package/dist/app/scripts/utils/lat-to-y.d.ts +9 -0
- package/dist/app/scripts/utils/lng-to-x.d.ts +8 -0
- package/dist/app/scripts/utils/load-chrom-infos.d.ts +8 -0
- package/dist/app/scripts/utils/map.d.ts +13 -0
- package/dist/app/scripts/utils/max-non-zero.d.ts +6 -0
- package/dist/app/scripts/utils/max.d.ts +10 -0
- package/dist/app/scripts/utils/min-non-zero.d.ts +6 -0
- package/dist/app/scripts/utils/min.d.ts +10 -0
- package/dist/app/scripts/utils/mod.d.ts +9 -0
- package/dist/app/scripts/utils/ndarray-assign.d.ts +2 -0
- package/dist/app/scripts/utils/ndarray-flatten.d.ts +2 -0
- package/dist/app/scripts/utils/ndarray-to-list.d.ts +2 -0
- package/dist/app/scripts/utils/numericify-version.d.ts +6 -0
- package/dist/app/scripts/utils/obj-vals.d.ts +8 -0
- package/dist/app/scripts/utils/or.d.ts +8 -0
- package/dist/app/scripts/utils/parse-chromsizes-rows.d.ts +34 -0
- package/dist/app/scripts/utils/pixi-text-to-svg.d.ts +2 -0
- package/dist/app/scripts/utils/positioned-tracks-to-all-tracks.d.ts +26 -0
- package/dist/app/scripts/utils/q.d.ts +18 -0
- package/dist/app/scripts/utils/rad-to-deg.d.ts +7 -0
- package/dist/app/scripts/utils/range-query-2d.d.ts +17 -0
- package/dist/app/scripts/utils/reduce.d.ts +14 -0
- package/dist/app/scripts/utils/rel-to-abs-chrom-pos.d.ts +10 -0
- package/dist/app/scripts/utils/remove-class.d.ts +7 -0
- package/dist/app/scripts/utils/reset-d3-brush-style.d.ts +10 -0
- package/dist/app/scripts/utils/rgb-to-hex.d.ts +8 -0
- package/dist/app/scripts/utils/scales-center-and-k.d.ts +12 -0
- package/dist/app/scripts/utils/scales-to-genome-loci.d.ts +3 -0
- package/dist/app/scripts/utils/segments-to-rows.d.ts +15 -0
- package/dist/app/scripts/utils/selected-items-to-cum-weights.d.ts +12 -0
- package/dist/app/scripts/utils/selected-items-to-size.d.ts +13 -0
- package/dist/app/scripts/utils/show-mouse-position.d.ts +54 -0
- package/dist/app/scripts/utils/some.d.ts +10 -0
- package/dist/app/scripts/utils/sum.d.ts +8 -0
- package/dist/app/scripts/utils/svg-line.d.ts +2 -0
- package/dist/app/scripts/utils/throttle-and-debounce.d.ts +33 -0
- package/dist/app/scripts/utils/tile-to-canvas.d.ts +9 -0
- package/dist/app/scripts/utils/timeout.d.ts +3 -0
- package/dist/app/scripts/utils/to-void.d.ts +3 -0
- package/dist/app/scripts/utils/total-track-pixel-height.d.ts +27 -0
- package/dist/app/scripts/utils/trim-trailing-slash.d.ts +7 -0
- package/dist/app/scripts/utils/type-guards.d.ts +36 -0
- package/dist/app/scripts/utils/value-to-color.d.ts +12 -0
- package/dist/app/scripts/utils/visit-positioned-tracks.d.ts +18 -0
- package/dist/app/scripts/utils/visit-tracks.d.ts +9 -0
- package/dist/esm.html +1 -3
- package/dist/hglib.js +65302 -79868
- package/dist/hglib.min.js +104 -112
- package/dist/higlass.mjs +64214 -78780
- package/dist/index.html +1 -3
- package/dist/package.json +134 -0
- package/package.json +13 -10
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import clsx from 'clsx';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
|
|
@@ -12,32 +11,51 @@ import OPTIONS_INFO from './options-info';
|
|
|
12
11
|
|
|
13
12
|
// Styles
|
|
14
13
|
import classes from '../styles/ContextMenu.module.scss';
|
|
14
|
+
import { isObject } from './utils/type-guards';
|
|
15
|
+
|
|
16
|
+
/** @import * as t from './types' */
|
|
17
|
+
/** @import { TrackRenderer } from './TrackRenderer' */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @typedef ContextMenuHandler
|
|
21
|
+
* @property {string} label
|
|
22
|
+
* @property {(evt: unknown, onTrackOptionsChanged: (options: Record<string, unknown>) => void) => void} onClick
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {unknown} x
|
|
27
|
+
* @returns {x is { contextMenuItems: (trackLeft: number, trackRight: number) => Array<ContextMenuHandler> }}}
|
|
28
|
+
*/
|
|
29
|
+
function hasContextMenuItems(x) {
|
|
30
|
+
return (
|
|
31
|
+
isObject(x) &&
|
|
32
|
+
'contextMenuItems' in x &&
|
|
33
|
+
typeof x.contextMenuItems === 'function'
|
|
34
|
+
);
|
|
35
|
+
}
|
|
15
36
|
|
|
16
37
|
/**
|
|
17
38
|
* We're going to get the track object to see if it has a
|
|
18
39
|
* context menu handler that will give use context menu items
|
|
19
40
|
* to display
|
|
20
41
|
*
|
|
21
|
-
* @param
|
|
42
|
+
* @param {t.TrackConfig} track The config for the track we're getting context menu
|
|
22
43
|
* items for
|
|
23
|
-
*
|
|
24
|
-
* @param (TrackRenderer) trackRenderer The track renderer for the view
|
|
44
|
+
* @param {TrackRenderer} trackRenderer The track renderer for the view
|
|
25
45
|
* containing this track. We'll use it to get the track's object
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* to left and top coordinates.
|
|
46
|
+
* @param {{canvasLeft: number, canvasTop: number}} position The position of the track.
|
|
47
|
+
* Where the track starts relative to the canvas. This is important because all
|
|
48
|
+
* coordinates within a track are relative to left and top coordinates.
|
|
49
|
+
* @returns {Array<ContextMenuHandler>}
|
|
31
50
|
*/
|
|
32
|
-
|
|
33
51
|
function findTrackContextMenuItems(track, trackRenderer, position) {
|
|
34
52
|
let trackObj = trackRenderer.getTrackObject(track.uid);
|
|
35
53
|
|
|
36
54
|
// The track may be a LeftTrackModifier track
|
|
37
|
-
trackObj = trackObj
|
|
55
|
+
trackObj = trackObj?.originalTrack || trackObj;
|
|
38
56
|
|
|
39
57
|
// See if the track will provide us with context menu items
|
|
40
|
-
if (trackObj
|
|
58
|
+
if (hasContextMenuItems(trackObj)) {
|
|
41
59
|
let trackLeft = position.canvasLeft - trackObj.position[0];
|
|
42
60
|
let trackTop = position.canvasTop - trackObj.position[1];
|
|
43
61
|
|
|
@@ -59,8 +77,22 @@ function findTrackContextMenuItems(track, trackRenderer, position) {
|
|
|
59
77
|
return [];
|
|
60
78
|
}
|
|
61
79
|
|
|
80
|
+
/**
|
|
81
|
+
* @typedef MenuItem
|
|
82
|
+
* @property {string} name
|
|
83
|
+
* @property {string} [value]
|
|
84
|
+
* @property {Record<string, unknown>} [children]
|
|
85
|
+
* @property {() => void} [handler]
|
|
86
|
+
*/
|
|
87
|
+
|
|
62
88
|
export default class SeriesListMenu extends ContextMenuContainer {
|
|
89
|
+
/**
|
|
90
|
+
* @param {unknown} position
|
|
91
|
+
* @param {unknown} bbox
|
|
92
|
+
* @param {{ type: string, options: Record<string, unknown>, uid: string, }} track
|
|
93
|
+
*/
|
|
63
94
|
getConfigureSeriesMenu(position, bbox, track) {
|
|
95
|
+
/** @type {Record<string, MenuItem>} */
|
|
64
96
|
const menuItems = {};
|
|
65
97
|
|
|
66
98
|
// plugin tracks can offer their own options
|
|
@@ -73,26 +105,27 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
73
105
|
|
|
74
106
|
if (pluginOptionsInfo) {
|
|
75
107
|
for (const key of Object.keys(pluginOptionsInfo)) {
|
|
108
|
+
// @ts-expect-error - extends OPTIONS_INFO with new data
|
|
76
109
|
OPTIONS_INFO[key] = pluginOptionsInfo[key];
|
|
77
110
|
}
|
|
78
111
|
}
|
|
79
112
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
) {
|
|
113
|
+
const trackinfo = TRACKS_INFO_BY_TYPE[track.type];
|
|
114
|
+
|
|
115
|
+
if (!trackinfo?.availableOptions) {
|
|
84
116
|
return null;
|
|
85
117
|
}
|
|
86
118
|
|
|
87
|
-
for (const optionType of
|
|
119
|
+
for (const optionType of trackinfo.availableOptions) {
|
|
88
120
|
if (optionType in OPTIONS_INFO) {
|
|
89
|
-
|
|
121
|
+
const optionInfo =
|
|
122
|
+
OPTIONS_INFO[/** @type {keyof typeof OPTIONS_INFO} */ (optionType)];
|
|
123
|
+
menuItems[optionType] = { name: optionInfo.name };
|
|
90
124
|
|
|
91
125
|
// can we dynamically generate some options?
|
|
92
126
|
// should be used if the options depend on tileset info or other current state
|
|
93
|
-
if (
|
|
94
|
-
const generatedOptions =
|
|
95
|
-
OPTIONS_INFO[optionType].generateOptions(track);
|
|
127
|
+
if ('generateOptions' in optionInfo) {
|
|
128
|
+
const generatedOptions = optionInfo.generateOptions(track);
|
|
96
129
|
|
|
97
130
|
if (!menuItems[optionType].children) {
|
|
98
131
|
menuItems[optionType].children = {};
|
|
@@ -114,12 +147,11 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
114
147
|
}
|
|
115
148
|
}
|
|
116
149
|
|
|
117
|
-
if (
|
|
150
|
+
if ('inlineOptions' in optionInfo) {
|
|
118
151
|
// we can simply select this option from the menu
|
|
119
|
-
for (const inlineOptionKey in
|
|
120
|
-
|
|
121
|
-
const inlineOption =
|
|
122
|
-
OPTIONS_INFO[optionType].inlineOptions[inlineOptionKey];
|
|
152
|
+
for (const inlineOptionKey in optionInfo.inlineOptions) {
|
|
153
|
+
/** @type {Record<string, Record<string, { name: string, value: unknown }>>} */
|
|
154
|
+
const inlineOption = optionInfo.inlineOptions[inlineOptionKey];
|
|
123
155
|
|
|
124
156
|
// check if there's already available options (e.g.
|
|
125
157
|
// "Top right") for this option type (e.g. "Label
|
|
@@ -132,11 +164,15 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
132
164
|
name: inlineOption.name,
|
|
133
165
|
value: inlineOption.value,
|
|
134
166
|
// missing handler to be filled in below
|
|
167
|
+
handler: () => {},
|
|
135
168
|
};
|
|
136
169
|
|
|
137
170
|
// is there a custom component available for picking this
|
|
138
171
|
// option type value (e.g. 'custom' color scale)
|
|
139
|
-
if (
|
|
172
|
+
if (
|
|
173
|
+
inlineOption.componentPickers &&
|
|
174
|
+
track.type in inlineOption.componentPickers
|
|
175
|
+
) {
|
|
140
176
|
optionSelectorSettings.handler = () => {
|
|
141
177
|
this.props.onConfigureTrack(
|
|
142
178
|
track,
|
|
@@ -157,12 +193,14 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
157
193
|
menuItems[optionType].children[inlineOptionKey] =
|
|
158
194
|
optionSelectorSettings;
|
|
159
195
|
}
|
|
160
|
-
|
|
196
|
+
// @ts-expect-error - mutated from a plugin
|
|
197
|
+
} else if (track.type in optionInfo.componentPickers) {
|
|
161
198
|
// there's an option picker registered
|
|
162
199
|
menuItems[optionType].handler = () => {
|
|
163
200
|
this.props.onConfigureTrack(
|
|
164
201
|
track,
|
|
165
|
-
|
|
202
|
+
// @ts-expect-error - mutated from a plugin
|
|
203
|
+
optionInfo.componentPickers[track.type],
|
|
166
204
|
);
|
|
167
205
|
this.props.closeMenu();
|
|
168
206
|
};
|
|
@@ -189,23 +227,20 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
189
227
|
*
|
|
190
228
|
* @param {Object} position The position where to draw ths menu (e.g. {left: 42, top: 88})
|
|
191
229
|
*
|
|
192
|
-
* @param
|
|
230
|
+
* @param {Object} bbox
|
|
193
231
|
* The bounding box of the parent menu, used to determine whether
|
|
194
232
|
* to draw the child menu on the left or the right
|
|
195
233
|
*
|
|
196
|
-
* @param
|
|
234
|
+
* @param {{ uid: string, type: string, datatype: string }} track The track definition for this series (as in the viewconf)
|
|
197
235
|
*/
|
|
198
236
|
getTrackTypeItems(position, bbox, track) {
|
|
199
|
-
// get the datatype of the current track
|
|
200
|
-
//
|
|
201
|
-
|
|
202
237
|
// if we've loaded external track types, list them here
|
|
203
238
|
if (window.higlassTracksByType) {
|
|
204
239
|
// Extend `TRACKS_INFO_BY_TYPE` with the configs of plugin tracks.
|
|
205
|
-
Object.keys(window.higlassTracksByType)
|
|
240
|
+
for (const pluginTrackType of Object.keys(window.higlassTracksByType)) {
|
|
206
241
|
TRACKS_INFO_BY_TYPE[pluginTrackType] =
|
|
207
242
|
window.higlassTracksByType[pluginTrackType].config;
|
|
208
|
-
}
|
|
243
|
+
}
|
|
209
244
|
}
|
|
210
245
|
|
|
211
246
|
let { datatype } = track;
|
|
@@ -228,6 +263,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
228
263
|
.filter((x) => x.orientation === orientation)
|
|
229
264
|
.map((x) => x.type);
|
|
230
265
|
|
|
266
|
+
/** @type {Record<string, MenuItem>} */
|
|
231
267
|
const menuItems = {};
|
|
232
268
|
for (let i = 0; i < availableTrackTypes.length; i++) {
|
|
233
269
|
menuItems[availableTrackTypes[i]] = {
|
|
@@ -257,6 +293,8 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
257
293
|
// the bounding box of the element which initiated the subMenu
|
|
258
294
|
// necessary so that we can position the submenu next to the initiating
|
|
259
295
|
// element
|
|
296
|
+
/** @type {DOMRect} */
|
|
297
|
+
// @ts-expect-error - parent class ContextMenuContainer requires typing
|
|
260
298
|
const bbox = this.state.submenuSourceBbox;
|
|
261
299
|
const position =
|
|
262
300
|
this.state.orientation === 'left'
|
|
@@ -273,6 +311,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
273
311
|
// item that requested it provides a structure containing the option
|
|
274
312
|
// picked as well as some data associated with it
|
|
275
313
|
// e.g. {"option": "configure-series", data: track}
|
|
314
|
+
/** @type {{option: string, value: { uid: string, type: string, datatype: string, options: Record<string, unknown> }}} */
|
|
276
315
|
const subMenuData = this.state.submenuShown;
|
|
277
316
|
const track = subMenuData.value;
|
|
278
317
|
|
|
@@ -299,7 +338,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
299
338
|
onClick={() =>
|
|
300
339
|
this.props.onChangeTrackData(this.props.series.uid, newData)
|
|
301
340
|
}
|
|
302
|
-
onMouseEnter={(e) => this.handleOtherMouseEnter(
|
|
341
|
+
onMouseEnter={(e) => this.handleOtherMouseEnter()}
|
|
303
342
|
>
|
|
304
343
|
<span className={classes['context-menu-span']}>Remove divisor</span>
|
|
305
344
|
</ContextMenuItem>
|
|
@@ -310,7 +349,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
310
349
|
<ContextMenuItem
|
|
311
350
|
className={classes['context-menu-item']}
|
|
312
351
|
onClick={() => this.props.onAddDivisor(this.props.series)}
|
|
313
|
-
onMouseEnter={(e) => this.handleOtherMouseEnter(
|
|
352
|
+
onMouseEnter={(e) => this.handleOtherMouseEnter()}
|
|
314
353
|
>
|
|
315
354
|
<span className={classes['context-menu-span']}>Divide by</span>
|
|
316
355
|
</ContextMenuItem>
|
|
@@ -341,7 +380,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
341
380
|
this.props.track.uid,
|
|
342
381
|
)
|
|
343
382
|
}
|
|
344
|
-
onMouseEnter={(e) => this.handleOtherMouseEnter(
|
|
383
|
+
onMouseEnter={(e) => this.handleOtherMouseEnter()}
|
|
345
384
|
>
|
|
346
385
|
<span className={classes['context-menu-span']}>Export Data</span>
|
|
347
386
|
</ContextMenuItem>
|
|
@@ -357,7 +396,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
357
396
|
this.props.onCloseTrack(this.props.series.uid);
|
|
358
397
|
this.props.onAddSeries(this.props.hostTrack.uid);
|
|
359
398
|
}}
|
|
360
|
-
onMouseEnter={(e) => this.handleOtherMouseEnter(
|
|
399
|
+
onMouseEnter={(e) => this.handleOtherMouseEnter()}
|
|
361
400
|
>
|
|
362
401
|
<span className={classes['context-menu-span']}>Replace Series</span>
|
|
363
402
|
</ContextMenuItem>
|
|
@@ -392,7 +431,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
392
431
|
});
|
|
393
432
|
this.props.closeMenu();
|
|
394
433
|
}}
|
|
395
|
-
onMouseEnter={(e) => this.handleOtherMouseEnter(
|
|
434
|
+
onMouseEnter={(e) => this.handleOtherMouseEnter()}
|
|
396
435
|
className={classes['context-menu-item']}
|
|
397
436
|
>
|
|
398
437
|
<span className={classes['context-menu-span']}>{x.label}</span>
|
|
@@ -409,7 +448,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
409
448
|
value: this.props.track,
|
|
410
449
|
})
|
|
411
450
|
}
|
|
412
|
-
onMouseLeave={(e) => this.handleMouseLeave(
|
|
451
|
+
onMouseLeave={(e) => this.handleMouseLeave()}
|
|
413
452
|
>
|
|
414
453
|
Configure Series
|
|
415
454
|
<svg className={classes['play-icon']}>
|
|
@@ -427,7 +466,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
427
466
|
value: this.props.track,
|
|
428
467
|
})
|
|
429
468
|
}
|
|
430
|
-
onMouseLeave={(e) => this.handleMouseLeave(
|
|
469
|
+
onMouseLeave={(e) => this.handleMouseLeave()}
|
|
431
470
|
>
|
|
432
471
|
<span className={classes['context-menu-span']}>
|
|
433
472
|
Track Type
|
|
@@ -438,6 +477,17 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
438
477
|
</span>
|
|
439
478
|
</ContextMenuItem>
|
|
440
479
|
|
|
480
|
+
<ContextMenuItem
|
|
481
|
+
className={classes['context-menu-item']}
|
|
482
|
+
onClick={() => {
|
|
483
|
+
this.props.apiPublish('datasetInfo', this.props.track);
|
|
484
|
+
this.props.closeMenu();
|
|
485
|
+
}}
|
|
486
|
+
onMouseEnter={(e) => this.handleOtherMouseEnter()}
|
|
487
|
+
>
|
|
488
|
+
<span className={classes['context-menu-span']}>Dataset Info</span>
|
|
489
|
+
</ContextMenuItem>
|
|
490
|
+
|
|
441
491
|
{exportDataMenuItem}
|
|
442
492
|
|
|
443
493
|
{this.getDivideByMenuItem()}
|
|
@@ -445,7 +495,7 @@ export default class SeriesListMenu extends ContextMenuContainer {
|
|
|
445
495
|
<ContextMenuItem
|
|
446
496
|
className={classes['context-menu-item']}
|
|
447
497
|
onClick={this.props.onCloseTrack}
|
|
448
|
-
onMouseEnter={(e) => this.handleOtherMouseEnter(
|
|
498
|
+
onMouseEnter={(e) => this.handleOtherMouseEnter()}
|
|
449
499
|
>
|
|
450
500
|
<span className={classes['context-menu-span']}>Close Series</span>
|
|
451
501
|
</ContextMenuItem>
|
|
@@ -106,7 +106,6 @@ class Tiled1DPixiTrack extends TiledPixiTrack {
|
|
|
106
106
|
this._xScale,
|
|
107
107
|
this.tilesetInfo.min_pos[0],
|
|
108
108
|
this.tilesetInfo.max_pos[0],
|
|
109
|
-
this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size,
|
|
110
109
|
);
|
|
111
110
|
|
|
112
111
|
const tiles = xTiles.map((x) => [this.zoomLevel, x]);
|
|
@@ -94,6 +94,7 @@ export function getValueScale(
|
|
|
94
94
|
* @property {Float32Array} dense
|
|
95
95
|
* @property {number} minNonZero
|
|
96
96
|
* @property {number} maxNonZero
|
|
97
|
+
* @property {Array<number>} [shape] - Optional 1D or 2D array dimensions
|
|
97
98
|
*/
|
|
98
99
|
|
|
99
100
|
/**
|
|
@@ -104,7 +105,7 @@ export function getValueScale(
|
|
|
104
105
|
* asynchronous event occurs (i.e. tiles loaded)
|
|
105
106
|
* @property {() => void} onValueScaleChanged The range of values has changed so we need to inform
|
|
106
107
|
* the higher ups that the value scale has changed. Only occurs on tracks with ``dense`` data.
|
|
107
|
-
* @property {
|
|
108
|
+
* @property {(t: t.TilesetInfo) => void} [handleTilesetInfoReceived] A callback to do something once once the tileset
|
|
108
109
|
* info is received. Usually it registers some information about the tileset with its definition
|
|
109
110
|
*/
|
|
110
111
|
/**
|
|
@@ -191,7 +192,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
191
192
|
this.valueScaleMax = null;
|
|
192
193
|
this.fixedValueScaleMax = null;
|
|
193
194
|
|
|
194
|
-
/** @type {
|
|
195
|
+
/** @type {Record<string, Array<Function>>} */
|
|
195
196
|
this.listeners = {};
|
|
196
197
|
|
|
197
198
|
/** @type {import('pub-sub-es').PubSub & { __fake__?: boolean }} */
|
|
@@ -214,6 +215,8 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
214
215
|
/** @type {t.TilesetInfo} */
|
|
215
216
|
// @ts-expect-error This has to be initialized to null
|
|
216
217
|
this.tilesetInfo = null;
|
|
218
|
+
/** @type {null | string} */
|
|
219
|
+
this.tilesetInfoError = null;
|
|
217
220
|
this.uuid = slugid.nice();
|
|
218
221
|
|
|
219
222
|
// this needs to be above the tilesetInfo() call because if that
|
|
@@ -252,7 +255,9 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
252
255
|
tilesetInfo.error,
|
|
253
256
|
);
|
|
254
257
|
|
|
255
|
-
|
|
258
|
+
if (tilesetInfo.error) {
|
|
259
|
+
this.setError(tilesetInfo.error, 'dataFetcher.tilesetInfo');
|
|
260
|
+
}
|
|
256
261
|
// Fritz: Not sure why it's reset
|
|
257
262
|
// this.trackNotFoundText = '';
|
|
258
263
|
this.tilesetInfo = undefined;
|
|
@@ -293,12 +298,11 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
293
298
|
this.tilesetInfoReceived();
|
|
294
299
|
|
|
295
300
|
// Let external listeners know that tileset info was received
|
|
296
|
-
|
|
301
|
+
handleTilesetInfoReceived?.(this.tilesetInfo);
|
|
297
302
|
|
|
298
303
|
// @ts-expect-error This should never happen since options is set in Track
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
this.options.name = this.options.name || tilesetInfo.name;
|
|
304
|
+
this.options ??= {};
|
|
305
|
+
this.options.name = this.options.name || this.tilesetInfo.name;
|
|
302
306
|
|
|
303
307
|
this.checkValueScaleLimits();
|
|
304
308
|
|
|
@@ -308,11 +312,14 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
308
312
|
});
|
|
309
313
|
}
|
|
310
314
|
|
|
311
|
-
/**
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
315
|
+
/**
|
|
316
|
+
* @param {string} error
|
|
317
|
+
* @param {string} source
|
|
318
|
+
*/
|
|
319
|
+
setError(error, source) {
|
|
320
|
+
this.errorTexts[source] = error;
|
|
321
|
+
|
|
322
|
+
this.drawError();
|
|
316
323
|
}
|
|
317
324
|
|
|
318
325
|
/** @param {number | string} value */
|
|
@@ -368,12 +375,12 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
368
375
|
|
|
369
376
|
this.listeners[event].push(callback);
|
|
370
377
|
}
|
|
378
|
+
|
|
371
379
|
/**
|
|
372
380
|
* @param {string} event The event to listen for
|
|
373
381
|
* @param {function} callback The callback to call when the event occurs. The
|
|
374
382
|
* parameters for the event depend on the event called.
|
|
375
383
|
*/
|
|
376
|
-
|
|
377
384
|
off(event, callback) {
|
|
378
385
|
const id = this.listeners[event].indexOf(callback);
|
|
379
386
|
if (id === -1 || id >= this.listeners[event].length) return;
|
|
@@ -431,7 +438,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
431
438
|
/**
|
|
432
439
|
* Set which tiles are visible right now.
|
|
433
440
|
*
|
|
434
|
-
* @param {Array<TilePositionArrayObject>} tilePositions
|
|
441
|
+
* @param {Array<TilePositionArrayObject>} tilePositions - A set of tiles which will be considered the currently visible tile positions.
|
|
435
442
|
*/
|
|
436
443
|
setVisibleTiles(tilePositions) {
|
|
437
444
|
this.visibleTiles = tilePositions.map((x) => ({
|
|
@@ -465,6 +472,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
465
472
|
if (!this.tilesetInfo) {
|
|
466
473
|
return;
|
|
467
474
|
}
|
|
475
|
+
|
|
468
476
|
// @ts-expect-error Classes which extend TiledPixiTrack have this
|
|
469
477
|
this.calculateVisibleTiles();
|
|
470
478
|
|
|
@@ -602,7 +610,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
602
610
|
*/
|
|
603
611
|
allTilesLoaded() {}
|
|
604
612
|
|
|
605
|
-
/** @param {number} _ */
|
|
613
|
+
/** @param {number} [_] - Optional value to set */
|
|
606
614
|
minValue(_) {
|
|
607
615
|
if (_) {
|
|
608
616
|
this.scale.minValue = _;
|
|
@@ -613,7 +621,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
613
621
|
: this.scale.minValue;
|
|
614
622
|
}
|
|
615
623
|
|
|
616
|
-
/** @param {number} _ */
|
|
624
|
+
/** @param {number} [_] - Optional value to set */
|
|
617
625
|
maxValue(_) {
|
|
618
626
|
if (_) {
|
|
619
627
|
this.scale.maxValue = _;
|
|
@@ -638,6 +646,9 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
638
646
|
|
|
639
647
|
/** @param {Tile} tile */
|
|
640
648
|
initTile(tile) {
|
|
649
|
+
if (!tile.tileData?.dense) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
641
652
|
// create the tile
|
|
642
653
|
// should be overwritten by child classes
|
|
643
654
|
this.scale.minRawValue = this.continuousScaling
|
|
@@ -758,6 +769,9 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
758
769
|
|
|
759
770
|
/** @param {Pick<Tile,'remoteId'>[]} toFetch */
|
|
760
771
|
fetchNewTiles(toFetch) {
|
|
772
|
+
this._checkForErrors();
|
|
773
|
+
this.draw();
|
|
774
|
+
|
|
761
775
|
if (toFetch.length > 0) {
|
|
762
776
|
const toFetchList = [...new Set(toFetch.map((x) => x.remoteId))];
|
|
763
777
|
|
|
@@ -771,8 +785,8 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
771
785
|
/**
|
|
772
786
|
* We've gotten a bunch of tiles from the server in
|
|
773
787
|
* response to a request from fetchTiles.
|
|
788
|
+
* @param {Object<string, import('./data-fetchers/DataFetcher').DividedTile | Tile | TilePositionArrayObject>} loadedTiles
|
|
774
789
|
*/
|
|
775
|
-
/** @param {Object<string, import('./data-fetchers/DataFetcher').DividedTile | Tile | TilePositionArrayObject>} loadedTiles */
|
|
776
790
|
receivedTiles(loadedTiles) {
|
|
777
791
|
for (let i = 0; i < this.visibleTiles.length; i++) {
|
|
778
792
|
const { tileId } = this.visibleTiles[i];
|
|
@@ -864,10 +878,28 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
864
878
|
// 1. Check if all visible tiles are loaded
|
|
865
879
|
// 2. If `true` then send out event
|
|
866
880
|
if (this.areAllVisibleTilesLoaded()) {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
881
|
+
this.pubSub?.publish('TiledPixiTrack.tilesLoaded', { uuid: this.uuid });
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
_checkForErrors() {
|
|
886
|
+
const errors = Object.values(this.fetchedTiles)
|
|
887
|
+
.map((x) => x.tileData?.error && `${x.tileId}: ${x.tileData.error}`)
|
|
888
|
+
.filter((x) => x);
|
|
889
|
+
|
|
890
|
+
if (errors.length) {
|
|
891
|
+
this.errorTexts.TiledPixiTrack = errors.join('\n');
|
|
892
|
+
} else {
|
|
893
|
+
this.errorTexts.TiledPixiTrack = '';
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
if (this.tilesetInfoError) {
|
|
897
|
+
this.errorTexts.TiledPixiTrack = this.tilesetInfoError;
|
|
898
|
+
|
|
899
|
+
errors.push(this.tilesetInfoError);
|
|
870
900
|
}
|
|
901
|
+
|
|
902
|
+
return errors;
|
|
871
903
|
}
|
|
872
904
|
|
|
873
905
|
draw() {
|
|
@@ -877,46 +909,33 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
877
909
|
if (this.dataFetcher.tilesetInfoLoading) {
|
|
878
910
|
this.trackNotFoundText.text = 'Loading...';
|
|
879
911
|
} else {
|
|
880
|
-
|
|
912
|
+
const server = this.dataFetcher.dataConfig.server || 'unknown';
|
|
913
|
+
const tilesetUid = this.dataFetcher.dataConfig.tilesetUid;
|
|
914
|
+
this.trackNotFoundText.text = `Tileset info not found. Server: [${server}] tilesetUid: [${tilesetUid}]`;
|
|
881
915
|
}
|
|
882
916
|
|
|
883
917
|
[this.trackNotFoundText.x, this.trackNotFoundText.y] = this.position;
|
|
884
|
-
|
|
885
|
-
if (this.flipText)
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
}
|
|
918
|
+
/*
|
|
919
|
+
if (this.flipText)
|
|
920
|
+
this.trackNotFoundText.scale.x = -1;
|
|
921
|
+
*/
|
|
889
922
|
|
|
890
923
|
this.trackNotFoundText.visible = true;
|
|
891
924
|
} else {
|
|
892
925
|
this.trackNotFoundText.visible = false;
|
|
893
926
|
}
|
|
894
927
|
|
|
895
|
-
|
|
896
|
-
this.pubSub.publish('TiledPixiTrack.tilesDrawnStart', {
|
|
897
|
-
uuid: this.uuid,
|
|
898
|
-
});
|
|
899
|
-
}
|
|
900
|
-
const errors = Object.values(this.fetchedTiles)
|
|
901
|
-
.map((x) => x.tileData?.error && `${x.tileId}: ${x.tileData.error}`)
|
|
902
|
-
.filter((x) => x);
|
|
928
|
+
this.pubSub?.publish('TiledPixiTrack.tilesDrawnStart', { uuid: this.uuid });
|
|
903
929
|
|
|
904
|
-
|
|
905
|
-
this.errorTextText = errors.join('\n');
|
|
906
|
-
} else {
|
|
907
|
-
this.errorTextText = '';
|
|
908
|
-
}
|
|
930
|
+
this._checkForErrors();
|
|
909
931
|
|
|
910
932
|
super.draw();
|
|
911
933
|
|
|
912
934
|
Object.keys(this.fetchedTiles).forEach((tilesetUid) => {
|
|
913
935
|
this.drawTile(this.fetchedTiles[tilesetUid]);
|
|
914
936
|
});
|
|
915
|
-
// console.log('errors:', errors);
|
|
916
937
|
|
|
917
|
-
|
|
918
|
-
this.pubSub.publish('TiledPixiTrack.tilesDrawnEnd', { uuid: this.uuid });
|
|
919
|
-
}
|
|
938
|
+
this.pubSub?.publish('TiledPixiTrack.tilesDrawnEnd', { uuid: this.uuid });
|
|
920
939
|
}
|
|
921
940
|
|
|
922
941
|
/**
|
|
@@ -936,11 +955,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
936
955
|
visibleAndFetchedIds = Object.keys(this.fetchedTiles);
|
|
937
956
|
}
|
|
938
957
|
|
|
939
|
-
|
|
940
|
-
/** @type {number[]} */
|
|
941
|
-
let values = [];
|
|
942
|
-
|
|
943
|
-
values = values
|
|
958
|
+
const values = /** @type {Array<number>} */ ([])
|
|
944
959
|
.concat(
|
|
945
960
|
...visibleAndFetchedIds
|
|
946
961
|
.filter((x) => this.fetchedTiles[x].tileData.dense)
|
|
@@ -953,10 +968,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
953
968
|
}
|
|
954
969
|
|
|
955
970
|
allVisibleValues() {
|
|
956
|
-
/** @type {number
|
|
957
|
-
const values = [];
|
|
958
|
-
|
|
959
|
-
return values.concat(
|
|
971
|
+
return /** @type {Array<number>} */ ([]).concat(
|
|
960
972
|
...this.visibleAndFetchedIds().map((x) =>
|
|
961
973
|
Array.from(this.fetchedTiles[x].tileData.dense),
|
|
962
974
|
),
|
|
@@ -1007,6 +1019,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
1007
1019
|
if (visibleAndFetchedIds.length === 0) {
|
|
1008
1020
|
visibleAndFetchedIds = Object.keys(this.fetchedTiles);
|
|
1009
1021
|
}
|
|
1022
|
+
|
|
1010
1023
|
/** @type {number | null} */
|
|
1011
1024
|
let max = Math.max(
|
|
1012
1025
|
...visibleAndFetchedIds.map(
|
|
@@ -1024,24 +1037,20 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
1024
1037
|
return this.valueScaleMax !== null ? this.valueScaleMax : max;
|
|
1025
1038
|
}
|
|
1026
1039
|
|
|
1040
|
+
/** @typedef {import('d3-scale').ScaleQuantile<number, never> & { ticks?: (count: number) => number[] }} ScaleQuantile */
|
|
1041
|
+
|
|
1027
1042
|
/**
|
|
1028
1043
|
* Create a value scale that will be used to position values
|
|
1029
1044
|
* along the y axis.
|
|
1030
1045
|
* @param {number} minValue The minimum value of the data
|
|
1031
1046
|
* @param {number} medianValue The median value of the data. Potentially used for adding a pseudocount
|
|
1032
1047
|
* @param {number} maxValue The maximum value of the data
|
|
1033
|
-
* @param {number} inMargin A number of pixels to be left free on the top and bottom
|
|
1048
|
+
* @param {number} [inMargin] A number of pixels to be left free on the top and bottom
|
|
1034
1049
|
* of the track. For example if the glyphs have a certain
|
|
1035
1050
|
* width and we want all of them to fit into the space
|
|
1036
|
-
* @returns
|
|
1051
|
+
* @returns {[t.Scale | ScaleQuantile, number]}
|
|
1037
1052
|
*/
|
|
1038
1053
|
makeValueScale(minValue, medianValue, maxValue, inMargin) {
|
|
1039
|
-
/*
|
|
1040
|
-
* Returns
|
|
1041
|
-
* -------
|
|
1042
|
-
* valueScale: d3.scale
|
|
1043
|
-
* A d3 value scale
|
|
1044
|
-
*/
|
|
1045
1054
|
let valueScale = null;
|
|
1046
1055
|
let offsetValue = 0;
|
|
1047
1056
|
|
|
@@ -1072,13 +1081,13 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
1072
1081
|
// .base(Math.E)
|
|
1073
1082
|
.domain([offsetValue, maxValue + offsetValue])
|
|
1074
1083
|
// .domain([offsetValue, this.maxValue()])
|
|
1075
|
-
.range([
|
|
1084
|
+
.range([maxDimension, minDimension]);
|
|
1076
1085
|
|
|
1077
1086
|
// pseudocount = offsetValue;
|
|
1078
1087
|
} else if (this.options.valueScaling === 'quantile') {
|
|
1079
1088
|
const start = this.dimensions[1] - margin;
|
|
1080
1089
|
const end = margin;
|
|
1081
|
-
/** @type {
|
|
1090
|
+
/** @type {ScaleQuantile} */
|
|
1082
1091
|
const quantScale = scaleQuantile()
|
|
1083
1092
|
.domain(this.allVisibleValues())
|
|
1084
1093
|
.range(range(start, end, (end - start) / 256));
|
|
@@ -1089,7 +1098,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
1089
1098
|
const start = this.dimensions[1] - margin;
|
|
1090
1099
|
const end = margin;
|
|
1091
1100
|
const s = new Set(this.allVisibleValues());
|
|
1092
|
-
/** @type {
|
|
1101
|
+
/** @type {ScaleQuantile} */
|
|
1093
1102
|
const quantScale = scaleQuantile()
|
|
1094
1103
|
.domain([...s])
|
|
1095
1104
|
.range(range(start, end, (end - start) / 256));
|