@jbrowse/plugin-dotplot-view 2.8.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.
@@ -5,11 +5,11 @@ 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");
12
+ const mobx_state_tree_1 = require("mobx-state-tree");
13
13
  const Grid_1 = require("../components/Grid");
14
14
  const Axes_1 = require("../components/Axes");
15
15
  const SVGBackground_1 = __importDefault(require("./SVGBackground"));
@@ -18,6 +18,8 @@ async function renderToSvg(model, opts) {
18
18
  var _a;
19
19
  await (0, mobx_1.when)(() => model.initialized);
20
20
  const { themeName = 'default', Wrapper = ({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children) } = opts;
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ const { createRootFn } = (0, mobx_state_tree_1.getRoot)(model);
21
23
  const session = (0, util_1.getSession)(model);
22
24
  const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
23
25
  const { width, borderX, viewWidth, viewHeight, tracks, height } = model;
@@ -29,7 +31,7 @@ async function renderToSvg(model, opts) {
29
31
  }));
30
32
  const w = width + shift * 2;
31
33
  // the xlink namespace is used for rendering <image> tag
32
- return (0, server_1.renderToStaticMarkup)(react_1.default.createElement(material_1.ThemeProvider, { theme: (0, ui_1.createJBrowseTheme)(theme) },
34
+ return (0, util_1.renderToStaticMarkup)(react_1.default.createElement(material_1.ThemeProvider, { theme: (0, ui_1.createJBrowseTheme)(theme) },
33
35
  react_1.default.createElement(Wrapper, null,
34
36
  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, w, height].toString() },
35
37
  react_1.default.createElement(SVGBackground_1.default, { width: w, height: height }),
@@ -41,6 +43,6 @@ async function renderToSvg(model, opts) {
41
43
  react_1.default.createElement("rect", { x: 0, y: 0, width: viewWidth, height: viewHeight }))),
42
44
  react_1.default.createElement("g", { clipPath: "url(#clip-ruler)" }, displayResults.map(({ result }, i) => (react_1.default.createElement("g", { key: i }, result))))),
43
45
  react_1.default.createElement("g", { transform: `translate(${borderX} ${viewHeight})` },
44
- react_1.default.createElement(Axes_1.HorizontalAxisRaw, { model: model }))))));
46
+ react_1.default.createElement(Axes_1.HorizontalAxisRaw, { model: model }))))), createRootFn);
45
47
  }
46
48
  exports.renderToSvg = renderToSvg;
@@ -61,15 +61,10 @@ export const HorizontalAxisRaw = observer(function ({ model, }) {
61
61
  const xoff = Math.floor(x - hview.offsetPx);
62
62
  return (React.createElement("text", { transform: `rotate(${htextRotation},${xoff},${y})`, key: JSON.stringify(region), x: xoff, y: y + 1, fill: theme.palette.text.primary, fontSize: 11, dominantBaseline: "hanging", textAnchor: "end" }, region.refName));
63
63
  }),
64
- ticks.map(([tick, x]) => {
65
- return (React.createElement("line", { key: `line-${JSON.stringify(tick)}`, x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, stroke: theme.palette.grey[400] }));
66
- }),
64
+ ticks.map(([tick, x]) => x > 0 && x < width ? (React.createElement("line", { key: `line-${JSON.stringify(tick)}`, x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, stroke: theme.palette.grey[400] })) : null),
67
65
  ticks
68
66
  .filter(t => t[0].type === 'major')
69
- .map(([tick, x]) => {
70
- const y = 0;
71
- return x > 10 ? (React.createElement("text", { x: x - 7, y: y, transform: `rotate(${htextRotation},${x},${y})`, key: `text-${JSON.stringify(tick)}`, fill: theme.palette.text.primary, fontSize: 11, dominantBaseline: "middle", textAnchor: "end" }, getTickDisplayStr(tick.base + 1, bpPerPx))) : null;
72
- }),
67
+ .map(([tick, x]) => x > 10 && x < width ? (React.createElement("text", { x: x - 7, y: 0, transform: `rotate(${htextRotation},${x},${0})`, key: `text-${JSON.stringify(tick)}`, fill: theme.palette.text.primary, fontSize: 11, dominantBaseline: "middle", textAnchor: "end" }, getTickDisplayStr(tick.base + 1, bpPerPx))) : null),
73
68
  React.createElement("text", { y: borderY - 12, x: (viewWidth - borderX) / 2, fill: theme.palette.text.primary, textAnchor: "middle", fontSize: 11, dominantBaseline: "hanging" }, hview.assemblyNames.join(','))));
