@jbrowse/plugin-circular-view 2.1.6 → 2.2.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/dist/BaseChordDisplay/models/BaseChordDisplayModel.d.ts +26 -0
- package/dist/BaseChordDisplay/models/BaseChordDisplayModel.js +199 -159
- package/dist/BaseChordDisplay/models/BaseChordDisplayModel.js.map +1 -1
- package/dist/BaseChordDisplay/models/baseChordDisplayConfig.js +13 -1
- package/dist/BaseChordDisplay/models/baseChordDisplayConfig.js.map +1 -1
- package/dist/CircularView/components/ImportForm.js +1 -1
- package/dist/CircularView/components/ImportForm.js.map +1 -1
- package/dist/CircularView/models/CircularView.d.ts +149 -8
- package/dist/CircularView/models/CircularView.js +176 -10
- package/dist/CircularView/models/CircularView.js.map +1 -1
- package/esm/BaseChordDisplay/models/BaseChordDisplayModel.d.ts +26 -0
- package/esm/BaseChordDisplay/models/BaseChordDisplayModel.js +199 -159
- package/esm/BaseChordDisplay/models/BaseChordDisplayModel.js.map +1 -1
- package/esm/BaseChordDisplay/models/baseChordDisplayConfig.js +13 -1
- package/esm/BaseChordDisplay/models/baseChordDisplayConfig.js.map +1 -1
- package/esm/CircularView/components/ImportForm.js +1 -1
- package/esm/CircularView/components/ImportForm.js.map +1 -1
- package/esm/CircularView/models/CircularView.d.ts +149 -8
- package/esm/CircularView/models/CircularView.js +176 -9
- package/esm/CircularView/models/CircularView.js.map +1 -1
- package/package.json +2 -2
- package/src/BaseChordDisplay/models/BaseChordDisplayModel.ts +236 -194
- package/src/BaseChordDisplay/models/baseChordDisplayConfig.ts +14 -1
- package/src/CircularView/components/ImportForm.tsx +1 -1
- package/src/CircularView/models/CircularView.ts +180 -11
|
@@ -2,7 +2,11 @@ import PluginManager from '@jbrowse/core/PluginManager';
|
|
|
2
2
|
import { SnapshotOrInstance, Instance } from 'mobx-state-tree';
|
|
3
3
|
import { Region } from '@jbrowse/core/util/types/mst';
|
|
4
4
|
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* #stateModel CircularView
|
|
7
|
+
* extends `BaseViewModel`
|
|
8
|
+
*/
|
|
9
|
+
declare function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
6
10
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
7
11
|
displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
8
12
|
} & {
|
|
@@ -15,12 +19,6 @@ export default function CircularView(pluginManager: PluginManager): import("mobx
|
|
|
15
19
|
lockedFitToWindow: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
16
20
|
disableImportForm: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
|
|
17
21
|
height: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
18
|
-
minimumRadiusPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
19
|
-
spacingPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
20
|
-
paddingPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
21
|
-
lockedPaddingPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
22
|
-
minVisibleWidth: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
23
|
-
minimumBlockWidth: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
24
22
|
displayedRegions: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
|
|
25
23
|
refName: import("mobx-state-tree").ISimpleType<string>;
|
|
26
24
|
start: import("mobx-state-tree").ISimpleType<number>;
|
|
@@ -33,6 +31,12 @@ export default function CircularView(pluginManager: PluginManager): import("mobx
|
|
|
33
31
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
34
32
|
scrollX: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
35
33
|
scrollY: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
34
|
+
minimumRadiusPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
35
|
+
spacingPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
36
|
+
paddingPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
37
|
+
lockedPaddingPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
38
|
+
minVisibleWidth: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
39
|
+
minimumBlockWidth: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
36
40
|
trackSelectorType: import("mobx-state-tree").IType<string | undefined, string, string>;
|
|
37
41
|
}, {
|
|
38
42
|
width: number;
|
|
@@ -44,55 +48,192 @@ export default function CircularView(pluginManager: PluginManager): import("mobx
|
|
|
44
48
|
} & {
|
|
45
49
|
width: number;
|
|
46
50
|
} & {
|
|
51
|
+
/**
|
|
52
|
+
* #getter
|
|
53
|
+
*/
|
|
47
54
|
readonly staticSlices: import("./slices").Slice[];
|
|
55
|
+
/**
|
|
56
|
+
* #getter
|
|
57
|
+
*/
|
|
48
58
|
readonly visibleSection: {
|
|
49
59
|
rho: [number, number];
|
|
50
60
|
theta: [number, number];
|
|
51
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* #getter
|
|
64
|
+
*/
|
|
52
65
|
readonly circumferencePx: number;
|
|
66
|
+
/**
|
|
67
|
+
* #getter
|
|
68
|
+
*/
|
|
53
69
|
readonly radiusPx: number;
|
|
70
|
+
/**
|
|
71
|
+
* #getter
|
|
72
|
+
*/
|
|
54
73
|
readonly bpPerRadian: number;
|
|
74
|
+
/**
|
|
75
|
+
* #getter
|
|
76
|
+
*/
|
|
55
77
|
readonly pxPerRadian: number;
|
|
78
|
+
/**
|
|
79
|
+
* #getter
|
|
80
|
+
*/
|
|
56
81
|
readonly centerXY: [number, number];
|
|
82
|
+
/**
|
|
83
|
+
* #getter
|
|
84
|
+
*/
|
|
57
85
|
readonly totalBp: number;
|
|
86
|
+
/**
|
|
87
|
+
* #getter
|
|
88
|
+
*/
|
|
58
89
|
readonly maximumRadiusPx: number;
|
|
90
|
+
/**
|
|
91
|
+
* #getter
|
|
92
|
+
*/
|
|
59
93
|
readonly maxBpPerPx: number;
|
|
94
|
+
/**
|
|
95
|
+
* #getter
|
|
96
|
+
*/
|
|
60
97
|
readonly minBpPerPx: number;
|
|
98
|
+
/**
|
|
99
|
+
* #getter
|
|
100
|
+
*/
|
|
61
101
|
readonly atMaxBpPerPx: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* #getter
|
|
104
|
+
*/
|
|
62
105
|
readonly atMinBpPerPx: boolean;
|
|
106
|
+
/**
|
|
107
|
+
* #getter
|
|
108
|
+
*/
|
|
63
109
|
readonly tooSmallToLock: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* #getter
|
|
112
|
+
*/
|
|
64
113
|
readonly figureDimensions: [number, number];
|
|
114
|
+
/**
|
|
115
|
+
* #getter
|
|
116
|
+
*/
|
|
65
117
|
readonly figureWidth: number;
|
|
118
|
+
/**
|
|
119
|
+
* #getter
|
|
120
|
+
*/
|
|
66
121
|
readonly figureHeight: number;
|
|
122
|
+
/**
|
|
123
|
+
* #getter
|
|
124
|
+
* this is displayedRegions, post-processed to
|
|
125
|
+
* elide regions that are too small to see reasonably
|
|
126
|
+
*/
|
|
67
127
|
readonly elidedRegions: any[];
|
|
128
|
+
/**
|
|
129
|
+
* #getter
|
|
130
|
+
*/
|
|
68
131
|
readonly assemblyNames: string[];
|
|
132
|
+
/**
|
|
133
|
+
* #getter
|
|
134
|
+
*/
|
|
69
135
|
readonly initialized: boolean;
|
|
70
136
|
} & {
|
|
137
|
+
/**
|
|
138
|
+
* #getter
|
|
139
|
+
*/
|
|
71
140
|
readonly visibleStaticSlices: import("./slices").Slice[];
|
|
72
141
|
} & {
|
|
73
142
|
error: unknown;
|
|
74
143
|
} & {
|
|
144
|
+
/**
|
|
145
|
+
* #action
|
|
146
|
+
*/
|
|
75
147
|
setWidth(newWidth: number): number;
|
|
148
|
+
/**
|
|
149
|
+
* #action
|
|
150
|
+
*/
|
|
76
151
|
setHeight(newHeight: number): number;
|
|
152
|
+
/**
|
|
153
|
+
* #action
|
|
154
|
+
*/
|
|
77
155
|
resizeHeight(distance: number): number;
|
|
156
|
+
/**
|
|
157
|
+
* #action
|
|
158
|
+
*/
|
|
78
159
|
resizeWidth(distance: number): number;
|
|
160
|
+
/**
|
|
161
|
+
* #action
|
|
162
|
+
*/
|
|
79
163
|
rotateClockwiseButton(): void;
|
|
164
|
+
/**
|
|
165
|
+
* #action
|
|
166
|
+
*/
|
|
80
167
|
rotateCounterClockwiseButton(): void;
|
|
168
|
+
/**
|
|
169
|
+
* #action
|
|
170
|
+
*/
|
|
81
171
|
rotateClockwise(distance?: number): void;
|
|
172
|
+
/**
|
|
173
|
+
* #action
|
|
174
|
+
*/
|
|
82
175
|
rotateCounterClockwise(distance?: number): void;
|
|
176
|
+
/**
|
|
177
|
+
* #action
|
|
178
|
+
*/
|
|
83
179
|
zoomInButton(): void;
|
|
180
|
+
/**
|
|
181
|
+
* #action
|
|
182
|
+
*/
|
|
84
183
|
zoomOutButton(): void;
|
|
184
|
+
/**
|
|
185
|
+
* #action
|
|
186
|
+
*/
|
|
85
187
|
setBpPerPx(newVal: number): void;
|
|
188
|
+
/**
|
|
189
|
+
* #action
|
|
190
|
+
*/
|
|
86
191
|
setModelViewWhenAdjust(secondCondition: boolean): void;
|
|
192
|
+
/**
|
|
193
|
+
* #action
|
|
194
|
+
*/
|
|
87
195
|
closeView(): void;
|
|
196
|
+
/**
|
|
197
|
+
* #action
|
|
198
|
+
*/
|
|
88
199
|
setDisplayedRegions(regions: SnapshotOrInstance<typeof Region>[]): void;
|
|
200
|
+
/**
|
|
201
|
+
* #action
|
|
202
|
+
*/
|
|
89
203
|
activateTrackSelector(): import("@jbrowse/core/util").Widget;
|
|
204
|
+
/**
|
|
205
|
+
* #action
|
|
206
|
+
*/
|
|
90
207
|
toggleTrack(trackId: string): void;
|
|
208
|
+
/**
|
|
209
|
+
* #action
|
|
210
|
+
*/
|
|
91
211
|
setError(error: unknown): void;
|
|
212
|
+
/**
|
|
213
|
+
* #action
|
|
214
|
+
*/
|
|
92
215
|
showTrack(trackId: string, initialSnapshot?: {}): void;
|
|
216
|
+
/**
|
|
217
|
+
* #action
|
|
218
|
+
*/
|
|
93
219
|
addTrackConf(configuration: AnyConfigurationModel, initialSnapshot?: {}): void;
|
|
220
|
+
/**
|
|
221
|
+
* #action
|
|
222
|
+
*/
|
|
94
223
|
hideTrack(trackId: string): number;
|
|
224
|
+
/**
|
|
225
|
+
* #action
|
|
226
|
+
*/
|
|
95
227
|
toggleFitToWindowLock(): boolean;
|
|
96
228
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
97
|
-
export declare type CircularViewStateModel = ReturnType<typeof
|
|
229
|
+
export declare type CircularViewStateModel = ReturnType<typeof stateModelFactory>;
|
|
98
230
|
export declare type CircularViewModel = Instance<CircularViewStateModel>;
|
|
231
|
+
/**
|
|
232
|
+
PLANS
|
|
233
|
+
|
|
234
|
+
- tracks
|
|
235
|
+
- ruler tick marks
|
|
236
|
+
- set viewport scroll from state snapshot
|
|
237
|
+
|
|
238
|
+
*/
|
|
239
|
+
export default stateModelFactory;
|
|
@@ -8,39 +8,86 @@ const util_1 = require("@jbrowse/core/util");
|
|
|
8
8
|
const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
|
|
9
9
|
const slices_1 = require("./slices");
|
|
10
10
|
const viewportVisibleRegion_1 = require("./viewportVisibleRegion");
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* #stateModel CircularView
|
|
13
|
+
* extends `BaseViewModel`
|
|
14
|
+
*/
|
|
15
|
+
function stateModelFactory(pluginManager) {
|
|
12
16
|
const minHeight = 40;
|
|
13
17
|
const minWidth = 100;
|
|
14
18
|
const defaultHeight = 400;
|
|
15
19
|
return mobx_state_tree_1.types.compose(models_1.BaseViewModel, mobx_state_tree_1.types
|
|
16
20
|
.model('CircularView', {
|
|
21
|
+
/**
|
|
22
|
+
* #property
|
|
23
|
+
*/
|
|
17
24
|
type: mobx_state_tree_1.types.literal('CircularView'),
|
|
25
|
+
/**
|
|
26
|
+
* #property
|
|
27
|
+
* similar to offsetPx in linear genome view
|
|
28
|
+
*/
|
|
18
29
|
offsetRadians: -Math.PI / 2,
|
|
30
|
+
/**
|
|
31
|
+
* #property
|
|
32
|
+
*/
|
|
19
33
|
bpPerPx: 2000000,
|
|
34
|
+
/**
|
|
35
|
+
* #property
|
|
36
|
+
*/
|
|
20
37
|
tracks: mobx_state_tree_1.types.array(pluginManager.pluggableMstType('track', 'stateModel')),
|
|
38
|
+
/**
|
|
39
|
+
* #property
|
|
40
|
+
*/
|
|
21
41
|
hideVerticalResizeHandle: false,
|
|
42
|
+
/**
|
|
43
|
+
* #property
|
|
44
|
+
*/
|
|
22
45
|
hideTrackSelectorButton: false,
|
|
46
|
+
/**
|
|
47
|
+
* #property
|
|
48
|
+
*/
|
|
23
49
|
lockedFitToWindow: true,
|
|
50
|
+
/**
|
|
51
|
+
* #property
|
|
52
|
+
*/
|
|
24
53
|
disableImportForm: false,
|
|
54
|
+
/**
|
|
55
|
+
* #property
|
|
56
|
+
*/
|
|
25
57
|
height: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.refinement('trackHeight', mobx_state_tree_1.types.number, n => n >= minHeight), defaultHeight),
|
|
58
|
+
/**
|
|
59
|
+
* #property
|
|
60
|
+
*/
|
|
61
|
+
displayedRegions: mobx_state_tree_1.types.array(mst_1.Region),
|
|
62
|
+
/**
|
|
63
|
+
* #property
|
|
64
|
+
*/
|
|
65
|
+
scrollX: 0,
|
|
66
|
+
/**
|
|
67
|
+
* #property
|
|
68
|
+
*/
|
|
69
|
+
scrollY: 0,
|
|
26
70
|
minimumRadiusPx: 25,
|
|
27
71
|
spacingPx: 10,
|
|
28
72
|
paddingPx: 80,
|
|
29
73
|
lockedPaddingPx: 100,
|
|
30
74
|
minVisibleWidth: 6,
|
|
31
75
|
minimumBlockWidth: 20,
|
|
32
|
-
displayedRegions: mobx_state_tree_1.types.array(mst_1.Region),
|
|
33
|
-
scrollX: 0,
|
|
34
|
-
scrollY: 0,
|
|
35
76
|
trackSelectorType: 'hierarchical',
|
|
36
77
|
})
|
|
37
78
|
.volatile(() => ({
|
|
38
79
|
width: 0,
|
|
39
80
|
}))
|
|
40
81
|
.views(self => ({
|
|
82
|
+
/**
|
|
83
|
+
* #getter
|
|
84
|
+
*/
|
|
41
85
|
get staticSlices() {
|
|
42
86
|
return (0, slices_1.calculateStaticSlices)(self);
|
|
43
87
|
},
|
|
88
|
+
/**
|
|
89
|
+
* #getter
|
|
90
|
+
*/
|
|
44
91
|
get visibleSection() {
|
|
45
92
|
return (0, viewportVisibleRegion_1.viewportVisibleSection)([
|
|
46
93
|
self.scrollX,
|
|
@@ -49,6 +96,9 @@ function CircularView(pluginManager) {
|
|
|
49
96
|
self.scrollY + self.height,
|
|
50
97
|
], this.centerXY, this.radiusPx);
|
|
51
98
|
},
|
|
99
|
+
/**
|
|
100
|
+
* #getter
|
|
101
|
+
*/
|
|
52
102
|
get circumferencePx() {
|
|
53
103
|
let elidedBp = 0;
|
|
54
104
|
for (const r of this.elidedRegions) {
|
|
@@ -56,21 +106,36 @@ function CircularView(pluginManager) {
|
|
|
56
106
|
}
|
|
57
107
|
return (elidedBp / self.bpPerPx + self.spacingPx * this.elidedRegions.length);
|
|
58
108
|
},
|
|
109
|
+
/**
|
|
110
|
+
* #getter
|
|
111
|
+
*/
|
|
59
112
|
get radiusPx() {
|
|
60
113
|
return this.circumferencePx / (2 * Math.PI);
|
|
61
114
|
},
|
|
115
|
+
/**
|
|
116
|
+
* #getter
|
|
117
|
+
*/
|
|
62
118
|
get bpPerRadian() {
|
|
63
119
|
return self.bpPerPx * this.radiusPx;
|
|
64
120
|
},
|
|
121
|
+
/**
|
|
122
|
+
* #getter
|
|
123
|
+
*/
|
|
65
124
|
get pxPerRadian() {
|
|
66
125
|
return this.radiusPx;
|
|
67
126
|
},
|
|
127
|
+
/**
|
|
128
|
+
* #getter
|
|
129
|
+
*/
|
|
68
130
|
get centerXY() {
|
|
69
131
|
return [
|
|
70
132
|
this.radiusPx + self.paddingPx,
|
|
71
133
|
this.radiusPx + self.paddingPx,
|
|
72
134
|
];
|
|
73
135
|
},
|
|
136
|
+
/**
|
|
137
|
+
* #getter
|
|
138
|
+
*/
|
|
74
139
|
get totalBp() {
|
|
75
140
|
let total = 0;
|
|
76
141
|
for (const region of self.displayedRegions) {
|
|
@@ -78,43 +143,73 @@ function CircularView(pluginManager) {
|
|
|
78
143
|
}
|
|
79
144
|
return total;
|
|
80
145
|
},
|
|
146
|
+
/**
|
|
147
|
+
* #getter
|
|
148
|
+
*/
|
|
81
149
|
get maximumRadiusPx() {
|
|
82
150
|
return self.lockedFitToWindow
|
|
83
151
|
? Math.min(self.width, self.height) / 2 - self.lockedPaddingPx
|
|
84
152
|
: 1000000;
|
|
85
153
|
},
|
|
154
|
+
/**
|
|
155
|
+
* #getter
|
|
156
|
+
*/
|
|
86
157
|
get maxBpPerPx() {
|
|
87
158
|
const minCircumferencePx = 2 * Math.PI * self.minimumRadiusPx;
|
|
88
159
|
return this.totalBp / minCircumferencePx;
|
|
89
160
|
},
|
|
161
|
+
/**
|
|
162
|
+
* #getter
|
|
163
|
+
*/
|
|
90
164
|
get minBpPerPx() {
|
|
91
165
|
// min depends on window dimensions, clamp between old min(0.01) and max
|
|
92
166
|
const maxCircumferencePx = 2 * Math.PI * this.maximumRadiusPx;
|
|
93
167
|
return (0, util_1.clamp)(this.totalBp / maxCircumferencePx, 0.0000000001, this.maxBpPerPx);
|
|
94
168
|
},
|
|
169
|
+
/**
|
|
170
|
+
* #getter
|
|
171
|
+
*/
|
|
95
172
|
get atMaxBpPerPx() {
|
|
96
173
|
return self.bpPerPx >= this.maxBpPerPx;
|
|
97
174
|
},
|
|
175
|
+
/**
|
|
176
|
+
* #getter
|
|
177
|
+
*/
|
|
98
178
|
get atMinBpPerPx() {
|
|
99
179
|
return self.bpPerPx <= this.minBpPerPx;
|
|
100
180
|
},
|
|
181
|
+
/**
|
|
182
|
+
* #getter
|
|
183
|
+
*/
|
|
101
184
|
get tooSmallToLock() {
|
|
102
185
|
return this.minBpPerPx <= 0.0000000001;
|
|
103
186
|
},
|
|
187
|
+
/**
|
|
188
|
+
* #getter
|
|
189
|
+
*/
|
|
104
190
|
get figureDimensions() {
|
|
105
191
|
return [
|
|
106
192
|
this.radiusPx * 2 + 2 * self.paddingPx,
|
|
107
193
|
this.radiusPx * 2 + 2 * self.paddingPx,
|
|
108
194
|
];
|
|
109
195
|
},
|
|
196
|
+
/**
|
|
197
|
+
* #getter
|
|
198
|
+
*/
|
|
110
199
|
get figureWidth() {
|
|
111
200
|
return this.figureDimensions[0];
|
|
112
201
|
},
|
|
202
|
+
/**
|
|
203
|
+
* #getter
|
|
204
|
+
*/
|
|
113
205
|
get figureHeight() {
|
|
114
206
|
return this.figureDimensions[1];
|
|
115
207
|
},
|
|
116
|
-
|
|
117
|
-
|
|
208
|
+
/**
|
|
209
|
+
* #getter
|
|
210
|
+
* this is displayedRegions, post-processed to
|
|
211
|
+
* elide regions that are too small to see reasonably
|
|
212
|
+
*/
|
|
118
213
|
get elidedRegions() {
|
|
119
214
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
120
215
|
const visible = [];
|
|
@@ -151,6 +246,9 @@ function CircularView(pluginManager) {
|
|
|
151
246
|
}
|
|
152
247
|
return visible;
|
|
153
248
|
},
|
|
249
|
+
/**
|
|
250
|
+
* #getter
|
|
251
|
+
*/
|
|
154
252
|
get assemblyNames() {
|
|
155
253
|
const assemblyNames = [];
|
|
156
254
|
self.displayedRegions.forEach(displayedRegion => {
|
|
@@ -160,12 +258,18 @@ function CircularView(pluginManager) {
|
|
|
160
258
|
});
|
|
161
259
|
return assemblyNames;
|
|
162
260
|
},
|
|
261
|
+
/**
|
|
262
|
+
* #getter
|
|
263
|
+
*/
|
|
163
264
|
get initialized() {
|
|
164
265
|
const { assemblyManager } = (0, util_1.getSession)(self);
|
|
165
266
|
return this.assemblyNames.every(a => { var _a; return (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.initialized; });
|
|
166
267
|
},
|
|
167
268
|
}))
|
|
168
269
|
.views(self => ({
|
|
270
|
+
/**
|
|
271
|
+
* #getter
|
|
272
|
+
*/
|
|
169
273
|
get visibleStaticSlices() {
|
|
170
274
|
return self.staticSlices.filter(s => (0, slices_1.sliceIsVisible)(self, s));
|
|
171
275
|
},
|
|
@@ -174,57 +278,98 @@ function CircularView(pluginManager) {
|
|
|
174
278
|
error: undefined,
|
|
175
279
|
}))
|
|
176
280
|
.actions(self => ({
|
|
177
|
-
|
|
281
|
+
/**
|
|
282
|
+
* #action
|
|
283
|
+
*/
|
|
178
284
|
setWidth(newWidth) {
|
|
179
285
|
self.width = Math.max(newWidth, minWidth);
|
|
180
286
|
return self.width;
|
|
181
287
|
},
|
|
288
|
+
/**
|
|
289
|
+
* #action
|
|
290
|
+
*/
|
|
182
291
|
setHeight(newHeight) {
|
|
183
292
|
self.height = Math.max(newHeight, minHeight);
|
|
184
293
|
return self.height;
|
|
185
294
|
},
|
|
295
|
+
/**
|
|
296
|
+
* #action
|
|
297
|
+
*/
|
|
186
298
|
resizeHeight(distance) {
|
|
187
299
|
const oldHeight = self.height;
|
|
188
300
|
const newHeight = this.setHeight(self.height + distance);
|
|
189
301
|
this.setModelViewWhenAdjust(!self.tooSmallToLock);
|
|
190
302
|
return newHeight - oldHeight;
|
|
191
303
|
},
|
|
304
|
+
/**
|
|
305
|
+
* #action
|
|
306
|
+
*/
|
|
192
307
|
resizeWidth(distance) {
|
|
193
308
|
const oldWidth = self.width;
|
|
194
309
|
const newWidth = this.setWidth(self.width + distance);
|
|
195
310
|
this.setModelViewWhenAdjust(!self.tooSmallToLock);
|
|
196
311
|
return newWidth - oldWidth;
|
|
197
312
|
},
|
|
313
|
+
/**
|
|
314
|
+
* #action
|
|
315
|
+
*/
|
|
198
316
|
rotateClockwiseButton() {
|
|
199
317
|
this.rotateClockwise(Math.PI / 6);
|
|
200
318
|
},
|
|
319
|
+
/**
|
|
320
|
+
* #action
|
|
321
|
+
*/
|
|
201
322
|
rotateCounterClockwiseButton() {
|
|
202
323
|
this.rotateCounterClockwise(Math.PI / 6);
|
|
203
324
|
},
|
|
325
|
+
/**
|
|
326
|
+
* #action
|
|
327
|
+
*/
|
|
204
328
|
rotateClockwise(distance = 0.17) {
|
|
205
329
|
self.offsetRadians += distance;
|
|
206
330
|
},
|
|
331
|
+
/**
|
|
332
|
+
* #action
|
|
333
|
+
*/
|
|
207
334
|
rotateCounterClockwise(distance = 0.17) {
|
|
208
335
|
self.offsetRadians -= distance;
|
|
209
336
|
},
|
|
337
|
+
/**
|
|
338
|
+
* #action
|
|
339
|
+
*/
|
|
210
340
|
zoomInButton() {
|
|
211
341
|
this.setBpPerPx(self.bpPerPx / 1.4);
|
|
212
342
|
},
|
|
343
|
+
/**
|
|
344
|
+
* #action
|
|
345
|
+
*/
|
|
213
346
|
zoomOutButton() {
|
|
214
347
|
this.setBpPerPx(self.bpPerPx * 1.4);
|
|
215
348
|
},
|
|
349
|
+
/**
|
|
350
|
+
* #action
|
|
351
|
+
*/
|
|
216
352
|
setBpPerPx(newVal) {
|
|
217
353
|
self.bpPerPx = (0, util_1.clamp)(newVal, self.minBpPerPx, self.maxBpPerPx);
|
|
218
354
|
},
|
|
355
|
+
/**
|
|
356
|
+
* #action
|
|
357
|
+
*/
|
|
219
358
|
setModelViewWhenAdjust(secondCondition) {
|
|
220
359
|
if (self.lockedFitToWindow && secondCondition) {
|
|
221
360
|
this.setBpPerPx(self.minBpPerPx);
|
|
222
361
|
}
|
|
223
362
|
},
|
|
363
|
+
/**
|
|
364
|
+
* #action
|
|
365
|
+
*/
|
|
224
366
|
closeView() {
|
|
225
367
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
226
368
|
(0, mobx_state_tree_1.getParent)(self, 2).removeView(self);
|
|
227
369
|
},
|
|
370
|
+
/**
|
|
371
|
+
* #action
|
|
372
|
+
*/
|
|
228
373
|
setDisplayedRegions(regions) {
|
|
229
374
|
const previouslyEmpty = self.displayedRegions.length === 0;
|
|
230
375
|
self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
|
|
@@ -235,6 +380,9 @@ function CircularView(pluginManager) {
|
|
|
235
380
|
this.setBpPerPx(self.bpPerPx);
|
|
236
381
|
}
|
|
237
382
|
},
|
|
383
|
+
/**
|
|
384
|
+
* #action
|
|
385
|
+
*/
|
|
238
386
|
activateTrackSelector() {
|
|
239
387
|
if (self.trackSelectorType === 'hierarchical') {
|
|
240
388
|
const session = (0, util_1.getSession)(self);
|
|
@@ -246,6 +394,9 @@ function CircularView(pluginManager) {
|
|
|
246
394
|
}
|
|
247
395
|
throw new Error(`invalid track selector type ${self.trackSelectorType}`);
|
|
248
396
|
},
|
|
397
|
+
/**
|
|
398
|
+
* #action
|
|
399
|
+
*/
|
|
249
400
|
toggleTrack(trackId) {
|
|
250
401
|
// if we have any tracks with that configuration, turn them off
|
|
251
402
|
const hiddenCount = this.hideTrack(trackId);
|
|
@@ -254,10 +405,16 @@ function CircularView(pluginManager) {
|
|
|
254
405
|
this.showTrack(trackId);
|
|
255
406
|
}
|
|
256
407
|
},
|
|
408
|
+
/**
|
|
409
|
+
* #action
|
|
410
|
+
*/
|
|
257
411
|
setError(error) {
|
|
258
412
|
console.error(error);
|
|
259
413
|
self.error = error;
|
|
260
414
|
},
|
|
415
|
+
/**
|
|
416
|
+
* #action
|
|
417
|
+
*/
|
|
261
418
|
showTrack(trackId, initialSnapshot = {}) {
|
|
262
419
|
const schema = pluginManager.pluggableConfigSchemaType('track');
|
|
263
420
|
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
@@ -276,6 +433,9 @@ function CircularView(pluginManager) {
|
|
|
276
433
|
});
|
|
277
434
|
self.tracks.push(track);
|
|
278
435
|
},
|
|
436
|
+
/**
|
|
437
|
+
* #action
|
|
438
|
+
*/
|
|
279
439
|
addTrackConf(configuration, initialSnapshot = {}) {
|
|
280
440
|
const { type } = configuration;
|
|
281
441
|
const name = (0, configuration_1.readConfObject)(configuration, 'name');
|
|
@@ -295,6 +455,9 @@ function CircularView(pluginManager) {
|
|
|
295
455
|
});
|
|
296
456
|
self.tracks.push(track);
|
|
297
457
|
},
|
|
458
|
+
/**
|
|
459
|
+
* #action
|
|
460
|
+
*/
|
|
298
461
|
hideTrack(trackId) {
|
|
299
462
|
const schema = pluginManager.pluggableConfigSchemaType('track');
|
|
300
463
|
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
@@ -302,16 +465,18 @@ function CircularView(pluginManager) {
|
|
|
302
465
|
(0, mobx_1.transaction)(() => t.forEach(t => self.tracks.remove(t)));
|
|
303
466
|
return t.length;
|
|
304
467
|
},
|
|
468
|
+
/**
|
|
469
|
+
* #action
|
|
470
|
+
*/
|
|
305
471
|
toggleFitToWindowLock() {
|
|
306
|
-
self.lockedFitToWindow = !self.lockedFitToWindow;
|
|
307
472
|
// when going unlocked -> locked and circle is cut off, set to the locked minBpPerPx
|
|
473
|
+
self.lockedFitToWindow = !self.lockedFitToWindow;
|
|
308
474
|
this.setModelViewWhenAdjust(self.atMinBpPerPx);
|
|
309
475
|
return self.lockedFitToWindow;
|
|
310
476
|
},
|
|
311
477
|
})));
|
|
312
478
|
}
|
|
313
|
-
|
|
314
|
-
/*
|
|
479
|
+
/**
|
|
315
480
|
PLANS
|
|
316
481
|
|
|
317
482
|
- tracks
|
|
@@ -319,4 +484,5 @@ PLANS
|
|
|
319
484
|
- set viewport scroll from state snapshot
|
|
320
485
|
|
|
321
486
|
*/
|
|
487
|
+
exports.default = stateModelFactory;
|
|
322
488
|
//# sourceMappingURL=CircularView.js.map
|