@jbrowse/plugin-breakpoint-split-view 2.9.0 → 2.10.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/BreakpointSplitView/model.d.ts +31 -15
- package/dist/BreakpointSplitView/model.js +2 -0
- package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +9 -22
- package/dist/BreakpointSplitView/svgcomponents/util.d.ts +4 -0
- package/dist/BreakpointSplitView/svgcomponents/util.js +20 -0
- package/esm/BreakpointSplitView/model.d.ts +31 -15
- package/esm/BreakpointSplitView/model.js +2 -0
- package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +6 -19
- package/esm/BreakpointSplitView/svgcomponents/util.d.ts +4 -0
- package/esm/BreakpointSplitView/svgcomponents/util.js +15 -0
- package/package.json +2 -2
|
@@ -6,7 +6,9 @@ import { Feature } from '@jbrowse/core/util';
|
|
|
6
6
|
export interface ExportSvgOptions {
|
|
7
7
|
rasterizeLayers?: boolean;
|
|
8
8
|
filename?: string;
|
|
9
|
-
Wrapper?: React.FC<
|
|
9
|
+
Wrapper?: React.FC<{
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}>;
|
|
10
12
|
fontSize?: number;
|
|
11
13
|
rulerHeight?: number;
|
|
12
14
|
textHeight?: number;
|
|
@@ -26,6 +28,8 @@ export interface Breakend {
|
|
|
26
28
|
export type LayoutRecord = [number, number, number, number];
|
|
27
29
|
/**
|
|
28
30
|
* #stateModel BreakpointSplitView
|
|
31
|
+
* extends
|
|
32
|
+
* - [BaseViewModel](../baseviewmodel)
|
|
29
33
|
*/
|
|
30
34
|
export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
31
35
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
@@ -226,7 +230,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
226
230
|
readonly refNames: string[] | undefined;
|
|
227
231
|
} & {
|
|
228
232
|
getCanonicalRefName(refName: string): string | undefined;
|
|
229
|
-
getRefNameColor(refName: string): string | undefined;
|
|
233
|
+
getRefNameColor(refName: string): string | undefined; /**
|
|
234
|
+
* #property
|
|
235
|
+
*/
|
|
230
236
|
isValidRefName(refName: string): boolean;
|
|
231
237
|
} & {
|
|
232
238
|
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
|
|
@@ -237,18 +243,22 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
237
243
|
}, lcAliases: {
|
|
238
244
|
[x: string]: string | undefined;
|
|
239
245
|
}): void;
|
|
240
|
-
setCytobands(cytobands: Feature[]): void;
|
|
241
|
-
* #property
|
|
242
|
-
*/
|
|
246
|
+
setCytobands(cytobands: Feature[]): void;
|
|
243
247
|
setLoadingP(p?: Promise<void> | undefined): void;
|
|
244
248
|
load(): Promise<void>;
|
|
245
249
|
loadPre(): Promise<void>;
|
|
246
250
|
} & {
|
|
247
|
-
getAdapterMapEntry(adapterConf:
|
|
248
|
-
|
|
251
|
+
getAdapterMapEntry(adapterConf: {
|
|
252
|
+
[x: string]: unknown;
|
|
253
|
+
}, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
|
|
254
|
+
getRefNameMapForAdapter(adapterConf: {
|
|
255
|
+
[x: string]: unknown;
|
|
256
|
+
}, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
249
257
|
[x: string]: string | undefined;
|
|
250
258
|
}>;
|
|
251
|
-
getReverseRefNameMapForAdapter(adapterConf:
|
|
259
|
+
getReverseRefNameMapForAdapter(adapterConf: {
|
|
260
|
+
[x: string]: unknown;
|
|
261
|
+
}, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
252
262
|
[x: string]: string | undefined;
|
|
253
263
|
}>;
|
|
254
264
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -284,7 +294,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
284
294
|
readonly refNames: string[] | undefined;
|
|
285
295
|
} & {
|
|
286
296
|
getCanonicalRefName(refName: string): string | undefined;
|
|
287
|
-
getRefNameColor(refName: string): string | undefined;
|
|
297
|
+
getRefNameColor(refName: string): string | undefined; /**
|
|
298
|
+
* #property
|
|
299
|
+
*/
|
|
288
300
|
isValidRefName(refName: string): boolean;
|
|
289
301
|
} & {
|
|
290
302
|
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
|
|
@@ -295,18 +307,22 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
295
307
|
}, lcAliases: {
|
|
296
308
|
[x: string]: string | undefined;
|
|
297
309
|
}): void;
|
|
298
|
-
setCytobands(cytobands: Feature[]): void;
|
|
299
|
-
* #property
|
|
300
|
-
*/
|
|
310
|
+
setCytobands(cytobands: Feature[]): void;
|
|
301
311
|
setLoadingP(p?: Promise<void> | undefined): void;
|
|
302
312
|
load(): Promise<void>;
|
|
303
313
|
loadPre(): Promise<void>;
|
|
304
314
|
} & {
|
|
305
|
-
getAdapterMapEntry(adapterConf:
|
|
306
|
-
|
|
315
|
+
getAdapterMapEntry(adapterConf: {
|
|
316
|
+
[x: string]: unknown;
|
|
317
|
+
}, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
|
|
318
|
+
getRefNameMapForAdapter(adapterConf: {
|
|
319
|
+
[x: string]: unknown;
|
|
320
|
+
}, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
307
321
|
[x: string]: string | undefined;
|
|
308
322
|
}>;
|
|
309
|
-
getReverseRefNameMapForAdapter(adapterConf:
|
|
323
|
+
getReverseRefNameMapForAdapter(adapterConf: {
|
|
324
|
+
[x: string]: unknown;
|
|
325
|
+
}, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
310
326
|
[x: string]: string | undefined;
|
|
311
327
|
}>;
|
|
312
328
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
@@ -5,35 +5,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.renderToSvg = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const server_1 = require("react-dom/server");
|
|
9
8
|
const mobx_1 = require("mobx");
|
|
10
9
|
const util_1 = require("@jbrowse/core/util");
|
|
11
10
|
const material_1 = require("@mui/material");
|
|
12
11
|
const ui_1 = require("@jbrowse/core/ui");
|
|
13
|
-
|
|
12
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
14
13
|
const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
|
|
15
14
|
// locals
|
|
16
15
|
const SVGBackground_1 = __importDefault(require("./SVGBackground"));
|
|
17
|
-
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
18
16
|
const Overlay_1 = __importDefault(require("../components/Overlay"));
|
|
19
|
-
|
|
20
|
-
return (0, util_1.max)(views.flatMap(view => view.tracks.map(t => (0, util_1.measureText)((0, tracks_1.getTrackName)(t.configuration, session), fontSize))), 0);
|
|
21
|
-
}
|
|
22
|
-
function getTrackOffsets(view, textOffset, extra = 0) {
|
|
23
|
-
const offsets = {};
|
|
24
|
-
let curr = textOffset;
|
|
25
|
-
for (const track of view.tracks) {
|
|
26
|
-
offsets[track.configuration.trackId] = curr + extra;
|
|
27
|
-
curr += track.displays[0].height + textOffset;
|
|
28
|
-
}
|
|
29
|
-
return offsets;
|
|
30
|
-
}
|
|
17
|
+
const util_2 = require("./util");
|
|
31
18
|
// render LGV to SVG
|
|
32
19
|
async function renderToSvg(model, opts) {
|
|
33
20
|
var _a;
|
|
34
|
-
const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset',
|
|
21
|
+
const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children), themeName = 'default', } = opts;
|
|
35
22
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
-
|
|
23
|
+
const { createRootFn } = (0, mobx_state_tree_1.getRoot)(model);
|
|
37
24
|
const session = (0, util_1.getSession)(model);
|
|
38
25
|
const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
|
|
39
26
|
const { width, views } = model;
|
|
@@ -49,17 +36,17 @@ async function renderToSvg(model, opts) {
|
|
|
49
36
|
return { track, result: await d.renderSvg({ ...opts, theme }) };
|
|
50
37
|
})),
|
|
51
38
|
})));
|
|
52
|
-
const trackLabelMaxLen = getTrackNameMaxLen(views, fontSize, session) + 40;
|
|
39
|
+
const trackLabelMaxLen = (0, util_2.getTrackNameMaxLen)(views, fontSize, session) + 40;
|
|
53
40
|
const trackLabelOffset = trackLabels === 'left' ? trackLabelMaxLen : 0;
|
|
54
41
|
const textOffset = trackLabels === 'offset' ? textHeight : 0;
|
|
55
42
|
const trackOffsets = [
|
|
56
|
-
getTrackOffsets(views[0], textOffset, fontSize + offset),
|
|
57
|
-
getTrackOffsets(views[1], textOffset, fontSize + heights[0] + offset),
|
|
43
|
+
(0, util_2.getTrackOffsets)(views[0], textOffset, fontSize + offset),
|
|
44
|
+
(0, util_2.getTrackOffsets)(views[1], textOffset, fontSize + heights[0] + offset),
|
|
58
45
|
];
|
|
59
46
|
const w = width + trackLabelOffset;
|
|
60
47
|
const t = (0, ui_1.createJBrowseTheme)(theme);
|
|
61
48
|
// the xlink namespace is used for rendering <image> tag
|
|
62
|
-
return (0,
|
|
49
|
+
return (0, util_1.renderToStaticMarkup)(react_1.default.createElement(material_1.ThemeProvider, { theme: t },
|
|
63
50
|
react_1.default.createElement(Wrapper, null,
|
|
64
51
|
react_1.default.createElement("svg", { width: width, height: totalHeightSvg, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, w + shift * 2, totalHeightSvg].toString() },
|
|
65
52
|
react_1.default.createElement(SVGBackground_1.default, { width: w, height: totalHeightSvg, shift: shift }),
|
|
@@ -76,6 +63,6 @@ async function renderToSvg(model, opts) {
|
|
|
76
63
|
react_1.default.createElement("defs", null,
|
|
77
64
|
react_1.default.createElement("clipPath", { id: "clip-bsv" },
|
|
78
65
|
react_1.default.createElement("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }))),
|
|
79
|
-
react_1.default.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (react_1.default.createElement(Overlay_1.default, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))));
|
|
66
|
+
react_1.default.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (react_1.default.createElement(Overlay_1.default, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))), createRootFn);
|
|
80
67
|
}
|
|
81
68
|
exports.renderToSvg = renderToSvg;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AbstractSessionModel } from '@jbrowse/core/util';
|
|
2
|
+
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
+
export declare function getTrackNameMaxLen(views: LinearGenomeViewModel[], fontSize: number, session: AbstractSessionModel): number;
|
|
4
|
+
export declare function getTrackOffsets(view: LinearGenomeViewModel, textOffset: number, extra?: number): Record<string, number>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTrackOffsets = exports.getTrackNameMaxLen = void 0;
|
|
4
|
+
const util_1 = require("@jbrowse/core/util");
|
|
5
|
+
// locals
|
|
6
|
+
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
7
|
+
function getTrackNameMaxLen(views, fontSize, session) {
|
|
8
|
+
return (0, util_1.max)(views.flatMap(view => view.tracks.map(t => (0, util_1.measureText)((0, tracks_1.getTrackName)(t.configuration, session), fontSize))), 0);
|
|
9
|
+
}
|
|
10
|
+
exports.getTrackNameMaxLen = getTrackNameMaxLen;
|
|
11
|
+
function getTrackOffsets(view, textOffset, extra = 0) {
|
|
12
|
+
const offsets = {};
|
|
13
|
+
let curr = textOffset;
|
|
14
|
+
for (const track of view.tracks) {
|
|
15
|
+
offsets[track.configuration.trackId] = curr + extra;
|
|
16
|
+
curr += track.displays[0].height + textOffset;
|
|
17
|
+
}
|
|
18
|
+
return offsets;
|
|
19
|
+
}
|
|
20
|
+
exports.getTrackOffsets = getTrackOffsets;
|
|
@@ -6,7 +6,9 @@ import { Feature } from '@jbrowse/core/util';
|
|
|
6
6
|
export interface ExportSvgOptions {
|
|
7
7
|
rasterizeLayers?: boolean;
|
|
8
8
|
filename?: string;
|
|
9
|
-
Wrapper?: React.FC<
|
|
9
|
+
Wrapper?: React.FC<{
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}>;
|
|
10
12
|
fontSize?: number;
|
|
11
13
|
rulerHeight?: number;
|
|
12
14
|
textHeight?: number;
|
|
@@ -26,6 +28,8 @@ export interface Breakend {
|
|
|
26
28
|
export type LayoutRecord = [number, number, number, number];
|
|
27
29
|
/**
|
|
28
30
|
* #stateModel BreakpointSplitView
|
|
31
|
+
* extends
|
|
32
|
+
* - [BaseViewModel](../baseviewmodel)
|
|
29
33
|
*/
|
|
30
34
|
export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
|
|
31
35
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
@@ -226,7 +230,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
226
230
|
readonly refNames: string[] | undefined;
|
|
227
231
|
} & {
|
|
228
232
|
getCanonicalRefName(refName: string): string | undefined;
|
|
229
|
-
getRefNameColor(refName: string): string | undefined;
|
|
233
|
+
getRefNameColor(refName: string): string | undefined; /**
|
|
234
|
+
* #property
|
|
235
|
+
*/
|
|
230
236
|
isValidRefName(refName: string): boolean;
|
|
231
237
|
} & {
|
|
232
238
|
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
|
|
@@ -237,18 +243,22 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
237
243
|
}, lcAliases: {
|
|
238
244
|
[x: string]: string | undefined;
|
|
239
245
|
}): void;
|
|
240
|
-
setCytobands(cytobands: Feature[]): void;
|
|
241
|
-
* #property
|
|
242
|
-
*/
|
|
246
|
+
setCytobands(cytobands: Feature[]): void;
|
|
243
247
|
setLoadingP(p?: Promise<void> | undefined): void;
|
|
244
248
|
load(): Promise<void>;
|
|
245
249
|
loadPre(): Promise<void>;
|
|
246
250
|
} & {
|
|
247
|
-
getAdapterMapEntry(adapterConf:
|
|
248
|
-
|
|
251
|
+
getAdapterMapEntry(adapterConf: {
|
|
252
|
+
[x: string]: unknown;
|
|
253
|
+
}, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
|
|
254
|
+
getRefNameMapForAdapter(adapterConf: {
|
|
255
|
+
[x: string]: unknown;
|
|
256
|
+
}, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
249
257
|
[x: string]: string | undefined;
|
|
250
258
|
}>;
|
|
251
|
-
getReverseRefNameMapForAdapter(adapterConf:
|
|
259
|
+
getReverseRefNameMapForAdapter(adapterConf: {
|
|
260
|
+
[x: string]: unknown;
|
|
261
|
+
}, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
252
262
|
[x: string]: string | undefined;
|
|
253
263
|
}>;
|
|
254
264
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
@@ -284,7 +294,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
284
294
|
readonly refNames: string[] | undefined;
|
|
285
295
|
} & {
|
|
286
296
|
getCanonicalRefName(refName: string): string | undefined;
|
|
287
|
-
getRefNameColor(refName: string): string | undefined;
|
|
297
|
+
getRefNameColor(refName: string): string | undefined; /**
|
|
298
|
+
* #property
|
|
299
|
+
*/
|
|
288
300
|
isValidRefName(refName: string): boolean;
|
|
289
301
|
} & {
|
|
290
302
|
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
|
|
@@ -295,18 +307,22 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
|
|
|
295
307
|
}, lcAliases: {
|
|
296
308
|
[x: string]: string | undefined;
|
|
297
309
|
}): void;
|
|
298
|
-
setCytobands(cytobands: Feature[]): void;
|
|
299
|
-
* #property
|
|
300
|
-
*/
|
|
310
|
+
setCytobands(cytobands: Feature[]): void;
|
|
301
311
|
setLoadingP(p?: Promise<void> | undefined): void;
|
|
302
312
|
load(): Promise<void>;
|
|
303
313
|
loadPre(): Promise<void>;
|
|
304
314
|
} & {
|
|
305
|
-
getAdapterMapEntry(adapterConf:
|
|
306
|
-
|
|
315
|
+
getAdapterMapEntry(adapterConf: {
|
|
316
|
+
[x: string]: unknown;
|
|
317
|
+
}, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
|
|
318
|
+
getRefNameMapForAdapter(adapterConf: {
|
|
319
|
+
[x: string]: unknown;
|
|
320
|
+
}, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
307
321
|
[x: string]: string | undefined;
|
|
308
322
|
}>;
|
|
309
|
-
getReverseRefNameMapForAdapter(adapterConf:
|
|
323
|
+
getReverseRefNameMapForAdapter(adapterConf: {
|
|
324
|
+
[x: string]: unknown;
|
|
325
|
+
}, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
|
|
310
326
|
[x: string]: string | undefined;
|
|
311
327
|
}>;
|
|
312
328
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
@@ -1,33 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { renderToStaticMarkup } from 'react-dom/server';
|
|
3
2
|
import { when } from 'mobx';
|
|
4
|
-
import { getSession,
|
|
3
|
+
import { getSession, renderToStaticMarkup, sum } from '@jbrowse/core/util';
|
|
5
4
|
import { ThemeProvider } from '@mui/material';
|
|
6
5
|
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
7
|
-
|
|
6
|
+
import { getRoot } from 'mobx-state-tree';
|
|
8
7
|
import { SVGTracks, SVGRuler, totalHeight, } from '@jbrowse/plugin-linear-genome-view';
|
|
9
8
|
// locals
|
|
10
9
|
import SVGBackground from './SVGBackground';
|
|
11
|
-
import { getTrackName } from '@jbrowse/core/util/tracks';
|
|
12
10
|
import Overlay from '../components/Overlay';
|
|
13
|
-
|
|
14
|
-
return max(views.flatMap(view => view.tracks.map(t => measureText(getTrackName(t.configuration, session), fontSize))), 0);
|
|
15
|
-
}
|
|
16
|
-
function getTrackOffsets(view, textOffset, extra = 0) {
|
|
17
|
-
const offsets = {};
|
|
18
|
-
let curr = textOffset;
|
|
19
|
-
for (const track of view.tracks) {
|
|
20
|
-
offsets[track.configuration.trackId] = curr + extra;
|
|
21
|
-
curr += track.displays[0].height + textOffset;
|
|
22
|
-
}
|
|
23
|
-
return offsets;
|
|
24
|
-
}
|
|
11
|
+
import { getTrackNameMaxLen, getTrackOffsets } from './util';
|
|
25
12
|
// render LGV to SVG
|
|
26
13
|
export async function renderToSvg(model, opts) {
|
|
27
14
|
var _a;
|
|
28
|
-
const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset',
|
|
15
|
+
const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => React.createElement(React.Fragment, null, children), themeName = 'default', } = opts;
|
|
29
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
-
|
|
17
|
+
const { createRootFn } = getRoot(model);
|
|
31
18
|
const session = getSession(model);
|
|
32
19
|
const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
|
|
33
20
|
const { width, views } = model;
|
|
@@ -70,5 +57,5 @@ export async function renderToSvg(model, opts) {
|
|
|
70
57
|
React.createElement("defs", null,
|
|
71
58
|
React.createElement("clipPath", { id: "clip-bsv" },
|
|
72
59
|
React.createElement("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }))),
|
|
73
|
-
React.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (React.createElement(Overlay, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))));
|
|
60
|
+
React.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (React.createElement(Overlay, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))), createRootFn);
|
|
74
61
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AbstractSessionModel } from '@jbrowse/core/util';
|
|
2
|
+
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
+
export declare function getTrackNameMaxLen(views: LinearGenomeViewModel[], fontSize: number, session: AbstractSessionModel): number;
|
|
4
|
+
export declare function getTrackOffsets(view: LinearGenomeViewModel, textOffset: number, extra?: number): Record<string, number>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { max, measureText } from '@jbrowse/core/util';
|
|
2
|
+
// locals
|
|
3
|
+
import { getTrackName } from '@jbrowse/core/util/tracks';
|
|
4
|
+
export function getTrackNameMaxLen(views, fontSize, session) {
|
|
5
|
+
return max(views.flatMap(view => view.tracks.map(t => measureText(getTrackName(t.configuration, session), fontSize))), 0);
|
|
6
|
+
}
|
|
7
|
+
export function getTrackOffsets(view, textOffset, extra = 0) {
|
|
8
|
+
const offsets = {};
|
|
9
|
+
let curr = textOffset;
|
|
10
|
+
for (const track of view.tracks) {
|
|
11
|
+
offsets[track.configuration.trackId] = curr + extra;
|
|
12
|
+
curr += track.displays[0].height + textOffset;
|
|
13
|
+
}
|
|
14
|
+
return offsets;
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-breakpoint-split-view",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "JBrowse 2 breakpoint detail split view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "223d8bfb68fd1bacaf22852639ad5920f1b7f43b"
|
|
62
62
|
}
|