74
69
  });
75
70
  export const VerticalAxis = observer(function ({ model, }) {
@@ -112,11 +107,9 @@ export const VerticalAxisRaw = observer(function ({ model, }) {
112
107
  const yoff = Math.floor(viewHeight - y + offsetPx);
113
108
  return (React.createElement("text", { transform: `rotate(${vtextRotation},${x},${y})`, key: JSON.stringify(region), x: x, y: yoff, fill: theme.palette.text.primary, fontSize: 11, textAnchor: "end" }, region.refName));
114
109
  }),
115
- ticks.map(([tick, y]) => (React.createElement("line", { key: `line-${JSON.stringify(tick)}`, y1: viewHeight - y, y2: viewHeight - y, x1: borderX, x2: borderX - (tick.type === 'major' ? 6 : 4), strokeWidth: 1, stroke: theme.palette.grey[400] }))),
110
+ ticks.map(([tick, y]) => y > 0 ? (React.createElement("line", { key: `line-${JSON.stringify(tick)}`, y1: viewHeight - y, y2: viewHeight - y, x1: borderX, x2: borderX - (tick.type === 'major' ? 6 : 4), strokeWidth: 1, stroke: theme.palette.grey[400] })) : null),
116
111
  ticks
117
112
  .filter(t => t[0].type === 'major')
118
- .map(([tick, y]) => {
119
- return y > 10 ? (React.createElement("text", { y: viewHeight - y - 3, x: borderX - 7, key: `text-${JSON.stringify(tick)}`, textAnchor: "end", fill: theme.palette.text.primary, dominantBaseline: "hanging", fontSize: 11 }, getTickDisplayStr(tick.base + 1, bpPerPx))) : null;
120
- }),
113
+ .map(([tick, y]) => y > 10 && y < viewHeight ? (React.createElement("text", { y: viewHeight - y - 3, x: borderX - 7, key: `text-${JSON.stringify(tick)}`, textAnchor: "end", fill: theme.palette.text.primary, dominantBaseline: "hanging", fontSize: 11 }, getTickDisplayStr(tick.base + 1, bpPerPx))) : null),
121
114
  React.createElement("text", { y: (viewHeight - borderY) / 2, x: 12, fill: theme.palette.text.primary, transform: `rotate(-90,12,${(viewHeight - borderY) / 2})`, textAnchor: "middle", fontSize: 11 }, vview.assemblyNames.join(','))));
122
115
  });
@@ -1,18 +1,17 @@
1
1
  import React from 'react';
2
2
  import { DotplotViewModel } from '../model';
3
3
  type Coord = [number, number] | undefined;
4
- export declare const TooltipWhereMouseovered: ({ model, mouserect, mouserectClient, xdistance, ydistance, }: {
4
+ export declare const TooltipWhereMouseovered: ({ model, mouserect, mouserectClient, xdistance, }: {
5
5
  model: DotplotViewModel;
6
6
  mouserect: Coord;
7
7
  mouserectClient: Coord;
8
8
  xdistance: number;
9
- ydistance: number;
10
- }) => React.JSX.Element;
9
+ }) => React.JSX.Element | null;
11
10
  export declare const TooltipWhereClicked: ({ model, mousedown, mousedownClient, xdistance, ydistance, }: {
12
11
  model: DotplotViewModel;
13
12
  mousedown: Coord;
14
13
  mousedownClient: Coord;
15
14
  xdistance: number;
16
15
  ydistance: number;
17
- }) => React.JSX.Element;
16
+ }) => React.JSX.Element | null;
18
17
  export {};
@@ -1,9 +1,9 @@
1
- import React, { useMemo, useRef, useState } from 'react';
1
+ import React from 'react';
2
2
  import { observer } from 'mobx-react';
