@jbrowse/plugin-circular-view 2.17.0 → 3.0.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 +1 -2
- package/dist/BaseChordDisplay/components/BaseChordDisplay.js +8 -7
- package/dist/BaseChordDisplay/components/DisplayError.d.ts +1 -2
- package/dist/BaseChordDisplay/components/DisplayError.js +2 -11
- package/dist/BaseChordDisplay/components/Loading.d.ts +1 -2
- package/dist/BaseChordDisplay/components/Loading.js +4 -34
- package/dist/BaseChordDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -3
- package/dist/BaseChordDisplay/{models/configSchema.js → configSchema.js} +1 -10
- package/dist/BaseChordDisplay/index.d.ts +2 -2
- package/dist/BaseChordDisplay/index.js +2 -2
- package/{esm/BaseChordDisplay/models → dist/BaseChordDisplay}/model.d.ts +12 -54
- package/dist/BaseChordDisplay/{models/model.js → model.js} +31 -94
- package/dist/BaseChordDisplay/renderReaction.d.ts +27 -0
- package/dist/BaseChordDisplay/{models/renderReaction.js → renderReaction.js} +5 -13
- package/dist/CircularView/components/CircularView.d.ts +2 -3
- package/dist/CircularView/components/CircularView.js +22 -31
- package/dist/CircularView/components/Controls.d.ts +2 -3
- package/dist/CircularView/components/Controls.js +33 -70
- package/dist/CircularView/components/ExportSvgDialog.d.ts +2 -3
- package/dist/CircularView/components/ExportSvgDialog.js +32 -67
- package/dist/CircularView/components/ImportForm.d.ts +2 -3
- package/dist/CircularView/components/ImportForm.js +12 -42
- package/dist/CircularView/components/Ruler.d.ts +3 -4
- package/dist/CircularView/components/Ruler.js +18 -37
- package/dist/CircularView/index.d.ts +1 -1
- package/dist/CircularView/index.js +18 -8
- package/dist/CircularView/{models/model.d.ts → model.d.ts} +9 -158
- package/dist/CircularView/{models/model.js → model.js} +25 -224
- package/dist/CircularView/{models/slices.d.ts → slices.d.ts} +1 -1
- package/dist/CircularView/svgcomponents/SVGBackground.d.ts +1 -2
- package/dist/CircularView/svgcomponents/SVGBackground.js +3 -6
- package/dist/CircularView/svgcomponents/SVGCircularView.d.ts +1 -1
- package/dist/CircularView/svgcomponents/SVGCircularView.js +5 -17
- package/dist/CircularView/{models/viewportVisibleRegion.js → viewportVisibleRegion.js} +0 -70
- package/dist/LaunchCircularView/index.d.ts +1 -1
- package/dist/LaunchCircularView/index.js +1 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -7
- package/esm/BaseChordDisplay/components/BaseChordDisplay.d.ts +1 -2
- package/esm/BaseChordDisplay/components/BaseChordDisplay.js +8 -7
- package/esm/BaseChordDisplay/components/DisplayError.d.ts +1 -2
- package/esm/BaseChordDisplay/components/DisplayError.js +2 -8
- package/esm/BaseChordDisplay/components/Loading.d.ts +1 -2
- package/esm/BaseChordDisplay/components/Loading.js +4 -11
- package/esm/BaseChordDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -3
- package/esm/BaseChordDisplay/{models/configSchema.js → configSchema.js} +1 -10
- package/esm/BaseChordDisplay/index.d.ts +2 -2
- package/esm/BaseChordDisplay/index.js +2 -2
- package/{dist/BaseChordDisplay/models → esm/BaseChordDisplay}/model.d.ts +12 -54
- package/esm/BaseChordDisplay/{models/model.js → model.js} +32 -92
- package/esm/BaseChordDisplay/renderReaction.d.ts +27 -0
- package/esm/BaseChordDisplay/{models/renderReaction.js → renderReaction.js} +5 -10
- package/esm/CircularView/components/CircularView.d.ts +2 -3
- package/esm/CircularView/components/CircularView.js +22 -31
- package/esm/CircularView/components/Controls.d.ts +2 -3
- package/esm/CircularView/components/Controls.js +33 -47
- package/esm/CircularView/components/ExportSvgDialog.d.ts +2 -3
- package/esm/CircularView/components/ExportSvgDialog.js +32 -44
- package/esm/CircularView/components/ImportForm.d.ts +2 -3
- package/esm/CircularView/components/ImportForm.js +12 -19
- package/esm/CircularView/components/Ruler.d.ts +3 -4
- package/esm/CircularView/components/Ruler.js +19 -35
- package/esm/CircularView/index.d.ts +1 -1
- package/esm/CircularView/index.js +1 -1
- package/esm/CircularView/{models/model.d.ts → model.d.ts} +9 -158
- package/esm/CircularView/{models/model.js → model.js} +9 -218
- package/esm/CircularView/{models/slices.d.ts → slices.d.ts} +1 -1
- package/esm/CircularView/{models/slices.js → slices.js} +1 -1
- package/esm/CircularView/svgcomponents/SVGBackground.d.ts +1 -2
- package/esm/CircularView/svgcomponents/SVGBackground.js +3 -3
- package/esm/CircularView/svgcomponents/SVGCircularView.d.ts +1 -1
- package/esm/CircularView/svgcomponents/SVGCircularView.js +5 -17
- package/esm/CircularView/{models/viewportVisibleRegion.js → viewportVisibleRegion.js} +0 -70
- package/esm/LaunchCircularView/index.d.ts +1 -1
- package/esm/LaunchCircularView/index.js +1 -3
- package/esm/index.d.ts +3 -3
- package/esm/index.js +3 -5
- package/package.json +2 -3
- package/dist/BaseChordDisplay/models/renderReaction.d.ts +0 -45
- package/esm/BaseChordDisplay/models/renderReaction.d.ts +0 -45
- /package/dist/CircularView/{models/slices.js → slices.js} +0 -0
- /package/dist/CircularView/{models/viewportVisibleRegion.d.ts → viewportVisibleRegion.d.ts} +0 -0
- /package/esm/CircularView/{models/viewportVisibleRegion.d.ts → viewportVisibleRegion.d.ts} +0 -0
|
@@ -15,121 +15,64 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
const react_1 = require("react");
|
|
30
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
31
|
-
const mst_1 = require("@jbrowse/core/util/types/mst");
|
|
32
|
-
const mobx_1 = require("mobx");
|
|
33
|
-
const file_saver_1 = require("file-saver");
|
|
34
40
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
35
|
-
const util_1 = require("@jbrowse/core/util");
|
|
36
41
|
const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
|
|
37
|
-
// icons
|
|
38
42
|
const Icons_1 = require("@jbrowse/core/ui/Icons");
|
|
43
|
+
const util_1 = require("@jbrowse/core/util");
|
|
39
44
|
const FolderOpen_1 = __importDefault(require("@mui/icons-material/FolderOpen"));
|
|
40
45
|
const PhotoCamera_1 = __importDefault(require("@mui/icons-material/PhotoCamera"));
|
|
41
|
-
|
|
46
|
+
const file_saver_1 = require("file-saver");
|
|
47
|
+
const mobx_1 = require("mobx");
|
|
48
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
42
49
|
const slices_1 = require("./slices");
|
|
43
50
|
const viewportVisibleRegion_1 = require("./viewportVisibleRegion");
|
|
44
|
-
|
|
45
|
-
const ExportSvgDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('../components/ExportSvgDialog'))));
|
|
46
|
-
/**
|
|
47
|
-
* #stateModel CircularView
|
|
48
|
-
* extends
|
|
49
|
-
* - [BaseViewModel](../baseviewmodel)
|
|
50
|
-
*/
|
|
51
|
+
const ExportSvgDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ExportSvgDialog'))));
|
|
51
52
|
function stateModelFactory(pluginManager) {
|
|
52
53
|
const minHeight = 40;
|
|
53
54
|
const minWidth = 100;
|
|
54
55
|
const defaultHeight = 400;
|
|
55
56
|
return mobx_state_tree_1.types
|
|
56
57
|
.compose('CircularView', models_1.BaseViewModel, mobx_state_tree_1.types.model({
|
|
57
|
-
/**
|
|
58
|
-
* #property
|
|
59
|
-
*/
|
|
60
58
|
type: mobx_state_tree_1.types.literal('CircularView'),
|
|
61
|
-
/**
|
|
62
|
-
* #property
|
|
63
|
-
* similar to offsetPx in linear genome view
|
|
64
|
-
*/
|
|
65
59
|
offsetRadians: -Math.PI / 2,
|
|
66
|
-
/**
|
|
67
|
-
* #property
|
|
68
|
-
*/
|
|
69
60
|
bpPerPx: 200,
|
|
70
|
-
/**
|
|
71
|
-
* #property
|
|
72
|
-
*/
|
|
73
61
|
tracks: mobx_state_tree_1.types.array(pluginManager.pluggableMstType('track', 'stateModel')),
|
|
74
|
-
/**
|
|
75
|
-
* #property
|
|
76
|
-
*/
|
|
77
62
|
hideVerticalResizeHandle: false,
|
|
78
|
-
/**
|
|
79
|
-
* #property
|
|
80
|
-
*/
|
|
81
63
|
hideTrackSelectorButton: false,
|
|
82
|
-
/**
|
|
83
|
-
* #property
|
|
84
|
-
*/
|
|
85
64
|
lockedFitToWindow: true,
|
|
86
|
-
/**
|
|
87
|
-
* #property
|
|
88
|
-
*/
|
|
89
65
|
disableImportForm: false,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
height: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.refinement('trackHeight', mobx_state_tree_1.types.number, n => n >= minHeight), defaultHeight),
|
|
94
|
-
/**
|
|
95
|
-
* #property
|
|
96
|
-
*/
|
|
97
|
-
displayedRegions: mobx_state_tree_1.types.array(mst_1.Region),
|
|
98
|
-
/**
|
|
99
|
-
* #property
|
|
100
|
-
*/
|
|
66
|
+
height: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, defaultHeight),
|
|
67
|
+
displayedRegions: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.frozen(), []),
|
|
101
68
|
scrollX: 0,
|
|
102
|
-
/**
|
|
103
|
-
* #property
|
|
104
|
-
*/
|
|
105
69
|
scrollY: 0,
|
|
106
|
-
/**
|
|
107
|
-
* #property
|
|
108
|
-
*/
|
|
109
70
|
minimumRadiusPx: 25,
|
|
110
|
-
/**
|
|
111
|
-
* #property
|
|
112
|
-
*/
|
|
113
71
|
spacingPx: 10,
|
|
114
|
-
/**
|
|
115
|
-
* #property
|
|
116
|
-
*/
|
|
117
72
|
paddingPx: 80,
|
|
118
|
-
/**
|
|
119
|
-
* #property
|
|
120
|
-
*/
|
|
121
73
|
lockedPaddingPx: 100,
|
|
122
|
-
/**
|
|
123
|
-
* #property
|
|
124
|
-
*/
|
|
125
74
|
minVisibleWidth: 6,
|
|
126
|
-
/**
|
|
127
|
-
* #property
|
|
128
|
-
*/
|
|
129
75
|
minimumBlockWidth: 20,
|
|
130
|
-
/**
|
|
131
|
-
* #property
|
|
132
|
-
*/
|
|
133
76
|
trackSelectorType: 'hierarchical',
|
|
134
77
|
}))
|
|
135
78
|
.volatile(() => ({
|
|
@@ -137,25 +80,16 @@ function stateModelFactory(pluginManager) {
|
|
|
137
80
|
error: undefined,
|
|
138
81
|
}))
|
|
139
82
|
.views(self => ({
|
|
140
|
-
/**
|
|
141
|
-
* #getter
|
|
142
|
-
*/
|
|
143
83
|
get width() {
|
|
144
84
|
if (self.volatileWidth === undefined) {
|
|
145
85
|
throw new Error('wait for view to be initialized first before accessing width');
|
|
146
86
|
}
|
|
147
87
|
return self.volatileWidth;
|
|
148
88
|
},
|
|
149
|
-
/**
|
|
150
|
-
* #getter
|
|
151
|
-
*/
|
|
152
89
|
get visibleSection() {
|
|
153
90
|
const { scrollX, scrollY, width, height } = self;
|
|
154
91
|
return (0, viewportVisibleRegion_1.viewportVisibleSection)([scrollX, scrollX + width, scrollY, scrollY + height], this.centerXY, this.radiusPx);
|
|
155
92
|
},
|
|
156
|
-
/**
|
|
157
|
-
* #getter
|
|
158
|
-
*/
|
|
159
93
|
get circumferencePx() {
|
|
160
94
|
let elidedBp = 0;
|
|
161
95
|
for (const r of this.elidedRegions) {
|
|
@@ -163,33 +97,18 @@ function stateModelFactory(pluginManager) {
|
|
|
163
97
|
}
|
|
164
98
|
return (elidedBp / self.bpPerPx + self.spacingPx * this.elidedRegions.length);
|
|
165
99
|
},
|
|
166
|
-
/**
|
|
167
|
-
* #getter
|
|
168
|
-
*/
|
|
169
100
|
get radiusPx() {
|
|
170
101
|
return this.circumferencePx / (2 * Math.PI);
|
|
171
102
|
},
|
|
172
|
-
/**
|
|
173
|
-
* #getter
|
|
174
|
-
*/
|
|
175
103
|
get bpPerRadian() {
|
|
176
104
|
return self.bpPerPx * this.radiusPx;
|
|
177
105
|
},
|
|
178
|
-
/**
|
|
179
|
-
* #getter
|
|
180
|
-
*/
|
|
181
106
|
get pxPerRadian() {
|
|
182
107
|
return this.radiusPx;
|
|
183
108
|
},
|
|
184
|
-
/**
|
|
185
|
-
* #getter
|
|
186
|
-
*/
|
|
187
109
|
get centerXY() {
|
|
188
110
|
return [this.radiusPx + self.paddingPx, this.radiusPx + self.paddingPx];
|
|
189
111
|
},
|
|
190
|
-
/**
|
|
191
|
-
* #getter
|
|
192
|
-
*/
|
|
193
112
|
get totalBp() {
|
|
194
113
|
let total = 0;
|
|
195
114
|
for (const region of self.displayedRegions) {
|
|
@@ -197,80 +116,46 @@ function stateModelFactory(pluginManager) {
|
|
|
197
116
|
}
|
|
198
117
|
return total;
|
|
199
118
|
},
|
|
200
|
-
/**
|
|
201
|
-
* #getter
|
|
202
|
-
*/
|
|
203
119
|
get maximumRadiusPx() {
|
|
204
120
|
return self.lockedFitToWindow
|
|
205
121
|
? Math.min(self.width, self.height) / 2 - self.lockedPaddingPx
|
|
206
122
|
: 1000000;
|
|
207
123
|
},
|
|
208
|
-
/**
|
|
209
|
-
* #getter
|
|
210
|
-
*/
|
|
211
124
|
get maxBpPerPx() {
|
|
212
125
|
const minCircumferencePx = 2 * Math.PI * self.minimumRadiusPx;
|
|
213
126
|
return this.totalBp / minCircumferencePx;
|
|
214
127
|
},
|
|
215
|
-
/**
|
|
216
|
-
* #getter
|
|
217
|
-
*/
|
|
218
128
|
get minBpPerPx() {
|
|
219
|
-
// min depends on window dimensions, clamp between old min(0.01) and max
|
|
220
129
|
const maxCircumferencePx = 2 * Math.PI * this.maximumRadiusPx;
|
|
221
130
|
return (0, util_1.clamp)(this.totalBp / maxCircumferencePx, 0.0000000001, this.maxBpPerPx);
|
|
222
131
|
},
|
|
223
|
-
/**
|
|
224
|
-
* #getter
|
|
225
|
-
*/
|
|
226
132
|
get atMaxBpPerPx() {
|
|
227
133
|
return self.bpPerPx >= this.maxBpPerPx;
|
|
228
134
|
},
|
|
229
|
-
/**
|
|
230
|
-
* #getter
|
|
231
|
-
*/
|
|
232
135
|
get atMinBpPerPx() {
|
|
233
136
|
return self.bpPerPx <= this.minBpPerPx;
|
|
234
137
|
},
|
|
235
|
-
/**
|
|
236
|
-
* #getter
|
|
237
|
-
*/
|
|
238
138
|
get tooSmallToLock() {
|
|
239
139
|
return this.minBpPerPx <= 0.0000000001;
|
|
240
140
|
},
|
|
241
|
-
/**
|
|
242
|
-
* #getter
|
|
243
|
-
*/
|
|
244
141
|
get figureDimensions() {
|
|
245
142
|
return [
|
|
246
143
|
this.radiusPx * 2 + 2 * self.paddingPx,
|
|
247
144
|
this.radiusPx * 2 + 2 * self.paddingPx,
|
|
248
145
|
];
|
|
249
146
|
},
|
|
250
|
-
/**
|
|
251
|
-
* #getter
|
|
252
|
-
*/
|
|
253
147
|
get figureWidth() {
|
|
254
148
|
return this.figureDimensions[0];
|
|
255
149
|
},
|
|
256
|
-
/**
|
|
257
|
-
* #getter
|
|
258
|
-
*/
|
|
259
150
|
get figureHeight() {
|
|
260
151
|
return this.figureDimensions[1];
|
|
261
152
|
},
|
|
262
|
-
/**
|
|
263
|
-
* #getter
|
|
264
|
-
* this is displayedRegions, post-processed to elide regions that are too
|
|
265
|
-
* small to see reasonably
|
|
266
|
-
*/
|
|
267
153
|
get elidedRegions() {
|
|
268
154
|
const visible = [];
|
|
269
155
|
self.displayedRegions.forEach(region => {
|
|
270
156
|
const widthBp = region.end - region.start;
|
|
271
157
|
const widthPx = widthBp / self.bpPerPx;
|
|
272
158
|
if (widthPx < self.minVisibleWidth) {
|
|
273
|
-
// too small to see, collapse into a single elision region
|
|
274
159
|
const lastVisible = visible.at(-1);
|
|
275
160
|
if (lastVisible === null || lastVisible === void 0 ? void 0 : lastVisible.elided) {
|
|
276
161
|
lastVisible.regions.push({ ...region });
|
|
@@ -285,11 +170,9 @@ function stateModelFactory(pluginManager) {
|
|
|
285
170
|
}
|
|
286
171
|
}
|
|
287
172
|
else {
|
|
288
|
-
// big enough to see, display it
|
|
289
173
|
visible.push({ ...region, widthBp, elided: false });
|
|
290
174
|
}
|
|
291
175
|
});
|
|
292
|
-
// remove any single-region elisions
|
|
293
176
|
for (let i = 0; i < visible.length; i += 1) {
|
|
294
177
|
const v = visible[i];
|
|
295
178
|
if (v.elided && v.regions.length === 1) {
|
|
@@ -298,9 +181,6 @@ function stateModelFactory(pluginManager) {
|
|
|
298
181
|
}
|
|
299
182
|
return visible;
|
|
300
183
|
},
|
|
301
|
-
/**
|
|
302
|
-
* #getter
|
|
303
|
-
*/
|
|
304
184
|
get assemblyNames() {
|
|
305
185
|
const assemblyNames = [];
|
|
306
186
|
self.displayedRegions.forEach(displayedRegion => {
|
|
@@ -310,9 +190,6 @@ function stateModelFactory(pluginManager) {
|
|
|
310
190
|
});
|
|
311
191
|
return assemblyNames;
|
|
312
192
|
},
|
|
313
|
-
/**
|
|
314
|
-
* #getter
|
|
315
|
-
*/
|
|
316
193
|
get initialized() {
|
|
317
194
|
const { assemblyManager } = (0, util_1.getSession)(self);
|
|
318
195
|
return (self.volatileWidth !== undefined &&
|
|
@@ -320,107 +197,62 @@ function stateModelFactory(pluginManager) {
|
|
|
320
197
|
},
|
|
321
198
|
}))
|
|
322
199
|
.views(self => ({
|
|
323
|
-
/**
|
|
324
|
-
* #getter
|
|
325
|
-
*/
|
|
326
200
|
get staticSlices() {
|
|
327
201
|
return (0, slices_1.calculateStaticSlices)(self);
|
|
328
202
|
},
|
|
329
203
|
}))
|
|
330
204
|
.views(self => ({
|
|
331
|
-
/**
|
|
332
|
-
* #getter
|
|
333
|
-
*/
|
|
334
205
|
get visibleStaticSlices() {
|
|
335
206
|
return self.staticSlices.filter(s => (0, slices_1.sliceIsVisible)(self, s));
|
|
336
207
|
},
|
|
337
208
|
}))
|
|
338
209
|
.actions(self => ({
|
|
339
|
-
/**
|
|
340
|
-
* #action
|
|
341
|
-
*/
|
|
342
210
|
setWidth(newWidth) {
|
|
343
211
|
self.volatileWidth = Math.max(newWidth, minWidth);
|
|
344
212
|
return self.volatileWidth;
|
|
345
213
|
},
|
|
346
|
-
/**
|
|
347
|
-
* #action
|
|
348
|
-
*/
|
|
349
214
|
setHeight(newHeight) {
|
|
350
215
|
self.height = Math.max(newHeight, minHeight);
|
|
351
216
|
return self.height;
|
|
352
217
|
},
|
|
353
|
-
/**
|
|
354
|
-
* #action
|
|
355
|
-
*/
|
|
356
218
|
resizeHeight(distance) {
|
|
357
219
|
const oldHeight = self.height;
|
|
358
220
|
const newHeight = this.setHeight(self.height + distance);
|
|
359
221
|
this.setModelViewWhenAdjust(!self.tooSmallToLock);
|
|
360
222
|
return newHeight - oldHeight;
|
|
361
223
|
},
|
|
362
|
-
/**
|
|
363
|
-
* #action
|
|
364
|
-
*/
|
|
365
224
|
resizeWidth(distance) {
|
|
366
225
|
const oldWidth = self.width;
|
|
367
226
|
const newWidth = this.setWidth(self.width + distance);
|
|
368
227
|
this.setModelViewWhenAdjust(!self.tooSmallToLock);
|
|
369
228
|
return newWidth - oldWidth;
|
|
370
229
|
},
|
|
371
|
-
/**
|
|
372
|
-
* #action
|
|
373
|
-
*/
|
|
374
230
|
rotateClockwiseButton() {
|
|
375
231
|
this.rotateClockwise(Math.PI / 6);
|
|
376
232
|
},
|
|
377
|
-
/**
|
|
378
|
-
* #action
|
|
379
|
-
*/
|
|
380
233
|
rotateCounterClockwiseButton() {
|
|
381
234
|
this.rotateCounterClockwise(Math.PI / 6);
|
|
382
235
|
},
|
|
383
|
-
/**
|
|
384
|
-
* #action
|
|
385
|
-
*/
|
|
386
236
|
rotateClockwise(distance = 0.17) {
|
|
387
237
|
self.offsetRadians += distance;
|
|
388
238
|
},
|
|
389
|
-
/**
|
|
390
|
-
* #action
|
|
391
|
-
*/
|
|
392
239
|
rotateCounterClockwise(distance = 0.17) {
|
|
393
240
|
self.offsetRadians -= distance;
|
|
394
241
|
},
|
|
395
|
-
/**
|
|
396
|
-
* #action
|
|
397
|
-
*/
|
|
398
242
|
zoomInButton() {
|
|
399
243
|
this.setBpPerPx(self.bpPerPx / 1.4);
|
|
400
244
|
},
|
|
401
|
-
/**
|
|
402
|
-
* #action
|
|
403
|
-
*/
|
|
404
245
|
zoomOutButton() {
|
|
405
246
|
this.setBpPerPx(self.bpPerPx * 1.4);
|
|
406
247
|
},
|
|
407
|
-
/**
|
|
408
|
-
* #action
|
|
409
|
-
*/
|
|
410
248
|
setBpPerPx(newVal) {
|
|
411
249
|
self.bpPerPx = (0, util_1.clamp)(newVal, self.minBpPerPx, self.maxBpPerPx);
|
|
412
250
|
},
|
|
413
|
-
/**
|
|
414
|
-
* #action
|
|
415
|
-
*/
|
|
416
251
|
setModelViewWhenAdjust(secondCondition) {
|
|
417
252
|
if (self.lockedFitToWindow && secondCondition) {
|
|
418
253
|
this.setBpPerPx(self.minBpPerPx);
|
|
419
254
|
}
|
|
420
255
|
},
|
|
421
|
-
/**
|
|
422
|
-
* #action
|
|
423
|
-
*/
|
|
424
256
|
setDisplayedRegions(regions) {
|
|
425
257
|
const previouslyEmpty = self.displayedRegions.length === 0;
|
|
426
258
|
self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
|
|
@@ -431,9 +263,6 @@ function stateModelFactory(pluginManager) {
|
|
|
431
263
|
this.setBpPerPx(self.bpPerPx);
|
|
432
264
|
}
|
|
433
265
|
},
|
|
434
|
-
/**
|
|
435
|
-
* #action
|
|
436
|
-
*/
|
|
437
266
|
activateTrackSelector() {
|
|
438
267
|
if (self.trackSelectorType === 'hierarchical') {
|
|
439
268
|
const session = (0, util_1.getSession)(self);
|
|
@@ -445,9 +274,6 @@ function stateModelFactory(pluginManager) {
|
|
|
445
274
|
}
|
|
446
275
|
throw new Error(`invalid track selector type ${self.trackSelectorType}`);
|
|
447
276
|
},
|
|
448
|
-
/**
|
|
449
|
-
* #action
|
|
450
|
-
*/
|
|
451
277
|
toggleTrack(trackId) {
|
|
452
278
|
const hiddenCount = this.hideTrack(trackId);
|
|
453
279
|
if (!hiddenCount) {
|
|
@@ -456,15 +282,9 @@ function stateModelFactory(pluginManager) {
|
|
|
456
282
|
}
|
|
457
283
|
return false;
|
|
458
284
|
},
|
|
459
|
-
/**
|
|
460
|
-
* #action
|
|
461
|
-
*/
|
|
462
285
|
setError(error) {
|
|
463
286
|
self.error = error;
|
|
464
287
|
},
|
|
465
|
-
/**
|
|
466
|
-
* #action
|
|
467
|
-
*/
|
|
468
288
|
showTrack(trackId, initialSnapshot = {}) {
|
|
469
289
|
const schema = pluginManager.pluggableConfigSchemaType('track');
|
|
470
290
|
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
@@ -483,9 +303,6 @@ function stateModelFactory(pluginManager) {
|
|
|
483
303
|
});
|
|
484
304
|
self.tracks.push(track);
|
|
485
305
|
},
|
|
486
|
-
/**
|
|
487
|
-
* #action
|
|
488
|
-
*/
|
|
489
306
|
addTrackConf(configuration, initialSnapshot = {}) {
|
|
490
307
|
const { type } = configuration;
|
|
491
308
|
const name = (0, configuration_1.readConfObject)(configuration, 'name');
|
|
@@ -504,9 +321,6 @@ function stateModelFactory(pluginManager) {
|
|
|
504
321
|
displays: [{ type: displayConf.type, configuration: displayConf }],
|
|
505
322
|
}));
|
|
506
323
|
},
|
|
507
|
-
/**
|
|
508
|
-
* #action
|
|
509
|
-
*/
|
|
510
324
|
hideTrack(trackId) {
|
|
511
325
|
const schema = pluginManager.pluggableConfigSchemaType('track');
|
|
512
326
|
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
@@ -516,32 +330,19 @@ function stateModelFactory(pluginManager) {
|
|
|
516
330
|
});
|
|
517
331
|
return t.length;
|
|
518
332
|
},
|
|
519
|
-
/**
|
|
520
|
-
* #action
|
|
521
|
-
*/
|
|
522
333
|
toggleFitToWindowLock() {
|
|
523
|
-
// when going unlocked -> locked and circle is cut off, set to the
|
|
524
|
-
// locked minBpPerPx
|
|
525
334
|
self.lockedFitToWindow = !self.lockedFitToWindow;
|
|
526
335
|
this.setModelViewWhenAdjust(self.atMinBpPerPx);
|
|
527
336
|
return self.lockedFitToWindow;
|
|
528
337
|
},
|
|
529
|
-
/**
|
|
530
|
-
* #action
|
|
531
|
-
* creates an svg export and save using FileSaver
|
|
532
|
-
*/
|
|
533
338
|
async exportSvg(opts = {}) {
|
|
534
|
-
const { renderToSvg } = await Promise.resolve().then(() => __importStar(require('
|
|
339
|
+
const { renderToSvg } = await Promise.resolve().then(() => __importStar(require('./svgcomponents/SVGCircularView')));
|
|
535
340
|
const html = await renderToSvg(self, opts);
|
|
536
341
|
const blob = new Blob([html], { type: 'image/svg+xml' });
|
|
537
342
|
(0, file_saver_1.saveAs)(blob, opts.filename || 'image.svg');
|
|
538
343
|
},
|
|
539
344
|
}))
|
|
540
345
|
.views(self => ({
|
|
541
|
-
/**
|
|
542
|
-
* #method
|
|
543
|
-
* return the view menu items
|
|
544
|
-
*/
|
|
545
346
|
menuItems() {
|
|
546
347
|
return [
|
|
547
348
|
{
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.default = SVGBackground;
|
|
7
|
-
const
|
|
8
|
-
const material_1 = require("@mui/material");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
5
|
const util_1 = require("@jbrowse/core/util");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
10
7
|
function SVGBackground({ width, height, shift, }) {
|
|
11
8
|
const theme = (0, material_1.useTheme)();
|
|
12
|
-
return (
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)("rect", { width: width + shift * 2, height: height, fill: (0, util_1.stripAlpha)(theme.palette.background.default) }));
|
|
13
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { CircularViewModel, ExportSvgOptions } from '../model';
|
|
2
2
|
type CGV = CircularViewModel;
|
|
3
3
|
export declare function renderToSvg(model: CGV, opts: ExportSvgOptions): Promise<string>;
|
|
4
4
|
export {};
|
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.renderToSvg = renderToSvg;
|
|
7
|
-
const
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
10
|
+
const util_1 = require("@jbrowse/core/util");
|
|
8
11
|
const material_1 = require("@mui/material");
|
|
9
12
|
const mobx_1 = require("mobx");
|
|
10
|
-
const util_1 = require("@jbrowse/core/util");
|
|
11
|
-
const ui_1 = require("@jbrowse/core/ui");
|
|
12
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
13
13
|
const SVGBackground_1 = __importDefault(require("./SVGBackground"));
|
|
14
14
|
const Ruler_1 = __importDefault(require("../components/Ruler"));
|
|
15
15
|
async function renderToSvg(model, opts) {
|
|
@@ -18,7 +18,6 @@ async function renderToSvg(model, opts) {
|
|
|
18
18
|
const { themeName = 'default', Wrapper = ({ children }) => children } = opts;
|
|
19
19
|
const session = (0, util_1.getSession)(model);
|
|
20
20
|
const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
|
|
21
|
-
const { createRootFn } = (0, mobx_state_tree_1.getRoot)(model);
|
|
22
21
|
const { width, tracks, height } = model;
|
|
23
22
|
const shift = 50;
|
|
24
23
|
const displayResults = await Promise.all(tracks.map(async (track) => {
|
|
@@ -28,16 +27,5 @@ async function renderToSvg(model, opts) {
|
|
|
28
27
|
}));
|
|
29
28
|
const { staticSlices, offsetRadians, centerXY } = model;
|
|
30
29
|
const deg = (0, util_1.radToDeg)(offsetRadians);
|
|
31
|
-
|
|
32
|
-
return (0, util_1.renderToStaticMarkup)(react_1.default.createElement(material_1.ThemeProvider, { theme: (0, ui_1.createJBrowseTheme)(theme) },
|
|
33
|
-
react_1.default.createElement(Wrapper, null,
|
|
34
|
-
react_1.default.createElement("svg", { width: width, height: height, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, width + shift * 2, height].toString() },
|
|
35
|
-
react_1.default.createElement(SVGBackground_1.default, { width: width, height: height, shift: shift }),
|
|
36
|
-
react_1.default.createElement("g", { transform: `translate(${centerXY}) rotate(${deg})` },
|
|
37
|
-
staticSlices.map((slice, i) => (
|
|
38
|
-
/* biome-ignore lint/suspicious/noArrayIndexKey: */
|
|
39
|
-
react_1.default.createElement(Ruler_1.default, { key: i, model: model, slice: slice }))),
|
|
40
|
-
displayResults.map(({ result }, i) => (
|
|
41
|
-
/* biome-ignore lint/suspicious/noArrayIndexKey: */
|
|
42
|
-
react_1.default.createElement(react_1.default.Fragment, { key: i }, result))))))), createRootFn);
|
|
30
|
+
return (0, util_1.renderToStaticMarkup)((0, jsx_runtime_1.jsx)(material_1.ThemeProvider, { theme: (0, ui_1.createJBrowseTheme)(theme), children: (0, jsx_runtime_1.jsx)(Wrapper, { children: (0, jsx_runtime_1.jsxs)("svg", { width: width, height: height, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, width + shift * 2, height].toString(), children: [(0, jsx_runtime_1.jsx)(SVGBackground_1.default, { width: width, height: height, shift: shift }), (0, jsx_runtime_1.jsxs)("g", { transform: `translate(${centerXY}) rotate(${deg})`, children: [staticSlices.map((slice, i) => ((0, jsx_runtime_1.jsx)(Ruler_1.default, { model: model, slice: slice }, i))), displayResults.map(({ result }, i) => ((0, jsx_runtime_1.jsx)(react_1.Fragment, { children: result }, i)))] })] }) }) }));
|
|
43
31
|
}
|