higlass 1.11.10 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -10
- package/app/scripts/{AddTrackDialog.js → AddTrackDialog.jsx} +27 -26
- package/app/scripts/{AddTrackPositionMenu.js → AddTrackPositionMenu.jsx} +18 -15
- package/app/scripts/{Autocomplete.js → Autocomplete.jsx} +1 -0
- package/app/scripts/{Button.js → Button.jsx} +7 -6
- package/app/scripts/CenterTiledPlot.jsx +7 -0
- package/app/scripts/{CenterTrack.js → CenterTrack.jsx} +42 -41
- package/app/scripts/ChromosomeGrid.js +8 -16
- package/app/scripts/CloseTrackMenu.jsx +27 -0
- package/app/scripts/CombinedTrack.js +16 -1
- package/app/scripts/{ConfigTrackMenu.js → ConfigTrackMenu.jsx} +12 -12
- package/app/scripts/{ConfigViewMenu.js → ConfigViewMenu.jsx} +35 -36
- package/app/scripts/{ConfigureSeriesMenu.js → ConfigureSeriesMenu.jsx} +2 -2
- package/app/scripts/{ContextMenuContainer.js → ContextMenuContainer.jsx} +5 -7
- package/app/scripts/ContextMenuItem.jsx +37 -0
- package/app/scripts/Cross.jsx +9 -0
- package/app/scripts/CustomTrackDialog.jsx +38 -0
- package/app/scripts/DataFetcher.js +6 -6
- package/app/scripts/{Dialog.js → Dialog.jsx} +40 -31
- package/app/scripts/{DragListeningDiv.js → DragListeningDiv.jsx} +10 -12
- package/app/scripts/{DraggableDiv.js → DraggableDiv.jsx} +25 -24
- package/app/scripts/{ExportLinkDialog.js → ExportLinkDialog.jsx} +2 -2
- package/app/scripts/{FixedTrack.js → FixedTrack.jsx} +0 -0
- package/app/scripts/{GalleryTracks.js → GalleryTracks.jsx} +10 -9
- package/app/scripts/{GenomePositionSearchBox.js → GenomePositionSearchBox.jsx} +14 -16
- package/app/scripts/{HeatmapOptions.js → HeatmapOptions.jsx} +0 -0
- package/app/scripts/HeatmapTiledPixiTrack.js +18 -30
- package/app/scripts/{HiGlassComponent.js → HiGlassComponent.jsx} +206 -85
- package/app/scripts/{HiGlassTrackComponent.js → HiGlassTrackComponent.jsx} +0 -0
- package/app/scripts/HorizontalChromosomeLabels.js +3 -6
- package/app/scripts/HorizontalHeatmapTrack.js +2 -6
- package/app/scripts/{HorizontalItem.js → HorizontalItem.jsx} +0 -0
- package/app/scripts/HorizontalRule.js +2 -0
- package/app/scripts/{HorizontalTiledPlot.js → HorizontalTiledPlot.jsx} +20 -19
- package/app/scripts/{HorizontalTrack.js → HorizontalTrack.jsx} +0 -0
- package/app/scripts/LeftTrackModifier.js +8 -0
- package/app/scripts/{ListWrapper.js → ListWrapper.jsx} +0 -0
- package/app/scripts/{Modal.js → Modal.jsx} +14 -9
- package/app/scripts/{MoveableTrack.js → MoveableTrack.jsx} +0 -0
- package/app/scripts/{NestedContextMenu.js → NestedContextMenu.jsx} +6 -7
- package/app/scripts/OSMTilesTrack.js +2 -6
- package/app/scripts/OverlayTrack.js +2 -0
- package/app/scripts/{PlotTypeChooser.js → PlotTypeChooser.jsx} +0 -0
- package/app/scripts/{PopupMenu.js → PopupMenu.jsx} +1 -1
- package/app/scripts/SearchField.js +5 -3
- package/app/scripts/{SeriesListItems.js → SeriesListItems.jsx} +6 -6
- package/app/scripts/{SeriesListMenu.js → SeriesListMenu.jsx} +29 -32
- package/app/scripts/{SeriesListSubmenuMixin.js → SeriesListSubmenuMixin.jsx} +0 -0
- package/app/scripts/{SketchInlinePicker.js → SketchInlinePicker.jsx} +0 -0
- package/app/scripts/{SortableList.js → SortableList.jsx} +0 -0
- package/app/scripts/Tiled1DPixiTrack.js +2 -5
- package/app/scripts/TiledPixiTrack.js +3 -1
- package/app/scripts/{TiledPlot.js → TiledPlot.jsx} +45 -17
- package/app/scripts/{TilesetFinder.js → TilesetFinder.jsx} +7 -7
- package/app/scripts/Track.js +17 -1
- package/app/scripts/{TrackArea.js → TrackArea.jsx} +0 -0
- package/app/scripts/{TrackControl.js → TrackControl.jsx} +44 -50
- package/app/scripts/{TrackRenderer.js → TrackRenderer.jsx} +44 -38
- package/app/scripts/{VerticalItem.js → VerticalItem.jsx} +0 -0
- package/app/scripts/VerticalRule.js +1 -0
- package/app/scripts/{VerticalTiledPlot.js → VerticalTiledPlot.jsx} +27 -18
- package/app/scripts/{VerticalTrack.js → VerticalTrack.jsx} +0 -0
- package/app/scripts/{ViewConfigEditor.js → ViewConfigEditor.jsx} +66 -58
- package/app/scripts/{ViewContextMenu.js → ViewContextMenu.jsx} +13 -13
- package/app/scripts/{ViewHeader.js → ViewHeader.jsx} +24 -23
- package/app/scripts/ViewportTracker2D.js +1 -2
- package/app/scripts/ViewportTrackerHorizontal.js +1 -2
- package/app/scripts/ViewportTrackerVertical.js +1 -2
- package/app/scripts/api.js +17 -10
- package/app/scripts/configs/available-for-plugins.js +4 -3
- package/app/scripts/configs/index.js +1 -47
- package/app/scripts/configs/positions-by-datatype.js +2 -0
- package/app/scripts/configs/primitives.js +47 -0
- package/app/scripts/configs/tracks-info.js +2 -2
- package/app/scripts/d3-context-menu.js +1 -0
- package/app/scripts/data-fetchers/get-data-fetcher.js +7 -2
- package/app/scripts/{hglib.js → hglib.jsx} +1 -1
- package/app/scripts/hocs/{with-modal.js → with-modal.jsx} +0 -0
- package/app/scripts/hocs/{with-pub-sub.js → with-pub-sub.jsx} +0 -0
- package/app/scripts/hocs/{with-theme.js → with-theme.jsx} +0 -0
- package/app/scripts/{icons.js → icons.jsx} +22 -12
- package/app/scripts/mixwith.js +2 -0
- package/app/scripts/services/tile-proxy.js +1 -5
- package/app/scripts/utils/abs-to-chr.js +1 -1
- package/app/scripts/utils/dec-to-hex-str.js +1 -1
- package/app/scripts/utils/dict-items.js +0 -1
- package/app/scripts/utils/dict-keys.js +0 -1
- package/app/scripts/utils/dict-values.js +0 -1
- package/app/scripts/utils/index.js +1 -0
- package/app/scripts/utils/range-query-2d.js +4 -1
- package/app/scripts/utils/selected-items-to-size.js +2 -3
- package/app/scripts/utils/{test-helpers.js → test-helpers.jsx} +32 -10
- package/app/scripts/utils/timeout.js +4 -1
- package/app/scripts/utils/value-to-color.js +14 -17
- package/app/scripts/worker.js +8 -4
- package/app/styles/GenomePositionSearchBox.module.scss +13 -15
- package/app/styles/HiGlass.scss +5 -5
- package/app/styles/TilesetFinder.css +94 -74
- package/app/styles/TrackControl.module.scss +17 -20
- package/app/styles/TrackOptions.css +23 -24
- package/app/styles/ViewHeader.module.scss +18 -18
- package/dist/hglib.css +1724 -0
- package/dist/hglib.js +83032 -0
- package/dist/hglib.min.js +382 -0
- package/dist/index.html +251 -250
- package/package.json +57 -117
- package/CHANGELOG.md +0 -1411
- package/app/index.html +0 -273
- package/app/scripts/CenterTiledPlot.js +0 -5
- package/app/scripts/CloseTrackMenu.js +0 -25
- package/app/scripts/ContextMenuItem.js +0 -35
- package/app/scripts/Cross.js +0 -7
- package/app/scripts/factories/index.js +0 -1
|
@@ -4,6 +4,7 @@ import slugid from 'slugid';
|
|
|
4
4
|
import CheckboxTree from 'react-checkbox-tree';
|
|
5
5
|
|
|
6
6
|
import { tileProxy } from './services';
|
|
7
|
+
|
|
7
8
|
import '../styles/TilesetFinder.css';
|
|
8
9
|
|
|
9
10
|
import withPubSub from './hocs/with-pub-sub';
|
|
@@ -20,7 +21,7 @@ class TilesetFinder extends React.Component {
|
|
|
20
21
|
// local tracks are ones that don't have a filetype associated with them
|
|
21
22
|
this.localTracks = TRACKS_INFO.filter((x) => x.local && !x.hidden).map(
|
|
22
23
|
(x) => {
|
|
23
|
-
const y =
|
|
24
|
+
const y = { ...x };
|
|
24
25
|
y.datatype = x.datatype[0];
|
|
25
26
|
return y;
|
|
26
27
|
},
|
|
@@ -89,14 +90,15 @@ class TilesetFinder extends React.Component {
|
|
|
89
90
|
const newOptions = existingOptions;
|
|
90
91
|
|
|
91
92
|
const entries = newEntries.map((ne) => {
|
|
92
|
-
const ane =
|
|
93
|
+
const ane = {
|
|
94
|
+
...ne,
|
|
93
95
|
server: sourceServer,
|
|
94
96
|
tilesetUid: ne.uuid,
|
|
95
97
|
serverUidKey: this.serverUidKey(sourceServer, ne.uuid),
|
|
96
98
|
datatype: ne.datatype,
|
|
97
99
|
name: ne.name,
|
|
98
100
|
uid: slugid.nice(),
|
|
99
|
-
}
|
|
101
|
+
};
|
|
100
102
|
|
|
101
103
|
return ane;
|
|
102
104
|
});
|
|
@@ -125,6 +127,7 @@ class TilesetFinder extends React.Component {
|
|
|
125
127
|
[].concat(
|
|
126
128
|
...this.augmentedTracksInfo
|
|
127
129
|
.filter((x) => x.datatype)
|
|
130
|
+
// eslint-disable-next-line arrow-body-style
|
|
128
131
|
.filter((x) => {
|
|
129
132
|
return (
|
|
130
133
|
x.orientation === this.props.orientation ||
|
|
@@ -345,10 +348,7 @@ class TilesetFinder extends React.Component {
|
|
|
345
348
|
type="text"
|
|
346
349
|
/>
|
|
347
350
|
</div>
|
|
348
|
-
<div
|
|
349
|
-
className="tileset-finder-checkbox-tree"
|
|
350
|
-
styleName="tileset-finder-checkbox-tree"
|
|
351
|
-
>
|
|
351
|
+
<div className="tileset-finder-checkbox-tree">
|
|
352
352
|
<CheckboxTree
|
|
353
353
|
checked={this.state.checked}
|
|
354
354
|
expanded={this.state.expanded}
|
package/app/scripts/Track.js
CHANGED
|
@@ -5,7 +5,10 @@ import { fake as fakePubSub } from './hocs/with-pub-sub';
|
|
|
5
5
|
import { isWithin } from './utils';
|
|
6
6
|
|
|
7
7
|
class Track {
|
|
8
|
-
constructor(
|
|
8
|
+
constructor(context) {
|
|
9
|
+
this.context = context;
|
|
10
|
+
|
|
11
|
+
const { id, pubSub, getTheme } = context;
|
|
9
12
|
if (pubSub) {
|
|
10
13
|
this.pubSub = pubSub;
|
|
11
14
|
} else {
|
|
@@ -78,6 +81,19 @@ class Track {
|
|
|
78
81
|
|
|
79
82
|
getData() {}
|
|
80
83
|
|
|
84
|
+
/** Capture click events. x and y are relative to the track
|
|
85
|
+
* position */
|
|
86
|
+
click(x, y, evt) {
|
|
87
|
+
return {
|
|
88
|
+
type: 'generic',
|
|
89
|
+
event: evt,
|
|
90
|
+
payload: null,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** There was a click event outside the track * */
|
|
95
|
+
clickOutside() {}
|
|
96
|
+
|
|
81
97
|
getDimensions() {
|
|
82
98
|
return this.dimensions;
|
|
83
99
|
}
|
|
File without changes
|
|
@@ -1,39 +1,33 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { SortableHandle } from 'react-sortable-hoc';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
|
|
5
6
|
import withTheme from './hocs/with-theme';
|
|
6
7
|
import { THEME_DARK } from './configs';
|
|
7
8
|
|
|
8
9
|
// Styles
|
|
9
|
-
import '../styles/TrackControl.module.scss';
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const getButtonClassNames = (props) => {
|
|
26
|
-
let buttonClassName = 'track-control-button';
|
|
27
|
-
|
|
28
|
-
buttonClassName += props.isVertical ? ' track-control-button-vertical' : '';
|
|
29
|
-
|
|
30
|
-
return buttonClassName;
|
|
31
|
-
};
|
|
10
|
+
import classes from '../styles/TrackControl.module.scss';
|
|
11
|
+
|
|
12
|
+
const getClassName = (props) =>
|
|
13
|
+
clsx({
|
|
14
|
+
[classes['track-control-active']]: props.isVisible,
|
|
15
|
+
[classes['track-control']]: !props.isVisible,
|
|
16
|
+
[classes['track-control-left']]: props.isAlignLeft,
|
|
17
|
+
[classes['track-control-vertical']]: props.isVertical,
|
|
18
|
+
[classes['track-control-padding-right']]: props.paddingRight,
|
|
19
|
+
[classes['track-control-dark']]: props.theme === THEME_DARK,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const getButtonClassName = (props) =>
|
|
23
|
+
clsx('no-zoom', classes['track-control-button'], {
|
|
24
|
+
[classes['track-control-button-vertical']]: props.isVertical,
|
|
25
|
+
});
|
|
32
26
|
|
|
33
27
|
let oldProps = null;
|
|
34
28
|
let DragHandle = null;
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
function TrackControl(props) {
|
|
37
31
|
// Avoid constant recreating that button when the props didn't change.
|
|
38
32
|
// Damn React could be a little smarter here...
|
|
39
33
|
if (
|
|
@@ -44,12 +38,12 @@ const TrackControl = (props) => {
|
|
|
44
38
|
oldProps = props;
|
|
45
39
|
DragHandle = SortableHandle(() => (
|
|
46
40
|
<svg
|
|
47
|
-
className=
|
|
48
|
-
style={
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
className={getButtonClassName(props)}
|
|
42
|
+
style={{
|
|
43
|
+
height: '20px',
|
|
44
|
+
width: '20px',
|
|
45
|
+
...props.imgStyleMove,
|
|
46
|
+
}}
|
|
53
47
|
>
|
|
54
48
|
<title>Move track</title>
|
|
55
49
|
<use xlinkHref="#move" />
|
|
@@ -61,25 +55,25 @@ const TrackControl = (props) => {
|
|
|
61
55
|
let imgClose;
|
|
62
56
|
|
|
63
57
|
return (
|
|
64
|
-
<div
|
|
58
|
+
<div className={getClassName(props)}>
|
|
65
59
|
{props.isMoveable && <DragHandle />}
|
|
66
60
|
|
|
67
61
|
<svg
|
|
68
62
|
ref={(c) => {
|
|
69
63
|
imgConfig = c;
|
|
70
64
|
}}
|
|
71
|
-
className=
|
|
65
|
+
className={getButtonClassName(props)}
|
|
72
66
|
onClick={() => {
|
|
73
67
|
props.onConfigTrackMenuOpened(
|
|
74
68
|
props.uid,
|
|
75
69
|
imgConfig.getBoundingClientRect(),
|
|
76
70
|
);
|
|
77
71
|
}}
|
|
78
|
-
style={
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
style={{
|
|
73
|
+
height: '20px',
|
|
74
|
+
width: '20px',
|
|
75
|
+
...props.imgStyleSettings,
|
|
76
|
+
}}
|
|
83
77
|
>
|
|
84
78
|
<title>Configure track</title>
|
|
85
79
|
<use xlinkHref="#cog" />
|
|
@@ -87,13 +81,13 @@ const TrackControl = (props) => {
|
|
|
87
81
|
|
|
88
82
|
{props.onAddSeries && (
|
|
89
83
|
<svg
|
|
90
|
-
className=
|
|
84
|
+
className={getButtonClassName(props)}
|
|
91
85
|
onClick={() => props.onAddSeries(props.uid)}
|
|
92
|
-
style={
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
style={{
|
|
87
|
+
height: '20px',
|
|
88
|
+
width: '20px',
|
|
89
|
+
...props.imgStyleAdd,
|
|
90
|
+
}}
|
|
97
91
|
>
|
|
98
92
|
<title>Add series</title>
|
|
99
93
|
<use xlinkHref="#plus" />
|
|
@@ -104,25 +98,25 @@ const TrackControl = (props) => {
|
|
|
104
98
|
ref={(c) => {
|
|
105
99
|
imgClose = c;
|
|
106
100
|
}}
|
|
107
|
-
className=
|
|
101
|
+
className={getButtonClassName(props)}
|
|
108
102
|
onClick={() => {
|
|
109
103
|
props.onCloseTrackMenuOpened(
|
|
110
104
|
props.uid,
|
|
111
105
|
imgClose.getBoundingClientRect(),
|
|
112
106
|
);
|
|
113
107
|
}}
|
|
114
|
-
style={
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
108
|
+
style={{
|
|
109
|
+
height: '20px',
|
|
110
|
+
width: '20px',
|
|
111
|
+
...props.imgStyleClose,
|
|
112
|
+
}}
|
|
119
113
|
>
|
|
120
114
|
<title>Close track</title>
|
|
121
115
|
<use xlinkHref="#cross" />
|
|
122
116
|
</svg>
|
|
123
117
|
</div>
|
|
124
118
|
);
|
|
125
|
-
}
|
|
119
|
+
}
|
|
126
120
|
|
|
127
121
|
TrackControl.propTypes = {
|
|
128
122
|
imgStyleAdd: PropTypes.object,
|
|
@@ -2,9 +2,10 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
import { zoom, zoomIdentity } from 'd3-zoom';
|
|
5
|
-
import { select,
|
|
5
|
+
import { select, pointer } from 'd3-selection';
|
|
6
6
|
import { scaleLinear } from 'd3-scale';
|
|
7
7
|
import slugid from 'slugid';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
|
|
9
10
|
import PixiTrack from './PixiTrack';
|
|
10
11
|
import HeatmapTiledPixiTrack from './HeatmapTiledPixiTrack';
|
|
@@ -81,7 +82,7 @@ import {
|
|
|
81
82
|
} from './configs';
|
|
82
83
|
|
|
83
84
|
// Styles
|
|
84
|
-
import '../styles/TrackRenderer.module.scss';
|
|
85
|
+
import classes from '../styles/TrackRenderer.module.scss';
|
|
85
86
|
|
|
86
87
|
const SCROLL_TIMEOUT = 100;
|
|
87
88
|
|
|
@@ -116,9 +117,14 @@ class TrackRenderer extends React.Component {
|
|
|
116
117
|
this.uid = slugid.nice();
|
|
117
118
|
this.viewUid = this.props.uid;
|
|
118
119
|
|
|
119
|
-
this.availableForPlugins =
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
this.availableForPlugins = {
|
|
121
|
+
...AVAILABLE_FOR_PLUGINS,
|
|
122
|
+
services: {
|
|
123
|
+
...AVAILABLE_FOR_PLUGINS.services,
|
|
124
|
+
pubSub: this.props.pubSub,
|
|
125
|
+
pixiRenderer: this.props.pixiRenderer,
|
|
126
|
+
},
|
|
127
|
+
};
|
|
122
128
|
|
|
123
129
|
this.mounted = false;
|
|
124
130
|
|
|
@@ -136,7 +142,7 @@ class TrackRenderer extends React.Component {
|
|
|
136
142
|
// catch any zooming behavior within all of the tracks in this plot
|
|
137
143
|
// this.zoomTransform = zoomIdentity();
|
|
138
144
|
this.zoomBehavior = zoom()
|
|
139
|
-
.filter(() => {
|
|
145
|
+
.filter((event) => {
|
|
140
146
|
if (event.target.classList.contains('no-zoom')) {
|
|
141
147
|
return false;
|
|
142
148
|
}
|
|
@@ -154,9 +160,9 @@ class TrackRenderer extends React.Component {
|
|
|
154
160
|
|
|
155
161
|
this.initialXDomain = [0, 1];
|
|
156
162
|
this.initialYDomain = [0, 1];
|
|
157
|
-
this.xDomainLimits = [-
|
|
158
|
-
this.yDomainLimits = [-
|
|
159
|
-
this.zoomLimits = [0,
|
|
163
|
+
this.xDomainLimits = [-Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER];
|
|
164
|
+
this.yDomainLimits = [-Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER];
|
|
165
|
+
this.zoomLimits = [0, Number.MAX_SAFE_INTEGER];
|
|
160
166
|
|
|
161
167
|
this.prevCenterX =
|
|
162
168
|
this.currentProps.paddingLeft +
|
|
@@ -545,9 +551,9 @@ class TrackRenderer extends React.Component {
|
|
|
545
551
|
setUpInitialScales(
|
|
546
552
|
initialXDomain = [0, 1],
|
|
547
553
|
initialYDomain = [0, 1],
|
|
548
|
-
xDomainLimits = [-
|
|
549
|
-
yDomainLimits = [-
|
|
550
|
-
zoomLimits = [0,
|
|
554
|
+
xDomainLimits = [-Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
555
|
+
yDomainLimits = [-Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
556
|
+
zoomLimits = [0, Number.MAX_SAFE_INTEGER],
|
|
551
557
|
) {
|
|
552
558
|
// Make sure the initial domain is within the limits first
|
|
553
559
|
zoomLimits[0] = zoomLimits[0] === null ? 0 : zoomLimits[0];
|
|
@@ -1116,7 +1122,7 @@ class TrackRenderer extends React.Component {
|
|
|
1116
1122
|
|
|
1117
1123
|
valueScaleMove(movement) {
|
|
1118
1124
|
// mouse wheel from zoom event
|
|
1119
|
-
// const cp =
|
|
1125
|
+
// const cp = pointer(event.sourceEvent, this.props.canvasElement);
|
|
1120
1126
|
for (const track of this.getTracksAtPosition(...this.zoomStartPos)) {
|
|
1121
1127
|
track.movedY(movement);
|
|
1122
1128
|
}
|
|
@@ -1124,7 +1130,7 @@ class TrackRenderer extends React.Component {
|
|
|
1124
1130
|
this.zoomTransform = this.zoomStartTransform;
|
|
1125
1131
|
}
|
|
1126
1132
|
|
|
1127
|
-
valueScaleZoom(orientation) {
|
|
1133
|
+
valueScaleZoom(event, orientation) {
|
|
1128
1134
|
// mouse move probably from a drag event
|
|
1129
1135
|
const mdy = event.sourceEvent.deltaY;
|
|
1130
1136
|
const mdm = event.sourceEvent.deltaMode;
|
|
@@ -1132,7 +1138,7 @@ class TrackRenderer extends React.Component {
|
|
|
1132
1138
|
const myWheelDelta = (dy, dm) => (dy * (dm ? 120 : 1)) / 500;
|
|
1133
1139
|
const mwd = myWheelDelta(mdy, mdm);
|
|
1134
1140
|
|
|
1135
|
-
const cp =
|
|
1141
|
+
const cp = pointer(event.sourceEvent, this.props.canvasElement);
|
|
1136
1142
|
|
|
1137
1143
|
for (const track of this.getTracksAtPosition(...cp)) {
|
|
1138
1144
|
const yPos =
|
|
@@ -1152,7 +1158,7 @@ class TrackRenderer extends React.Component {
|
|
|
1152
1158
|
* We need to update our local record of the zoom transform and apply it
|
|
1153
1159
|
* to all the tracks.
|
|
1154
1160
|
*/
|
|
1155
|
-
zoomed() {
|
|
1161
|
+
zoomed(event) {
|
|
1156
1162
|
// the orientation of the track where we started zooming
|
|
1157
1163
|
// if it's a 1d-horizontal, then mousemove events shouldn't
|
|
1158
1164
|
// move the center track vertically
|
|
@@ -1183,7 +1189,7 @@ class TrackRenderer extends React.Component {
|
|
|
1183
1189
|
// a 1d track, try to apply value scale zooming
|
|
1184
1190
|
if (event.shiftKey || this.valueScaleZooming) {
|
|
1185
1191
|
if (event.sourceEvent.deltaY !== undefined) {
|
|
1186
|
-
this.valueScaleZoom(trackOrientation);
|
|
1192
|
+
this.valueScaleZoom(event, trackOrientation);
|
|
1187
1193
|
return;
|
|
1188
1194
|
}
|
|
1189
1195
|
|
|
@@ -1278,14 +1284,11 @@ class TrackRenderer extends React.Component {
|
|
|
1278
1284
|
return foundTracks;
|
|
1279
1285
|
}
|
|
1280
1286
|
|
|
1281
|
-
zoomStarted() {
|
|
1287
|
+
zoomStarted(event) {
|
|
1282
1288
|
this.zooming = true;
|
|
1283
1289
|
|
|
1284
|
-
if (event.sourceEvent) {
|
|
1285
|
-
this.zoomStartPos =
|
|
1286
|
-
this.props.canvasElement,
|
|
1287
|
-
event.sourceEvent,
|
|
1288
|
-
);
|
|
1290
|
+
if (event && event.sourceEvent) {
|
|
1291
|
+
this.zoomStartPos = pointer(event.sourceEvent, this.props.canvasElement);
|
|
1289
1292
|
|
|
1290
1293
|
if (event.sourceEvent.shiftKey) {
|
|
1291
1294
|
this.valueScaleZooming = true;
|
|
@@ -1442,7 +1445,7 @@ class TrackRenderer extends React.Component {
|
|
|
1442
1445
|
};
|
|
1443
1446
|
try {
|
|
1444
1447
|
return new pluginTrack.track( // eslint-disable-line new-cap
|
|
1445
|
-
|
|
1448
|
+
this.availableForPlugins,
|
|
1446
1449
|
context,
|
|
1447
1450
|
track.options,
|
|
1448
1451
|
);
|
|
@@ -1502,27 +1505,27 @@ class TrackRenderer extends React.Component {
|
|
|
1502
1505
|
dataConfig,
|
|
1503
1506
|
this.props.pubSub,
|
|
1504
1507
|
this.props.pluginDataFetchers,
|
|
1508
|
+
this.availableForPlugins,
|
|
1505
1509
|
);
|
|
1506
1510
|
|
|
1507
1511
|
// To simplify the context creation via ES6 object shortcuts.
|
|
1508
1512
|
const context = {
|
|
1509
1513
|
id: track.uid,
|
|
1514
|
+
trackUid: track.uid,
|
|
1515
|
+
trackType: track.type,
|
|
1510
1516
|
viewUid: this.viewUid,
|
|
1511
1517
|
pubSub: this.props.pubSub,
|
|
1512
1518
|
scene: this.pStage,
|
|
1513
1519
|
dataConfig,
|
|
1514
1520
|
dataFetcher,
|
|
1515
|
-
getLockGroupExtrema: () =>
|
|
1516
|
-
|
|
1517
|
-
},
|
|
1521
|
+
getLockGroupExtrema: () =>
|
|
1522
|
+
this.currentProps.getLockGroupExtrema(track.uid),
|
|
1518
1523
|
handleTilesetInfoReceived,
|
|
1519
1524
|
animate: () => {
|
|
1520
1525
|
this.currentProps.onNewTilesLoaded(track.uid);
|
|
1521
1526
|
},
|
|
1522
1527
|
svgElement: this.svgElement,
|
|
1523
|
-
isValueScaleLocked: () =>
|
|
1524
|
-
return this.currentProps.isValueScaleLocked(track.uid);
|
|
1525
|
-
},
|
|
1528
|
+
isValueScaleLocked: () => this.currentProps.isValueScaleLocked(track.uid),
|
|
1526
1529
|
onValueScaleChanged: () => {
|
|
1527
1530
|
this.currentProps.onValueScaleChanged(track.uid);
|
|
1528
1531
|
},
|
|
@@ -1769,7 +1772,7 @@ class TrackRenderer extends React.Component {
|
|
|
1769
1772
|
const pluginTrack = this.props.pluginTracks[track.type];
|
|
1770
1773
|
|
|
1771
1774
|
if (pluginTrack && !pluginTrack.isMetaTrack) {
|
|
1772
|
-
context.AVAILABLE_FOR_PLUGINS =
|
|
1775
|
+
context.AVAILABLE_FOR_PLUGINS = this.availableForPlugins;
|
|
1773
1776
|
context.baseEl = this.baseEl;
|
|
1774
1777
|
context.definition = track;
|
|
1775
1778
|
|
|
@@ -1785,7 +1788,7 @@ class TrackRenderer extends React.Component {
|
|
|
1785
1788
|
|
|
1786
1789
|
try {
|
|
1787
1790
|
return new pluginTrack.track( // eslint-disable-line new-cap
|
|
1788
|
-
|
|
1791
|
+
this.availableForPlugins,
|
|
1789
1792
|
context,
|
|
1790
1793
|
options,
|
|
1791
1794
|
);
|
|
@@ -1977,26 +1980,29 @@ class TrackRenderer extends React.Component {
|
|
|
1977
1980
|
ref={(c) => {
|
|
1978
1981
|
this.baseEl = c;
|
|
1979
1982
|
}}
|
|
1980
|
-
className=
|
|
1983
|
+
className={clsx('track-renderer-div', classes['track-renderer'])}
|
|
1981
1984
|
style={{
|
|
1982
1985
|
height: this.currentProps.height,
|
|
1983
1986
|
width: this.currentProps.width,
|
|
1984
1987
|
}}
|
|
1985
|
-
styleName="track-renderer"
|
|
1986
1988
|
>
|
|
1987
1989
|
<div
|
|
1988
1990
|
ref={(c) => {
|
|
1989
1991
|
this.element = c;
|
|
1990
1992
|
}}
|
|
1991
|
-
className=
|
|
1992
|
-
|
|
1993
|
+
className={clsx(
|
|
1994
|
+
'track-renderer-element',
|
|
1995
|
+
classes['track-renderer-element'],
|
|
1996
|
+
)}
|
|
1993
1997
|
/>
|
|
1994
1998
|
<div
|
|
1995
1999
|
ref={(c) => {
|
|
1996
2000
|
this.eventTracker = c;
|
|
1997
2001
|
}}
|
|
1998
|
-
className=
|
|
1999
|
-
|
|
2002
|
+
className={clsx(
|
|
2003
|
+
'track-renderer-events',
|
|
2004
|
+
classes['track-renderer-events'],
|
|
2005
|
+
)}
|
|
2000
2006
|
>
|
|
2001
2007
|
{this.currentProps.children}
|
|
2002
2008
|
</div>
|
|
File without changes
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
|
|
4
5
|
import { brushY } from 'd3-brush';
|
|
5
|
-
import { select
|
|
6
|
+
import { select } from 'd3-selection';
|
|
6
7
|
import slugid from 'slugid';
|
|
8
|
+
import clsx from 'clsx';
|
|
7
9
|
|
|
8
10
|
import ListWrapper from './ListWrapper';
|
|
9
11
|
import VerticalItem from './VerticalItem';
|
|
@@ -20,11 +22,15 @@ import styles from '../styles/VerticalTiledPlot.module.scss'; // eslint-disable-
|
|
|
20
22
|
import stylesPlot from '../styles/TiledPlot.module.scss'; // eslint-disable-line no-unused-vars
|
|
21
23
|
import stylesTrack from '../styles/Track.module.scss'; // eslint-disable-line no-unused-vars
|
|
22
24
|
|
|
25
|
+
function sourceEvent(event) {
|
|
26
|
+
return event && event.sourceEvent;
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
class VerticalTiledPlot extends React.Component {
|
|
24
30
|
constructor(props) {
|
|
25
31
|
super(props);
|
|
26
32
|
|
|
27
|
-
this.brushBehavior = brushY(
|
|
33
|
+
this.brushBehavior = brushY()
|
|
28
34
|
.on('start', this.brushStarted.bind(this))
|
|
29
35
|
.on('brush', this.brushed.bind(this))
|
|
30
36
|
.on('end', this.brushedEnded.bind(this));
|
|
@@ -77,10 +83,6 @@ class VerticalTiledPlot extends React.Component {
|
|
|
77
83
|
|
|
78
84
|
/* --------------------------- Getter / Setter ---------------------------- */
|
|
79
85
|
|
|
80
|
-
get sourceEvent() {
|
|
81
|
-
return event && event.sourceEvent;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
86
|
/* ---------------------------- Custom Methods ---------------------------- */
|
|
85
87
|
|
|
86
88
|
addBrush() {
|
|
@@ -102,13 +104,13 @@ class VerticalTiledPlot extends React.Component {
|
|
|
102
104
|
);
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
brushed() {
|
|
107
|
+
brushed(event) {
|
|
106
108
|
// Need to reassign variable to check after reset
|
|
107
109
|
const rangeSelectionMoved = this.rangeSelectionMoved;
|
|
108
110
|
this.rangeSelectionMoved = false;
|
|
109
111
|
|
|
110
112
|
if (
|
|
111
|
-
!
|
|
113
|
+
!sourceEvent(event) ||
|
|
112
114
|
!this.props.onRangeSelection ||
|
|
113
115
|
rangeSelectionMoved
|
|
114
116
|
)
|
|
@@ -118,13 +120,13 @@ class VerticalTiledPlot extends React.Component {
|
|
|
118
120
|
this.props.onRangeSelection(event.selection);
|
|
119
121
|
}
|
|
120
122
|
|
|
121
|
-
brushStarted() {
|
|
122
|
-
if (!
|
|
123
|
+
brushStarted(event) {
|
|
124
|
+
if (!sourceEvent(event) || !event.selection) return;
|
|
123
125
|
|
|
124
126
|
this.props.onRangeSelectionStart();
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
brushedEnded() {
|
|
129
|
+
brushedEnded(event) {
|
|
128
130
|
if (!this.props.is1dRangeSelection) return;
|
|
129
131
|
|
|
130
132
|
const rangeSelectionMovedEnd = this.rangeSelectionMovedEnd;
|
|
@@ -191,35 +193,42 @@ class VerticalTiledPlot extends React.Component {
|
|
|
191
193
|
.map((track) => IS_TRACK_RANGE_SELECTABLE(track))
|
|
192
194
|
.reduce(or, false);
|
|
193
195
|
|
|
194
|
-
const rangeSelectorClass =
|
|
195
|
-
|
|
196
|
-
|
|
196
|
+
const rangeSelectorClass =
|
|
197
|
+
stylesTrack[
|
|
198
|
+
this.props.isRangeSelectionActive
|
|
199
|
+
? 'track-range-selection-active'
|
|
200
|
+
: 'track-range-selection'
|
|
201
|
+
];
|
|
197
202
|
|
|
198
203
|
return (
|
|
199
|
-
<div
|
|
204
|
+
<div className={styles['vertical-tiled-plot']}>
|
|
200
205
|
{isBrushable && (
|
|
201
206
|
<svg
|
|
202
207
|
ref={(el) => {
|
|
203
208
|
this.brushEl = select(el);
|
|
204
209
|
}}
|
|
210
|
+
className={rangeSelectorClass}
|
|
205
211
|
style={{
|
|
206
212
|
height: this.props.height,
|
|
207
213
|
width,
|
|
208
214
|
}}
|
|
209
|
-
styleName={rangeSelectorClass}
|
|
210
215
|
xmlns="http://www.w3.org/2000/svg"
|
|
211
216
|
/>
|
|
212
217
|
)}
|
|
213
218
|
<ListWrapper
|
|
214
219
|
axis="x"
|
|
215
|
-
className={
|
|
220
|
+
className={clsx(
|
|
221
|
+
stylesPlot.list,
|
|
222
|
+
stylesPlot.stylizedList,
|
|
223
|
+
stylesPlot.horizontalList,
|
|
224
|
+
)}
|
|
216
225
|
component={SortableList}
|
|
217
226
|
editable={this.props.editable}
|
|
218
227
|
handleConfigTrack={this.props.handleConfigTrack}
|
|
219
228
|
handleResizeTrack={this.props.handleResizeTrack}
|
|
220
229
|
height={this.props.height}
|
|
221
230
|
helperClass={stylesPlot.stylizedHelper}
|
|
222
|
-
itemClass={
|
|
231
|
+
itemClass={clsx(stylesPlot.stylizedItem, stylesPlot.horizontalItem)}
|
|
223
232
|
itemControlAlignLeft={this.props.tracksControlAlignLeft}
|
|
224
233
|
itemReactClass={VerticalItem}
|
|
225
234
|
items={this.props.tracks.map((d) => ({
|
|
File without changes
|