3
3
  import { makeStyles } from 'tss-react/mui';
4
4
  import { locstr } from './util';
5
- import { Portal, alpha } from '@mui/material';
6
- import { usePopper } from 'react-popper';
5
+ import { Portal, alpha, useTheme } from '@mui/material';
6
+ import { useFloating, useClientPoint, useInteractions, } from '@floating-ui/react';
7
7
  function round(value) {
8
8
  return Math.round(value * 1e5) / 1e5;
9
9
  }
@@ -24,77 +24,54 @@ const useStyles = makeStyles()(theme => ({
24
24
  wordWrap: 'break-word',
25
25
  },
26
26
  }));
27
- const blank = { left: 0, top: 0, width: 0, height: 0 };
28
- export const TooltipWhereMouseovered = observer(function ({ model, mouserect, mouserectClient, xdistance, ydistance, }) {
29
- var _a;
27
+ export const TooltipWhereMouseovered = observer(function ({ model, mouserect, mouserectClient, xdistance, }) {
28
+ var _a, _b;
30
29
  const { classes } = useStyles();
31
30
  const { hview, vview, viewHeight } = model;
32
- const [anchorEl, setAnchorEl] = useState(null);
33
- const ref = useRef(null);
34
- const rect = ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || blank;
35
- const offset = 6;
36
- const w = rect.height + offset * 2;
37
- // must be memoized a la https://github.com/popperjs/react-popper/issues/391
38
- const virtElement = useMemo(() => ({
39
- getBoundingClientRect: () => {
40
- const x = offset + ((mouserectClient === null || mouserectClient === void 0 ? void 0 : mouserectClient[0]) || 0) - (xdistance < 0 ? w : 0);
41
- const y = offset + ((mouserectClient === null || mouserectClient === void 0 ? void 0 : mouserectClient[1]) || 0) - (ydistance < 0 ? w : 0);
42
- return {
43
- top: y,
44
- left: x,
45
- bottom: y,
46
- right: x,
47
- width: 0,
48
- height: 0,
49
- x,
50
- y,
51
- toJSON() { },
52
- };
53
- },
54
- }), [mouserectClient, xdistance, ydistance, w]);
55
- const { styles, attributes } = usePopper(virtElement, anchorEl, {
31
+ const theme = useTheme();
32
+ const { refs, floatingStyles, context } = useFloating({
56
33
  placement: xdistance < 0 ? 'left' : 'right',
57
34
  });
58
- return (React.createElement(React.Fragment, null, mouserect ? (React.createElement(Portal, null,
59
- React.createElement("div", { ref: setAnchorEl, className: classes.tooltip,
60
- // zIndex needed to go over widget drawer
61
- style: { ...styles.popper, zIndex: 100000 }, ...attributes.popper },
35
+ const clientPoint = useClientPoint(context, mouserectClient
36
+ ? {
37
+ x: mouserectClient[0],
38
+ y: mouserectClient[1],
39
+ }
40
+ : undefined);
41
+ const { getFloatingProps } = useInteractions([clientPoint]);
42
+ const popperTheme = (_a = theme === null || theme === void 0 ? void 0 : theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
43
+ return mouserect ? (React.createElement(Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
44
+ React.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
45
+ ...floatingStyles,
46
+ zIndex: 100000,
47
+ pointerEvents: 'none',
48
+ }, ...getFloatingProps() },
62
49
  `x - ${locstr(mouserect[0], hview)}`,
63
50
  React.createElement("br", null),
64
51
  `y - ${locstr(viewHeight - mouserect[1], vview)}`,
65
- React.createElement("br", null)))) : null));
52
+ React.createElement("br", null)))) : null;
66
53
  });
67
54
  export const TooltipWhereClicked = observer(function ({ model, mousedown, mousedownClient, xdistance, ydistance, }) {
55
+ var _a, _b;
68
56
  const { classes } = useStyles();
69
57
  const { hview, vview, viewHeight } = model;
70
- const [anchorEl, setAnchorEl] = useState(null);
71
- // must be memoized a la https://github.com/popperjs/react-popper/issues/391
72
- const virtElement = useMemo(() => ({
73
- getBoundingClientRect: () => {
74
- const x = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[0]) || 0) - (xdistance < 0 ? 0 : 0);
75
- const y = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[1]) || 0) - (ydistance < 0 ? 0 : 0);
76
- return {
77
- top: y,
78
- left: x,
79
- bottom: y,
80
- right: x,
81
- width: 0,
82
- height: 0,
83
- x,
84
- y,
85
- toJSON() { },
86
- };
87
- },
88
- }), [mousedownClient, xdistance, ydistance]);
89
- const { styles, attributes } = usePopper(virtElement, anchorEl, {
58
+ const theme = useTheme();
59
+ const x = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[0]) || 0) - (xdistance < 0 ? 0 : 0);
60
+ const y = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[1]) || 0) - (ydistance < 0 ? 0 : 0);
61
+ const { refs, floatingStyles, context } = useFloating({
90
62
  placement: xdistance < 0 ? 'right' : 'left',
91
63
  });
