@jbrowse/plugin-circular-view 1.7.11 → 2.1.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/components/BaseChordDisplay.d.ts +2 -7
- package/dist/BaseChordDisplay/components/BaseChordDisplay.js +18 -48
- package/dist/BaseChordDisplay/components/BaseChordDisplay.js.map +1 -0
- package/dist/BaseChordDisplay/components/DisplayError.d.ts +9 -4
- package/dist/BaseChordDisplay/components/DisplayError.js +24 -67
- package/dist/BaseChordDisplay/components/DisplayError.js.map +1 -0
- package/dist/BaseChordDisplay/components/Loading.d.ts +2 -3
- package/dist/BaseChordDisplay/components/Loading.js +98 -112
- package/dist/BaseChordDisplay/components/Loading.js.map +1 -0
- package/dist/BaseChordDisplay/components/RpcRenderedSvgGroup.d.ts +3 -3
- package/dist/BaseChordDisplay/components/RpcRenderedSvgGroup.js +80 -91
- package/dist/BaseChordDisplay/components/RpcRenderedSvgGroup.js.map +1 -0
- package/dist/BaseChordDisplay/index.d.ts +1 -1
- package/dist/BaseChordDisplay/index.js +12 -30
- package/dist/BaseChordDisplay/index.js.map +1 -0
- package/dist/BaseChordDisplay/models/BaseChordDisplayModel.d.ts +10 -10
- package/dist/BaseChordDisplay/models/BaseChordDisplayModel.js +204 -232
- package/dist/BaseChordDisplay/models/BaseChordDisplayModel.js.map +1 -0
- package/dist/BaseChordDisplay/models/baseChordDisplayConfig.js +12 -18
- package/dist/BaseChordDisplay/models/baseChordDisplayConfig.js.map +1 -0
- package/dist/BaseChordDisplay/models/renderReaction.js +115 -138
- package/dist/BaseChordDisplay/models/renderReaction.js.map +1 -0
- package/dist/CircularView/components/CircularView.js +111 -185
- package/dist/CircularView/components/CircularView.js.map +1 -0
- package/dist/CircularView/components/ImportForm.js +77 -92
- package/dist/CircularView/components/ImportForm.js.map +1 -0
- package/dist/CircularView/components/Ruler.js +148 -194
- package/dist/CircularView/components/Ruler.js.map +1 -0
- package/dist/CircularView/models/CircularView.d.ts +3 -3
- package/dist/CircularView/models/CircularView.js +346 -409
- package/dist/CircularView/models/CircularView.js.map +1 -0
- package/dist/CircularView/models/slices.js +90 -104
- package/dist/CircularView/models/slices.js.map +1 -0
- package/dist/CircularView/models/viewportVisibleRegion.js +229 -264
- package/dist/CircularView/models/viewportVisibleRegion.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +147 -176
- package/dist/index.js.map +1 -0
- package/esm/BaseChordDisplay/components/BaseChordDisplay.d.ts +4 -0
- package/esm/BaseChordDisplay/components/BaseChordDisplay.js +17 -0
- package/esm/BaseChordDisplay/components/BaseChordDisplay.js.map +1 -0
- package/esm/BaseChordDisplay/components/DisplayError.d.ts +9 -0
- package/esm/BaseChordDisplay/components/DisplayError.js +21 -0
- package/esm/BaseChordDisplay/components/DisplayError.js.map +1 -0
- package/esm/BaseChordDisplay/components/Loading.d.ts +9 -0
- package/esm/BaseChordDisplay/components/Loading.js +66 -0
- package/esm/BaseChordDisplay/components/Loading.js.map +1 -0
- package/esm/BaseChordDisplay/components/RpcRenderedSvgGroup.d.ts +4 -0
- package/esm/BaseChordDisplay/components/RpcRenderedSvgGroup.js +48 -0
- package/esm/BaseChordDisplay/components/RpcRenderedSvgGroup.js.map +1 -0
- package/esm/BaseChordDisplay/index.d.ts +3 -0
- package/esm/BaseChordDisplay/index.js +4 -0
- package/esm/BaseChordDisplay/index.js.map +1 -0
- package/esm/BaseChordDisplay/models/BaseChordDisplayModel.d.ts +99 -0
- package/esm/BaseChordDisplay/models/BaseChordDisplayModel.js +181 -0
- package/esm/BaseChordDisplay/models/BaseChordDisplayModel.js.map +1 -0
- package/esm/BaseChordDisplay/models/baseChordDisplayConfig.d.ts +2 -0
- package/esm/BaseChordDisplay/models/baseChordDisplayConfig.js +11 -0
- package/esm/BaseChordDisplay/models/baseChordDisplayConfig.js.map +1 -0
- package/esm/BaseChordDisplay/models/renderReaction.d.ts +30 -0
- package/esm/BaseChordDisplay/models/renderReaction.js +52 -0
- package/esm/BaseChordDisplay/models/renderReaction.js.map +1 -0
- package/esm/CircularView/components/CircularView.d.ts +4 -0
- package/esm/CircularView/components/CircularView.js +121 -0
- package/esm/CircularView/components/CircularView.js.map +1 -0
- package/esm/CircularView/components/ImportForm.d.ts +5 -0
- package/esm/CircularView/components/ImportForm.js +40 -0
- package/esm/CircularView/components/ImportForm.js.map +1 -0
- package/esm/CircularView/components/Ruler.d.ts +5 -0
- package/esm/CircularView/components/Ruler.js +126 -0
- package/esm/CircularView/components/Ruler.js.map +1 -0
- package/esm/CircularView/models/CircularView.d.ts +97 -0
- package/esm/CircularView/models/CircularView.js +317 -0
- package/esm/CircularView/models/CircularView.js.map +1 -0
- package/esm/CircularView/models/slices.d.ts +27 -0
- package/esm/CircularView/models/slices.js +53 -0
- package/esm/CircularView/models/slices.js.map +1 -0
- package/esm/CircularView/models/viewportVisibleRegion.d.ts +6 -0
- package/esm/CircularView/models/viewportVisibleRegion.js +223 -0
- package/esm/CircularView/models/viewportVisibleRegion.js.map +1 -0
- package/esm/index.d.ts +10 -0
- package/esm/index.js +49 -0
- package/esm/index.js.map +1 -0
- package/package.json +20 -12
- package/src/BaseChordDisplay/components/BaseChordDisplay.tsx +13 -25
- package/src/BaseChordDisplay/components/DisplayError.js +64 -66
- package/src/BaseChordDisplay/components/Loading.tsx +104 -107
- package/src/BaseChordDisplay/components/RpcRenderedSvgGroup.js +44 -51
- package/src/BaseChordDisplay/index.ts +1 -1
- package/src/BaseChordDisplay/models/BaseChordDisplayModel.ts +2 -1
- package/src/CircularView/components/CircularView.js +17 -16
- package/src/CircularView/components/ImportForm.tsx +5 -5
- package/src/CircularView/components/Ruler.js +4 -3
- package/src/CircularView/models/CircularView.ts +29 -42
- package/src/CircularView/models/slices.ts +2 -7
- package/src/index.ts +5 -2
- package/dist/CircularView/models/slices.test.js +0 -83
- package/dist/CircularView/models/viewportVisibleRegion.test.js +0 -130
|
@@ -1,417 +1,353 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.default = CircularView;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
13
|
-
|
|
14
|
-
var _mst = require("@jbrowse/core/util/types/mst");
|
|
15
|
-
|
|
16
|
-
var _mobx = require("mobx");
|
|
17
|
-
|
|
18
|
-
var _configuration = require("@jbrowse/core/configuration");
|
|
19
|
-
|
|
20
|
-
var _util = require("@jbrowse/core/util");
|
|
21
|
-
|
|
22
|
-
var _models = require("@jbrowse/core/pluggableElementTypes/models");
|
|
23
|
-
|
|
24
|
-
var _slices = require("./slices");
|
|
25
|
-
|
|
26
|
-
var _viewportVisibleRegion = require("./viewportVisibleRegion");
|
|
27
|
-
|
|
28
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
-
|
|
30
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
|
-
|
|
32
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
33
|
-
|
|
34
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
35
|
-
|
|
36
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
37
|
-
|
|
38
|
-
function CircularView(pluginManager) {
|
|
39
|
-
var minHeight = 40;
|
|
40
|
-
var minWidth = 100;
|
|
41
|
-
var defaultHeight = 400;
|
|
42
|
-
return _mobxStateTree.types.compose(_models.BaseViewModel, _mobxStateTree.types.model('CircularView', {
|
|
43
|
-
type: _mobxStateTree.types.literal('CircularView'),
|
|
44
|
-
offsetRadians: -Math.PI / 2,
|
|
45
|
-
bpPerPx: 2000000,
|
|
46
|
-
tracks: _mobxStateTree.types.array(pluginManager.pluggableMstType('track', 'stateModel')),
|
|
47
|
-
hideVerticalResizeHandle: false,
|
|
48
|
-
hideTrackSelectorButton: false,
|
|
49
|
-
lockedFitToWindow: true,
|
|
50
|
-
disableImportForm: false,
|
|
51
|
-
height: _mobxStateTree.types.optional(_mobxStateTree.types.refinement('trackHeight', _mobxStateTree.types.number, function (n) {
|
|
52
|
-
return n >= minHeight;
|
|
53
|
-
}), defaultHeight),
|
|
54
|
-
minimumRadiusPx: 25,
|
|
55
|
-
spacingPx: 10,
|
|
56
|
-
paddingPx: 80,
|
|
57
|
-
lockedPaddingPx: 100,
|
|
58
|
-
minVisibleWidth: 6,
|
|
59
|
-
minimumBlockWidth: 20,
|
|
60
|
-
displayedRegions: _mobxStateTree.types.array(_mst.Region),
|
|
61
|
-
scrollX: 0,
|
|
62
|
-
scrollY: 0,
|
|
63
|
-
trackSelectorType: 'hierarchical'
|
|
64
|
-
}).volatile(function () {
|
|
65
|
-
return {
|
|
66
|
-
width: 0
|
|
67
|
-
};
|
|
68
|
-
}).views(function (self) {
|
|
69
|
-
return {
|
|
70
|
-
get staticSlices() {
|
|
71
|
-
return (0, _slices.calculateStaticSlices)(self);
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
get visibleStaticSlices() {
|
|
75
|
-
return this.staticSlices.filter(_slices.sliceIsVisible.bind(this, self));
|
|
76
|
-
},
|
|
77
|
-
|
|
78
|
-
get visibleSection() {
|
|
79
|
-
return (0, _viewportVisibleRegion.viewportVisibleSection)([self.scrollX, self.scrollX + self.width, self.scrollY, self.scrollY + self.height], this.centerXY, this.radiusPx);
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
get circumferencePx() {
|
|
83
|
-
var elidedBp = 0;
|
|
84
|
-
|
|
85
|
-
var _iterator = _createForOfIteratorHelper(this.elidedRegions),
|
|
86
|
-
_step;
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
90
|
-
var r = _step.value;
|
|
91
|
-
elidedBp += r.widthBp;
|
|
92
|
-
}
|
|
93
|
-
} catch (err) {
|
|
94
|
-
_iterator.e(err);
|
|
95
|
-
} finally {
|
|
96
|
-
_iterator.f();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return elidedBp / self.bpPerPx + self.spacingPx * this.elidedRegions.length;
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
get radiusPx() {
|
|
103
|
-
return this.circumferencePx / (2 * Math.PI);
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
get bpPerRadian() {
|
|
107
|
-
return self.bpPerPx * this.radiusPx;
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
get pxPerRadian() {
|
|
111
|
-
return this.radiusPx;
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
get centerXY() {
|
|
115
|
-
return [this.radiusPx + self.paddingPx, this.radiusPx + self.paddingPx];
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
get totalBp() {
|
|
119
|
-
var total = 0;
|
|
120
|
-
|
|
121
|
-
var _iterator2 = _createForOfIteratorHelper(self.displayedRegions),
|
|
122
|
-
_step2;
|
|
123
|
-
|
|
124
|
-
try {
|
|
125
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
126
|
-
var region = _step2.value;
|
|
127
|
-
total += region.end - region.start;
|
|
128
|
-
}
|
|
129
|
-
} catch (err) {
|
|
130
|
-
_iterator2.e(err);
|
|
131
|
-
} finally {
|
|
132
|
-
_iterator2.f();
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
133
8
|
}
|
|
134
|
-
|
|
135
|
-
return total;
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
get maximumRadiusPx() {
|
|
139
|
-
return self.lockedFitToWindow ? Math.min(self.width, self.height) / 2 - self.lockedPaddingPx : 1000000;
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
get maxBpPerPx() {
|
|
143
|
-
var minCircumferencePx = 2 * Math.PI * self.minimumRadiusPx;
|
|
144
|
-
return this.totalBp / minCircumferencePx;
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
get minBpPerPx() {
|
|
148
|
-
// min depends on window dimensions, clamp between old min(0.01) and max
|
|
149
|
-
var maxCircumferencePx = 2 * Math.PI * this.maximumRadiusPx;
|
|
150
|
-
return (0, _util.clamp)(this.totalBp / maxCircumferencePx, 0.0000000001, this.maxBpPerPx);
|
|
151
|
-
},
|
|
152
|
-
|
|
153
|
-
get atMaxBpPerPx() {
|
|
154
|
-
return self.bpPerPx >= this.maxBpPerPx;
|
|
155
|
-
},
|
|
156
|
-
|
|
157
|
-
get atMinBpPerPx() {
|
|
158
|
-
return self.bpPerPx <= this.minBpPerPx;
|
|
159
|
-
},
|
|
160
|
-
|
|
161
|
-
get tooSmallToLock() {
|
|
162
|
-
return this.minBpPerPx <= 0.0000000001;
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
get figureDimensions() {
|
|
166
|
-
return [this.radiusPx * 2 + 2 * self.paddingPx, this.radiusPx * 2 + 2 * self.paddingPx];
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
get figureWidth() {
|
|
170
|
-
return this.figureDimensions[0];
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
get figureHeight() {
|
|
174
|
-
return this.figureDimensions[1];
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
// this is displayedRegions, post-processed to
|
|
178
|
-
// elide regions that are too small to see reasonably
|
|
179
|
-
get elidedRegions() {
|
|
180
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
181
|
-
var visible = [];
|
|
182
|
-
self.displayedRegions.forEach(function (region) {
|
|
183
|
-
var widthBp = region.end - region.start;
|
|
184
|
-
var widthPx = widthBp / self.bpPerPx;
|
|
185
|
-
|
|
186
|
-
if (widthPx < self.minVisibleWidth) {
|
|
187
|
-
// too small to see, collapse into a single elision region
|
|
188
|
-
var lastVisible = visible[visible.length - 1];
|
|
189
|
-
|
|
190
|
-
if (lastVisible && lastVisible.elided) {
|
|
191
|
-
lastVisible.regions.push(_objectSpread({}, region));
|
|
192
|
-
lastVisible.widthBp += widthBp;
|
|
193
|
-
} else {
|
|
194
|
-
visible.push({
|
|
195
|
-
elided: true,
|
|
196
|
-
widthBp: widthBp,
|
|
197
|
-
regions: [_objectSpread({}, region)]
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
} else {
|
|
201
|
-
// big enough to see, display it
|
|
202
|
-
visible.push(_objectSpread(_objectSpread({}, region), {}, {
|
|
203
|
-
widthBp: widthBp
|
|
204
|
-
}));
|
|
205
|
-
}
|
|
206
|
-
}); // remove any single-region elisions
|
|
207
|
-
|
|
208
|
-
for (var i = 0; i < visible.length; i += 1) {
|
|
209
|
-
var v = visible[i];
|
|
210
|
-
|
|
211
|
-
if (v.elided && v.regions.length === 1) {
|
|
212
|
-
delete v.elided;
|
|
213
|
-
visible[i] = _objectSpread(_objectSpread({}, v), v.regions[0]);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return visible;
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
get assemblyNames() {
|
|
221
|
-
var assemblyNames = [];
|
|
222
|
-
self.displayedRegions.forEach(function (displayedRegion) {
|
|
223
|
-
if (!assemblyNames.includes(displayedRegion.assemblyName)) {
|
|
224
|
-
assemblyNames.push(displayedRegion.assemblyName);
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
return assemblyNames;
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
get initialized() {
|
|
231
|
-
var _getSession = (0, _util.getSession)(self),
|
|
232
|
-
assemblyManager = _getSession.assemblyManager;
|
|
233
|
-
|
|
234
|
-
return this.assemblyNames.every(function (a) {
|
|
235
|
-
var _assemblyManager$get;
|
|
236
|
-
|
|
237
|
-
return (_assemblyManager$get = assemblyManager.get(a)) === null || _assemblyManager$get === void 0 ? void 0 : _assemblyManager$get.initialized;
|
|
238
|
-
});
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
};
|
|
242
|
-
}).volatile(function () {
|
|
243
|
-
return {
|
|
244
|
-
error: undefined
|
|
9
|
+
return t;
|
|
245
10
|
};
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
return self.height;
|
|
256
|
-
},
|
|
257
|
-
resizeHeight: function resizeHeight(distance) {
|
|
258
|
-
var oldHeight = self.height;
|
|
259
|
-
var newHeight = this.setHeight(self.height + distance);
|
|
260
|
-
this.setModelViewWhenAdjust(!self.tooSmallToLock);
|
|
261
|
-
return newHeight - oldHeight;
|
|
262
|
-
},
|
|
263
|
-
resizeWidth: function resizeWidth(distance) {
|
|
264
|
-
var oldWidth = self.width;
|
|
265
|
-
var newWidth = this.setWidth(self.width + distance);
|
|
266
|
-
this.setModelViewWhenAdjust(!self.tooSmallToLock);
|
|
267
|
-
return newWidth - oldWidth;
|
|
268
|
-
},
|
|
269
|
-
rotateClockwiseButton: function rotateClockwiseButton() {
|
|
270
|
-
this.rotateClockwise(Math.PI / 6);
|
|
271
|
-
},
|
|
272
|
-
rotateCounterClockwiseButton: function rotateCounterClockwiseButton() {
|
|
273
|
-
this.rotateCounterClockwise(Math.PI / 6);
|
|
274
|
-
},
|
|
275
|
-
rotateClockwise: function rotateClockwise() {
|
|
276
|
-
var distance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.17;
|
|
277
|
-
self.offsetRadians += distance;
|
|
278
|
-
},
|
|
279
|
-
rotateCounterClockwise: function rotateCounterClockwise() {
|
|
280
|
-
var distance = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.17;
|
|
281
|
-
self.offsetRadians -= distance;
|
|
282
|
-
},
|
|
283
|
-
zoomInButton: function zoomInButton() {
|
|
284
|
-
this.setBpPerPx(self.bpPerPx / 1.4);
|
|
285
|
-
},
|
|
286
|
-
zoomOutButton: function zoomOutButton() {
|
|
287
|
-
this.setBpPerPx(self.bpPerPx * 1.4);
|
|
288
|
-
},
|
|
289
|
-
setBpPerPx: function setBpPerPx(newVal) {
|
|
290
|
-
self.bpPerPx = (0, _util.clamp)(newVal, self.minBpPerPx, self.maxBpPerPx);
|
|
291
|
-
},
|
|
292
|
-
setModelViewWhenAdjust: function setModelViewWhenAdjust(secondCondition) {
|
|
293
|
-
if (self.lockedFitToWindow && secondCondition) {
|
|
294
|
-
this.setBpPerPx(self.minBpPerPx);
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __values = (this && this.__values) || function(o) {
|
|
14
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
+
if (m) return m.call(o);
|
|
16
|
+
if (o && typeof o.length === "number") return {
|
|
17
|
+
next: function () {
|
|
18
|
+
if (o && i >= o.length) o = void 0;
|
|
19
|
+
return { value: o && o[i++], done: !o };
|
|
295
20
|
}
|
|
296
|
-
},
|
|
297
|
-
closeView: function closeView() {
|
|
298
|
-
(0, _mobxStateTree.getParent)(self, 2).removeView(self);
|
|
299
|
-
},
|
|
300
|
-
setDisplayedRegions: function setDisplayedRegions(regions) {
|
|
301
|
-
var previouslyEmpty = self.displayedRegions.length === 0;
|
|
302
|
-
self.displayedRegions = (0, _mobxStateTree.cast)(regions);
|
|
303
|
-
|
|
304
|
-
if (previouslyEmpty) {
|
|
305
|
-
this.setBpPerPx(self.minBpPerPx);
|
|
306
|
-
} else {
|
|
307
|
-
this.setBpPerPx(self.bpPerPx);
|
|
308
|
-
}
|
|
309
|
-
},
|
|
310
|
-
activateTrackSelector: function activateTrackSelector() {
|
|
311
|
-
if (self.trackSelectorType === 'hierarchical') {
|
|
312
|
-
var session = (0, _util.getSession)(self);
|
|
313
|
-
|
|
314
|
-
if ((0, _util.isSessionModelWithWidgets)(session)) {
|
|
315
|
-
var selector = session.addWidget('HierarchicalTrackSelectorWidget', 'hierarchicalTrackSelector', {
|
|
316
|
-
view: self
|
|
317
|
-
});
|
|
318
|
-
session.showWidget(selector);
|
|
319
|
-
return selector;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
throw new Error("invalid track selector type ".concat(self.trackSelectorType));
|
|
324
|
-
},
|
|
325
|
-
toggleTrack: function toggleTrack(trackId) {
|
|
326
|
-
// if we have any tracks with that configuration, turn them off
|
|
327
|
-
var hiddenCount = this.hideTrack(trackId); // if none had that configuration, turn one on
|
|
328
|
-
|
|
329
|
-
if (!hiddenCount) {
|
|
330
|
-
this.showTrack(trackId);
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
setError: function setError(error) {
|
|
334
|
-
console.error(error);
|
|
335
|
-
self.error = error;
|
|
336
|
-
},
|
|
337
|
-
showTrack: function showTrack(trackId) {
|
|
338
|
-
var initialSnapshot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
339
|
-
var trackConfigSchema = pluginManager.pluggableConfigSchemaType('track');
|
|
340
|
-
var configuration = (0, _mobxStateTree.resolveIdentifier)(trackConfigSchema, (0, _mobxStateTree.getRoot)(self), trackId);
|
|
341
|
-
var trackType = pluginManager.getTrackType(configuration.type);
|
|
342
|
-
|
|
343
|
-
if (!trackType) {
|
|
344
|
-
throw new Error("unknown track type ".concat(configuration.type));
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
var viewType = pluginManager.getViewType(self.type);
|
|
348
|
-
var supportedDisplays = viewType.displayTypes.map(function (displayType) {
|
|
349
|
-
return displayType.name;
|
|
350
|
-
});
|
|
351
|
-
var displayConf = configuration.displays.find(function (d) {
|
|
352
|
-
return supportedDisplays.includes(d.type);
|
|
353
|
-
});
|
|
354
|
-
var track = trackType.stateModel.create(_objectSpread(_objectSpread({}, initialSnapshot), {}, {
|
|
355
|
-
type: configuration.type,
|
|
356
|
-
configuration: configuration,
|
|
357
|
-
displays: [{
|
|
358
|
-
type: displayConf.type,
|
|
359
|
-
configuration: displayConf
|
|
360
|
-
}]
|
|
361
|
-
}));
|
|
362
|
-
self.tracks.push(track);
|
|
363
|
-
},
|
|
364
|
-
addTrackConf: function addTrackConf(configuration) {
|
|
365
|
-
var initialSnapshot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
366
|
-
var type = configuration.type;
|
|
367
|
-
var name = (0, _configuration.readConfObject)(configuration, 'name');
|
|
368
|
-
var trackType = pluginManager.getTrackType(type);
|
|
369
|
-
|
|
370
|
-
if (!trackType) {
|
|
371
|
-
throw new Error("unknown track type ".concat(configuration.type));
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
var viewType = pluginManager.getViewType(self.type);
|
|
375
|
-
var supportedDisplays = viewType.displayTypes.map(function (displayType) {
|
|
376
|
-
return displayType.name;
|
|
377
|
-
});
|
|
378
|
-
var displayConf = configuration.displays.find(function (d) {
|
|
379
|
-
return supportedDisplays.includes(d.type);
|
|
380
|
-
});
|
|
381
|
-
var track = trackType.stateModel.create(_objectSpread(_objectSpread({}, initialSnapshot), {}, {
|
|
382
|
-
name: name,
|
|
383
|
-
type: type,
|
|
384
|
-
configuration: configuration,
|
|
385
|
-
displays: [{
|
|
386
|
-
type: displayConf.type,
|
|
387
|
-
configuration: displayConf
|
|
388
|
-
}]
|
|
389
|
-
}));
|
|
390
|
-
self.tracks.push(track);
|
|
391
|
-
},
|
|
392
|
-
hideTrack: function hideTrack(trackId) {
|
|
393
|
-
var trackConfigSchema = pluginManager.pluggableConfigSchemaType('track');
|
|
394
|
-
var configuration = (0, _mobxStateTree.resolveIdentifier)(trackConfigSchema, (0, _mobxStateTree.getRoot)(self), trackId); // if we have any tracks with that configuration, turn them off
|
|
395
|
-
|
|
396
|
-
var shownTracks = self.tracks.filter(function (t) {
|
|
397
|
-
return t.configuration === configuration;
|
|
398
|
-
});
|
|
399
|
-
(0, _mobx.transaction)(function () {
|
|
400
|
-
return shownTracks.forEach(function (t) {
|
|
401
|
-
return self.tracks.remove(t);
|
|
402
|
-
});
|
|
403
|
-
});
|
|
404
|
-
return shownTracks.length;
|
|
405
|
-
},
|
|
406
|
-
toggleFitToWindowLock: function toggleFitToWindowLock() {
|
|
407
|
-
self.lockedFitToWindow = !self.lockedFitToWindow; // when going unlocked -> locked and circle is cut off, set to the locked minBpPerPx
|
|
408
|
-
|
|
409
|
-
this.setModelViewWhenAdjust(self.atMinBpPerPx);
|
|
410
|
-
return self.lockedFitToWindow;
|
|
411
|
-
}
|
|
412
21
|
};
|
|
413
|
-
|
|
22
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
var mobx_state_tree_1 = require("mobx-state-tree");
|
|
26
|
+
var mst_1 = require("@jbrowse/core/util/types/mst");
|
|
27
|
+
var mobx_1 = require("mobx");
|
|
28
|
+
var configuration_1 = require("@jbrowse/core/configuration");
|
|
29
|
+
var util_1 = require("@jbrowse/core/util");
|
|
30
|
+
var models_1 = require("@jbrowse/core/pluggableElementTypes/models");
|
|
31
|
+
var slices_1 = require("./slices");
|
|
32
|
+
var viewportVisibleRegion_1 = require("./viewportVisibleRegion");
|
|
33
|
+
function CircularView(pluginManager) {
|
|
34
|
+
var minHeight = 40;
|
|
35
|
+
var minWidth = 100;
|
|
36
|
+
var defaultHeight = 400;
|
|
37
|
+
return mobx_state_tree_1.types.compose(models_1.BaseViewModel, mobx_state_tree_1.types
|
|
38
|
+
.model('CircularView', {
|
|
39
|
+
type: mobx_state_tree_1.types.literal('CircularView'),
|
|
40
|
+
offsetRadians: -Math.PI / 2,
|
|
41
|
+
bpPerPx: 2000000,
|
|
42
|
+
tracks: mobx_state_tree_1.types.array(pluginManager.pluggableMstType('track', 'stateModel')),
|
|
43
|
+
hideVerticalResizeHandle: false,
|
|
44
|
+
hideTrackSelectorButton: false,
|
|
45
|
+
lockedFitToWindow: true,
|
|
46
|
+
disableImportForm: false,
|
|
47
|
+
height: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.refinement('trackHeight', mobx_state_tree_1.types.number, function (n) { return n >= minHeight; }), defaultHeight),
|
|
48
|
+
minimumRadiusPx: 25,
|
|
49
|
+
spacingPx: 10,
|
|
50
|
+
paddingPx: 80,
|
|
51
|
+
lockedPaddingPx: 100,
|
|
52
|
+
minVisibleWidth: 6,
|
|
53
|
+
minimumBlockWidth: 20,
|
|
54
|
+
displayedRegions: mobx_state_tree_1.types.array(mst_1.Region),
|
|
55
|
+
scrollX: 0,
|
|
56
|
+
scrollY: 0,
|
|
57
|
+
trackSelectorType: 'hierarchical',
|
|
58
|
+
})
|
|
59
|
+
.volatile(function () { return ({
|
|
60
|
+
width: 0,
|
|
61
|
+
}); })
|
|
62
|
+
.views(function (self) { return ({
|
|
63
|
+
get staticSlices() {
|
|
64
|
+
return (0, slices_1.calculateStaticSlices)(self);
|
|
65
|
+
},
|
|
66
|
+
get visibleStaticSlices() {
|
|
67
|
+
return this.staticSlices.filter(slices_1.sliceIsVisible.bind(this, self));
|
|
68
|
+
},
|
|
69
|
+
get visibleSection() {
|
|
70
|
+
return (0, viewportVisibleRegion_1.viewportVisibleSection)([
|
|
71
|
+
self.scrollX,
|
|
72
|
+
self.scrollX + self.width,
|
|
73
|
+
self.scrollY,
|
|
74
|
+
self.scrollY + self.height,
|
|
75
|
+
], this.centerXY, this.radiusPx);
|
|
76
|
+
},
|
|
77
|
+
get circumferencePx() {
|
|
78
|
+
var e_1, _a;
|
|
79
|
+
var elidedBp = 0;
|
|
80
|
+
try {
|
|
81
|
+
for (var _b = __values(this.elidedRegions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
82
|
+
var r = _c.value;
|
|
83
|
+
elidedBp += r.widthBp;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
87
|
+
finally {
|
|
88
|
+
try {
|
|
89
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
90
|
+
}
|
|
91
|
+
finally { if (e_1) throw e_1.error; }
|
|
92
|
+
}
|
|
93
|
+
return (elidedBp / self.bpPerPx + self.spacingPx * this.elidedRegions.length);
|
|
94
|
+
},
|
|
95
|
+
get radiusPx() {
|
|
96
|
+
return this.circumferencePx / (2 * Math.PI);
|
|
97
|
+
},
|
|
98
|
+
get bpPerRadian() {
|
|
99
|
+
return self.bpPerPx * this.radiusPx;
|
|
100
|
+
},
|
|
101
|
+
get pxPerRadian() {
|
|
102
|
+
return this.radiusPx;
|
|
103
|
+
},
|
|
104
|
+
get centerXY() {
|
|
105
|
+
return [
|
|
106
|
+
this.radiusPx + self.paddingPx,
|
|
107
|
+
this.radiusPx + self.paddingPx,
|
|
108
|
+
];
|
|
109
|
+
},
|
|
110
|
+
get totalBp() {
|
|
111
|
+
var e_2, _a;
|
|
112
|
+
var total = 0;
|
|
113
|
+
try {
|
|
114
|
+
for (var _b = __values(self.displayedRegions), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
115
|
+
var region = _c.value;
|
|
116
|
+
total += region.end - region.start;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
120
|
+
finally {
|
|
121
|
+
try {
|
|
122
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
123
|
+
}
|
|
124
|
+
finally { if (e_2) throw e_2.error; }
|
|
125
|
+
}
|
|
126
|
+
return total;
|
|
127
|
+
},
|
|
128
|
+
get maximumRadiusPx() {
|
|
129
|
+
return self.lockedFitToWindow
|
|
130
|
+
? Math.min(self.width, self.height) / 2 - self.lockedPaddingPx
|
|
131
|
+
: 1000000;
|
|
132
|
+
},
|
|
133
|
+
get maxBpPerPx() {
|
|
134
|
+
var minCircumferencePx = 2 * Math.PI * self.minimumRadiusPx;
|
|
135
|
+
return this.totalBp / minCircumferencePx;
|
|
136
|
+
},
|
|
137
|
+
get minBpPerPx() {
|
|
138
|
+
// min depends on window dimensions, clamp between old min(0.01) and max
|
|
139
|
+
var maxCircumferencePx = 2 * Math.PI * this.maximumRadiusPx;
|
|
140
|
+
return (0, util_1.clamp)(this.totalBp / maxCircumferencePx, 0.0000000001, this.maxBpPerPx);
|
|
141
|
+
},
|
|
142
|
+
get atMaxBpPerPx() {
|
|
143
|
+
return self.bpPerPx >= this.maxBpPerPx;
|
|
144
|
+
},
|
|
145
|
+
get atMinBpPerPx() {
|
|
146
|
+
return self.bpPerPx <= this.minBpPerPx;
|
|
147
|
+
},
|
|
148
|
+
get tooSmallToLock() {
|
|
149
|
+
return this.minBpPerPx <= 0.0000000001;
|
|
150
|
+
},
|
|
151
|
+
get figureDimensions() {
|
|
152
|
+
return [
|
|
153
|
+
this.radiusPx * 2 + 2 * self.paddingPx,
|
|
154
|
+
this.radiusPx * 2 + 2 * self.paddingPx,
|
|
155
|
+
];
|
|
156
|
+
},
|
|
157
|
+
get figureWidth() {
|
|
158
|
+
return this.figureDimensions[0];
|
|
159
|
+
},
|
|
160
|
+
get figureHeight() {
|
|
161
|
+
return this.figureDimensions[1];
|
|
162
|
+
},
|
|
163
|
+
// this is displayedRegions, post-processed to
|
|
164
|
+
// elide regions that are too small to see reasonably
|
|
165
|
+
get elidedRegions() {
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
167
|
+
var visible = [];
|
|
168
|
+
self.displayedRegions.forEach(function (region) {
|
|
169
|
+
var widthBp = region.end - region.start;
|
|
170
|
+
var widthPx = widthBp / self.bpPerPx;
|
|
171
|
+
if (widthPx < self.minVisibleWidth) {
|
|
172
|
+
// too small to see, collapse into a single elision region
|
|
173
|
+
var lastVisible = visible[visible.length - 1];
|
|
174
|
+
if (lastVisible && lastVisible.elided) {
|
|
175
|
+
lastVisible.regions.push(__assign({}, region));
|
|
176
|
+
lastVisible.widthBp += widthBp;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
visible.push({
|
|
180
|
+
elided: true,
|
|
181
|
+
widthBp: widthBp,
|
|
182
|
+
regions: [__assign({}, region)],
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
// big enough to see, display it
|
|
188
|
+
visible.push(__assign(__assign({}, region), { widthBp: widthBp }));
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
// remove any single-region elisions
|
|
192
|
+
for (var i = 0; i < visible.length; i += 1) {
|
|
193
|
+
var v = visible[i];
|
|
194
|
+
if (v.elided && v.regions.length === 1) {
|
|
195
|
+
delete v.elided;
|
|
196
|
+
visible[i] = __assign(__assign({}, v), v.regions[0]);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return visible;
|
|
200
|
+
},
|
|
201
|
+
get assemblyNames() {
|
|
202
|
+
var assemblyNames = [];
|
|
203
|
+
self.displayedRegions.forEach(function (displayedRegion) {
|
|
204
|
+
if (!assemblyNames.includes(displayedRegion.assemblyName)) {
|
|
205
|
+
assemblyNames.push(displayedRegion.assemblyName);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
return assemblyNames;
|
|
209
|
+
},
|
|
210
|
+
get initialized() {
|
|
211
|
+
var assemblyManager = (0, util_1.getSession)(self).assemblyManager;
|
|
212
|
+
return this.assemblyNames.every(function (a) { var _a; return (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.initialized; });
|
|
213
|
+
},
|
|
214
|
+
}); })
|
|
215
|
+
.volatile(function () { return ({
|
|
216
|
+
error: undefined,
|
|
217
|
+
}); })
|
|
218
|
+
.actions(function (self) { return ({
|
|
219
|
+
// toggle action with a flag stating which mode it's in
|
|
220
|
+
setWidth: function (newWidth) {
|
|
221
|
+
self.width = Math.max(newWidth, minWidth);
|
|
222
|
+
return self.width;
|
|
223
|
+
},
|
|
224
|
+
setHeight: function (newHeight) {
|
|
225
|
+
self.height = Math.max(newHeight, minHeight);
|
|
226
|
+
return self.height;
|
|
227
|
+
},
|
|
228
|
+
resizeHeight: function (distance) {
|
|
229
|
+
var oldHeight = self.height;
|
|
230
|
+
var newHeight = this.setHeight(self.height + distance);
|
|
231
|
+
this.setModelViewWhenAdjust(!self.tooSmallToLock);
|
|
232
|
+
return newHeight - oldHeight;
|
|
233
|
+
},
|
|
234
|
+
resizeWidth: function (distance) {
|
|
235
|
+
var oldWidth = self.width;
|
|
236
|
+
var newWidth = this.setWidth(self.width + distance);
|
|
237
|
+
this.setModelViewWhenAdjust(!self.tooSmallToLock);
|
|
238
|
+
return newWidth - oldWidth;
|
|
239
|
+
},
|
|
240
|
+
rotateClockwiseButton: function () {
|
|
241
|
+
this.rotateClockwise(Math.PI / 6);
|
|
242
|
+
},
|
|
243
|
+
rotateCounterClockwiseButton: function () {
|
|
244
|
+
this.rotateCounterClockwise(Math.PI / 6);
|
|
245
|
+
},
|
|
246
|
+
rotateClockwise: function (distance) {
|
|
247
|
+
if (distance === void 0) { distance = 0.17; }
|
|
248
|
+
self.offsetRadians += distance;
|
|
249
|
+
},
|
|
250
|
+
rotateCounterClockwise: function (distance) {
|
|
251
|
+
if (distance === void 0) { distance = 0.17; }
|
|
252
|
+
self.offsetRadians -= distance;
|
|
253
|
+
},
|
|
254
|
+
zoomInButton: function () {
|
|
255
|
+
this.setBpPerPx(self.bpPerPx / 1.4);
|
|
256
|
+
},
|
|
257
|
+
zoomOutButton: function () {
|
|
258
|
+
this.setBpPerPx(self.bpPerPx * 1.4);
|
|
259
|
+
},
|
|
260
|
+
setBpPerPx: function (newVal) {
|
|
261
|
+
self.bpPerPx = (0, util_1.clamp)(newVal, self.minBpPerPx, self.maxBpPerPx);
|
|
262
|
+
},
|
|
263
|
+
setModelViewWhenAdjust: function (secondCondition) {
|
|
264
|
+
if (self.lockedFitToWindow && secondCondition) {
|
|
265
|
+
this.setBpPerPx(self.minBpPerPx);
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
closeView: function () {
|
|
269
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
270
|
+
(0, mobx_state_tree_1.getParent)(self, 2).removeView(self);
|
|
271
|
+
},
|
|
272
|
+
setDisplayedRegions: function (regions) {
|
|
273
|
+
var previouslyEmpty = self.displayedRegions.length === 0;
|
|
274
|
+
self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
|
|
275
|
+
if (previouslyEmpty) {
|
|
276
|
+
this.setBpPerPx(self.minBpPerPx);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
this.setBpPerPx(self.bpPerPx);
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
activateTrackSelector: function () {
|
|
283
|
+
if (self.trackSelectorType === 'hierarchical') {
|
|
284
|
+
var session = (0, util_1.getSession)(self);
|
|
285
|
+
if ((0, util_1.isSessionModelWithWidgets)(session)) {
|
|
286
|
+
var selector = session.addWidget('HierarchicalTrackSelectorWidget', 'hierarchicalTrackSelector', { view: self });
|
|
287
|
+
session.showWidget(selector);
|
|
288
|
+
return selector;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
throw new Error("invalid track selector type ".concat(self.trackSelectorType));
|
|
292
|
+
},
|
|
293
|
+
toggleTrack: function (trackId) {
|
|
294
|
+
// if we have any tracks with that configuration, turn them off
|
|
295
|
+
var hiddenCount = this.hideTrack(trackId);
|
|
296
|
+
// if none had that configuration, turn one on
|
|
297
|
+
if (!hiddenCount) {
|
|
298
|
+
this.showTrack(trackId);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
setError: function (error) {
|
|
302
|
+
console.error(error);
|
|
303
|
+
self.error = error;
|
|
304
|
+
},
|
|
305
|
+
showTrack: function (trackId, initialSnapshot) {
|
|
306
|
+
if (initialSnapshot === void 0) { initialSnapshot = {}; }
|
|
307
|
+
var schema = pluginManager.pluggableConfigSchemaType('track');
|
|
308
|
+
var conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
309
|
+
var trackType = pluginManager.getTrackType(conf.type);
|
|
310
|
+
if (!trackType) {
|
|
311
|
+
throw new Error("unknown track type ".concat(conf.type));
|
|
312
|
+
}
|
|
313
|
+
var viewType = pluginManager.getViewType(self.type);
|
|
314
|
+
var supportedDisplays = viewType.displayTypes.map(function (d) { return d.name; });
|
|
315
|
+
var displayConf = conf.displays.find(function (d) {
|
|
316
|
+
return supportedDisplays.includes(d.type);
|
|
317
|
+
});
|
|
318
|
+
var track = trackType.stateModel.create(__assign(__assign({}, initialSnapshot), { type: conf.type, configuration: conf, displays: [{ type: displayConf.type, configuration: displayConf }] }));
|
|
319
|
+
self.tracks.push(track);
|
|
320
|
+
},
|
|
321
|
+
addTrackConf: function (configuration, initialSnapshot) {
|
|
322
|
+
if (initialSnapshot === void 0) { initialSnapshot = {}; }
|
|
323
|
+
var type = configuration.type;
|
|
324
|
+
var name = (0, configuration_1.readConfObject)(configuration, 'name');
|
|
325
|
+
var trackType = pluginManager.getTrackType(type);
|
|
326
|
+
if (!trackType) {
|
|
327
|
+
throw new Error("unknown track type ".concat(configuration.type));
|
|
328
|
+
}
|
|
329
|
+
var viewType = pluginManager.getViewType(self.type);
|
|
330
|
+
var supportedDisplays = viewType.displayTypes.map(function (d) { return d.name; });
|
|
331
|
+
var displayConf = configuration.displays.find(function (d) { return supportedDisplays.includes(d.type); });
|
|
332
|
+
var track = trackType.stateModel.create(__assign(__assign({}, initialSnapshot), { name: name, type: type, configuration: configuration, displays: [{ type: displayConf.type, configuration: displayConf }] }));
|
|
333
|
+
self.tracks.push(track);
|
|
334
|
+
},
|
|
335
|
+
hideTrack: function (trackId) {
|
|
336
|
+
var schema = pluginManager.pluggableConfigSchemaType('track');
|
|
337
|
+
var conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
338
|
+
var t = self.tracks.filter(function (t) { return t.configuration === conf; });
|
|
339
|
+
(0, mobx_1.transaction)(function () { return t.forEach(function (t) { return self.tracks.remove(t); }); });
|
|
340
|
+
return t.length;
|
|
341
|
+
},
|
|
342
|
+
toggleFitToWindowLock: function () {
|
|
343
|
+
self.lockedFitToWindow = !self.lockedFitToWindow;
|
|
344
|
+
// when going unlocked -> locked and circle is cut off, set to the locked minBpPerPx
|
|
345
|
+
this.setModelViewWhenAdjust(self.atMinBpPerPx);
|
|
346
|
+
return self.lockedFitToWindow;
|
|
347
|
+
},
|
|
348
|
+
}); }));
|
|
414
349
|
}
|
|
350
|
+
exports.default = CircularView;
|
|
415
351
|
/*
|
|
416
352
|
PLANS
|
|
417
353
|
|
|
@@ -419,4 +355,5 @@ PLANS
|
|
|
419
355
|
- ruler tick marks
|
|
420
356
|
- set viewport scroll from state snapshot
|
|
421
357
|
|
|
422
|
-
*/
|
|
358
|
+
*/
|
|
359
|
+
//# sourceMappingURL=CircularView.js.map
|