92
- return (React.createElement(React.Fragment, null, mousedown && Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 ? (React.createElement(Portal, null,
93
- React.createElement("div", { ref: setAnchorEl, className: classes.tooltip,
94
- // zIndex needed to go over widget drawer
95
- style: { ...styles.popper, zIndex: 100000 }, ...attributes.popper },
64
+ const clientPoint = useClientPoint(context, { x, y });
65
+ const { getFloatingProps } = useInteractions([clientPoint]);
66
+ const popperTheme = (_a = theme === null || theme === void 0 ? void 0 : theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
67
+ return mousedown && Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 ? (React.createElement(Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
68
+ React.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
69
+ ...floatingStyles,
70
+ zIndex: 100000,
71
+ pointerEvents: 'none',
72
+ }, ...getFloatingProps() },
96
73
  `x - ${locstr(mousedown[0], hview)}`,
97
74
  React.createElement("br", null),
98
75
  `y - ${locstr(viewHeight - mousedown[1], vview)}`,
99
- React.createElement("br", null)))) : null));
76
+ React.createElement("br", null)))) : null;
100
77
  });
@@ -32,7 +32,7 @@ const useStyles = makeStyles()(theme => ({
32
32
  width: '100%',
33
33
  gridRow: '1/2',
34
34
  gridColumn: '2/2',
35
- zIndex: 100,
35
+ zIndex: 100, // needs to be below controls
36
36
  '& path': {
37
37
  cursor: 'crosshair',
38
38
  fill: 'none',
@@ -81,8 +81,8 @@ const DotplotViewInternal = observer(function ({ model, }) {
81
81
  const mousedown = getOffset(mousedownClient, svg);
82
82
  const mousecurr = getOffset(mousecurrClient, svg);
83
83
  const mouseup = getOffset(mouseupClient, svg);
84
- const mouserectClient = mouseupClient || mousecurrClient;
85
84
  const mouserect = mouseup || mousecurr;
85
+ const mouserectClient = mouseupClient || mousecurrClient;
86
86
  const xdistance = mousedown && mouserect ? mouserect[0] - mousedown[0] : 0;
87
87
  const ydistance = mousedown && mouserect ? mouserect[1] - mousedown[1] : 0;
88
88
  const { hview, vview, wheelMode, cursorMode } = model;
@@ -147,22 +147,26 @@ const DotplotViewInternal = observer(function ({ model, }) {
147
147
  hview,
148
148
  vview,
149
149
  ]);
150
- // detect a mouseup after a mousedown was submitted, autoremoves mouseup
151
- // once that single mouseup is set
150
+ // detect a mouseup after a mousedown was submitted, autoremoves mouseup once
151
+ // that single mouseup is set
152
152
  useEffect(() => {
153
- function globalMouseUp(event) {
154
- if (Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 && validSelect) {
155
- setMouseUpClient([event.clientX, event.clientY]);
156
- }
157
- else {
158
- setMouseDownClient(undefined);
159
- }
160
- }
161
153
  if (mousedown && !mouseup) {
154
+ function globalMouseUp(event) {
155
+ if (Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 && validSelect) {
156
+ setMouseUpClient([event.clientX, event.clientY]);
157
+ }
158
+ else {
159
+ setMouseDownClient(undefined);
160
+ }
161
+ }
162
162
  window.addEventListener('mouseup', globalMouseUp, true);
163
- return () => window.removeEventListener('mouseup', globalMouseUp, true);
163
+ return () => {
164
+ window.removeEventListener('mouseup', globalMouseUp, true);
165
+ };
166
+ }
167
+ else {
168
+ return () => { };
164
169
  }
165
- return () => { };
166
170
  }, [
167
171
  validSelect,
168
172
  mousedown,
@@ -185,7 +189,7 @@ const DotplotViewInternal = observer(function ({ model, }) {
185
189
  React.createElement(VerticalAxis, { model: model }),
186
190
  React.createElement(HorizontalAxis, { model: model }),
187
191
  React.createElement("div", { ref: ref, className: classes.content },
188
- mouseOvered && validSelect ? (React.createElement(TooltipWhereMouseovered, { model: model, mouserect: mouserect, mouserectClient: mouserectClient, xdistance: xdistance, ydistance: ydistance })) : null,
192
+ mouseOvered && validSelect ? (React.createElement(TooltipWhereMouseovered, { model: model, mouserect: mouserect, mouserectClient: mouserectClient, xdistance: xdistance })) : null,
189
193
  validSelect ? (React.createElement(TooltipWhereClicked, { model: model, mousedown: mousedown, mousedownClient: mousedownClient, xdistance: xdistance, ydistance: ydistance })) : null,
190
194
  React.createElement("div", { style: { cursor: ctrlKeyWasUsed ? 'pointer' : cursorMode }, onMouseDown: event => {
191
195
  if (event.button === 0) {
@@ -18,7 +18,7 @@ const useStyles = makeStyles()(theme => ({
18
18
  },
19
19
  }));
20
20
  function TrackSelector({ setSessionTrackData, setShowTrackId, sessionTrackData, assembly1, assembly2, model, }) {
21
- const [choice, setChoice] = useState('none');
21
+ const [choice, setChoice] = useState('tracklist');
22
22
  useEffect(() => {
23
23
  if (choice === 'none') {
24
24
  setSessionTrackData(undefined);
@@ -7,13 +7,16 @@ type Coord = [number, number];
7
7
  export interface ExportSvgOptions {
8
8
  rasterizeLayers?: boolean;
9
9
  filename?: string;
10
- Wrapper?: React.FC<any>;
10
+ Wrapper?: React.FC<{
11
+ children: React.ReactNode;
12
+ }>;
11
13
  themeName?: string;
12
14
  }
13
15
  /**
14
16
  * #stateModel DotplotView
15
17
  * #category view
16
- * extends `BaseViewModel`
18
+ * extends
19
+ * - [BaseViewModel](../baseviewmodel)
17
20
  */
18
21
  export default function stateModelFactory(pm: PluginManager): import("mobx-state-tree").IModelType<{
19
22
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
@@ -59,23 +62,15 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
59
62
  readonly assemblyNames: string[];
60
63
  readonly displayedRegionsTotalPx: number;
61
64
  readonly maxOffset: number;
62
- readonly minOffset: number; /**
63
- * #stateModel DotplotView
64
- * #category view
65
- * extends `BaseViewModel`
66
- */
65
+ readonly minOffset: number;
67
66
  readonly totalBp: number;
68
67
  } & {
69
68
  readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
70
69
  readonly staticBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
71
- readonly currBp: number; /**
72
- * #property
73
- */
70
+ readonly currBp: number;
74
71
  } & {
75
72
  pxToBp(px: number): {
76
- coord: number; /**
77
- * #property
78
- */
73
+ coord: number;
79
74
  index: number;
80
75
  refName: string;
81
76
  oob: boolean;
@@ -94,18 +89,23 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
94
89
  * #property
95
90
  */
96
91
  coord: number;
97
- regionNumber?: number | undefined;
92
+ regionNumber?: number | undefined; /**
93
+ * #property
94
+ */
98
95
  }): number | undefined;
99
96
  } & {
100
97
  setFeatures(features: import("@jbrowse/core/util").Feature[]): void;
101
98
  showAllRegions(): void;
102
- zoomOut(): void; /**
103
- * #property
104
- */
99
+ zoomOut(): void;
105
100
  zoomIn(): void;
106
101
  zoomTo(bpPerPx: number, offset?: number | undefined): number;
107
102
  scrollTo(offsetPx: number): number;
108
- centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
103
+ centerAt(coord: number, refName: string | undefined, regionNumber: number): void; /**
104
+ * #property
105
+ * this represents tracks specific to this view specifically used
106
+ * for read vs ref dotplots where this track would not really apply
107
+ * elsewhere
108
+ */
109
109
  scroll(distance: number): number;
110
110
  } & {
111
111
  moveTo(start?: import("@jbrowse/core/util/Base1DUtils").BpOffset | undefined, end?: import("@jbrowse/core/util/Base1DUtils").BpOffset | undefined): void;
@@ -150,23 +150,15 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
150
150
  readonly assemblyNames: string[];
151
151
  readonly displayedRegionsTotalPx: number;
152
152
  readonly maxOffset: number;
153
- readonly minOffset: number; /**
154
- * #stateModel DotplotView
155
- * #category view
156
- * extends `BaseViewModel`
157
- */
153
+ readonly minOffset: number;
158
154
  readonly totalBp: number;
159
155
  } & {
160
156
  readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
161
157
  readonly staticBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
162
- readonly currBp: number; /**
163
- * #property
164
- */
158
+ readonly currBp: number;
165
159
  } & {
166
160
  pxToBp(px: number): {
167
- coord: number; /**
168
- * #property
169
- */
161
+ coord: number;
170
162
  index: number;
171
163
  refName: string;
172
164
  oob: boolean;
@@ -185,18 +177,23 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
185
177
  * #property
186
178
  */
187
179
  coord: number;
188
- regionNumber?: number | undefined;
180
+ regionNumber?: number | undefined; /**
181
+ * #property
182
+ */
189
183
  }): number | undefined;
190
184
  } & {
191
185
  setFeatures(features: import("@jbrowse/core/util").Feature[]): void;
192
186
  showAllRegions(): void;
193
- zoomOut(): void; /**
194
- * #property
195
- */
187
+ zoomOut(): void;
196
188
  zoomIn(): void;
197
189
  zoomTo(bpPerPx: number, offset?: number | undefined): number;
198
190
  scrollTo(offsetPx: number): number;
199
- centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
191
+ centerAt(coord: number, refName: string | undefined, regionNumber: number): void; /**
192
+ * #property
193
+ * this represents tracks specific to this view specifically used
194
+ * for read vs ref dotplots where this track would not really apply
195
+ * elsewhere
196
+ */
200
197
  scroll(distance: number): number;
201
198
  } & {
202
199
  moveTo(start?: import("@jbrowse/core/util/Base1DUtils").BpOffset | undefined, end?: import("@jbrowse/core/util/Base1DUtils").BpOffset | undefined): void;
@@ -233,9 +230,6 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
233
230
  } & {
234
231
  setMinimized(flag: boolean): void;
235
232
  showDisplay(displayId: string, initialSnapshot?: {} | undefined): void;
236
- /**
237
- * #property
238
- */
239
233
  hideDisplay(displayId: string): number; /**
240
234
  * #property
241
235
  */
@@ -243,18 +237,20 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
243
237
  } & {
244
238
  trackMenuItems(): (import("@jbrowse/core/ui").MenuDivider | import("@jbrowse/core/ui").MenuSubHeader | import("@jbrowse/core/ui").NormalMenuItem | import("@jbrowse/core/ui").CheckboxMenuItem | import("@jbrowse/core/ui").RadioMenuItem | import("@jbrowse/core/ui").SubMenuItem | {
245
239
  type: string;
246
- label: string;
240
+ label: string; /**
241
+ * #property
242
+ */
247
243
  subMenu: {
248
244
  type: string;
249
245
  label: string; /**
250
246
  * #property
251
247
  */
252
248
  checked: boolean;
253
- onClick: () => void;
249
+ onClick: () => void; /**
250
+ * #property
251
+ */
254
252
  }[];
255
- })[]; /**
256
- * #property
257
- */
253
+ })[];
258
254
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
259
255
  viewTrackConfigs: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
260
256
  }, {
@@ -362,23 +358,15 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
362
358
  readonly assemblyNames: string[];
363
359
  readonly displayedRegionsTotalPx: number;
364
360
  readonly maxOffset: number;
365
- readonly minOffset: number; /**
366
- * #stateModel DotplotView
367
- * #category view
368
- * extends `BaseViewModel`
369
- */
361
+ readonly minOffset: number;
370
362
  readonly totalBp: number;
371
363
  } & {
372
364
  readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
373
365
  readonly staticBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
374
- readonly currBp: number; /**
375
- * #property
376
- */
366
+ readonly currBp: number;
377
367
  } & {
378
368
  pxToBp(px: number): {
379
- coord: number; /**
380
- * #property
381
- */
369
+ coord: number;
382
370
  index: number;
383
371
  refName: string;
384
372
  oob: boolean;
@@ -397,18 +385,23 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
397
385
  * #property
398
386
  */
399
387
  coord: number;
400
- regionNumber?: number | undefined;
388
+ regionNumber?: number | undefined; /**
389
+ * #property
390
+ */
401
391
  }): number | undefined;
402
392
  } & {
403
393
  setFeatures(features: import("@jbrowse/core/util").Feature[]): void;
404
394
  showAllRegions(): void;
405
- zoomOut(): void; /**
406
- * #property
407
- */
395
+ zoomOut(): void;
408
396
  zoomIn(): void;
409
397
  zoomTo(bpPerPx: number, offset?: number | undefined): number;
410
398
  scrollTo(offsetPx: number): number;
411
- centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
399
+ centerAt(coord: number, refName: string | undefined, regionNumber: number): void; /**
400
+ * #property
401
+ * this represents tracks specific to this view specifically used
402
+ * for read vs ref dotplots where this track would not really apply
403
+ * elsewhere
404
+ */
412
405
  scroll(distance: number): number;
413
406
  } & {
414
407
  moveTo(start?: import("@jbrowse/core/util/Base1DUtils").BpOffset | undefined, end?: import("@jbrowse/core/util/Base1DUtils").BpOffset | undefined): void;
@@ -452,23 +445,15 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
452
445
  readonly assemblyNames: string[];
453
446
  readonly displayedRegionsTotalPx: number;
454
447
  readonly maxOffset: number;
455
- readonly minOffset: number; /**
456
- * #stateModel DotplotView
457
- * #category view
458
- * extends `BaseViewModel`
459
- */
448
+ readonly minOffset: number;
460
449
  readonly totalBp: number;
461
450
  } & {
462
451
  readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
463
452
  readonly staticBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
464
- readonly currBp: number; /**
465
- * #property
466
- */
453
+ readonly currBp: number;
467
454
  } & {
468
455
  pxToBp(px: number): {
469
- coord: number; /**
470
- * #property
471
- */
456
+ coord: number;
472
457
  index: number;
473
458
  refName: string;
474
459
  oob: boolean;
@@ -487,18 +472,23 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
487
472
  * #property
488
473
  */
489
474
  coord: number;
490
- regionNumber?: number | undefined;
475
+ regionNumber?: number | undefined; /**
476
+ * #property
477
+ */
491
478
  }): number | undefined;
492
479
  } & {
493
480
  setFeatures(features: import("@jbrowse/core/util").Feature[]): void;
494
481
  showAllRegions(): void;
495
- zoomOut(): void; /**
496
- * #property
497
- */
482
+ zoomOut(): void;
498
483
  zoomIn(): void;
499
484
  zoomTo(bpPerPx: number, offset?: number | undefined): number;
500
485
  scrollTo(offsetPx: number): number;
501
- centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
486
+ centerAt(coord: number, refName: string | undefined, regionNumber: number): void; /**
487
+ * #property
488
+ * this represents tracks specific to this view specifically used
489
+ * for read vs ref dotplots where this track would not really apply
490
+ * elsewhere
491
+ */
502
492
  scroll(distance: number): number;
503
493
  } & {
504
494
  moveTo(start?: import("@jbrowse/core/util/Base1DUtils").BpOffset | undefined, end?: import("@jbrowse/core/util/Base1DUtils").BpOffset | undefined): void;
@@ -590,7 +580,7 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
590
580
  /**
591
581
  * #action
592
582
  */
593
- toggleTrack(trackId: string): void;
583
+ toggleTrack(trackId: string): boolean;
594
584
  /**
595
585
  * #action
596
586
  */
@@ -603,9 +593,7 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
603
593
  * #action
604
594
  */
605
595
  getCoords(mousedown: Coord, mouseup: Coord): {
606
- coord: number; /**
607
- * #property
608
- */
596
+ coord: number;
609
597
  index: number;
610
598
  refName: string;
611
599
  oob: boolean;
@@ -4,7 +4,7 @@ import { saveAs } from 'file-saver';
4
4
  import { autorun, transaction } from 'mobx';
5
5
  import { getParentRenderProps } from '@jbrowse/core/util/tracks';
6
6
  import BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel';
7
- import { getSession, isSessionModelWithWidgets, minmax, measureText, max, localStorageGetItem, } from '@jbrowse/core/util';
7
+ import { getSession, isSessionModelWithWidgets, minmax, measureText, max, localStorageGetItem, getTickDisplayStr, } from '@jbrowse/core/util';
8
8
  import { getConf } from '@jbrowse/core/configuration';
9
9
  import { ElementId } from '@jbrowse/core/util/types/mst';
10
10
  // icons
@@ -17,19 +17,22 @@ import { getBlockLabelKeysToHide, makeTicks } from './components/util';
17
17
  // lazies
18
18
  const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
19
19
  const ReturnToImportFormDialog = lazy(() => import('@jbrowse/core/ui/ReturnToImportFormDialog'));
20
- const len = (a) => measureText(a.slice(0, 30));
21
- const pxWidthForBlocks = (blocks, hide) => {
20
+ function stringLenPx(a) {
21
+ return measureText(a.slice(0, 30));
22
+ }
23
+ function pxWidthForBlocks(blocks, bpPerPx, hide) {
22
24
  return max([
23
- ...blocks.filter(b => !hide.has(b.key)).map(b => len(b.refName)),
25
+ ...blocks.filter(b => !hide.has(b.key)).map(b => stringLenPx(b.refName)),
24
26
  ...blocks
25
27
  .filter(b => !hide.has(b.key))
26
- .map(b => len(b.end.toLocaleString('en-us'))),
28
+ .map(b => stringLenPx(getTickDisplayStr(b.end, bpPerPx))),
27
29
  ]);
28
- };
30
+ }
29
31
  /**
30
32
  * #stateModel DotplotView
31
33
  * #category view
32
- * extends `BaseViewModel`
34
+ * extends
35
+ * - [BaseViewModel](../baseviewmodel)
33
36
  */
34
37
  export default function stateModelFactory(pm) {
35
38
  return types
@@ -349,7 +352,9 @@ export default function stateModelFactory(pm) {
349
352
  const hiddenCount = this.hideTrack(trackId);
350
353
  if (!hiddenCount) {
351
354
  this.showTrack(trackId);
355
+ return true;
352
356
  }
357
+ return false;
353
358
  },
354
359
  /**
355
360
  * #action
@@ -530,8 +535,8 @@ export default function stateModelFactory(pm) {
530
535
  const voffset = vview.offsetPx;
531
536
  const vhide = getBlockLabelKeysToHide(vblocks, viewHeight, voffset);
532
537
  const hhide = getBlockLabelKeysToHide(hblocks, viewWidth, hoffset);
533
- const by = pxWidthForBlocks(hblocks, hhide);
534
- const bx = pxWidthForBlocks(vblocks, vhide);
538
+ const by = pxWidthForBlocks(hblocks, vview.bpPerPx, hhide);
539
+ const bx = pxWidthForBlocks(vblocks, hview.bpPerPx, vhide);
535
540
  // these are set via autorun to avoid dependency cycle
536
541
  self.setBorderY(Math.max(by + padding, 50));
537
542
  self.setBorderX(Math.max(bx + padding, 50));