@jbrowse/plugin-dotplot-view 2.6.2 → 2.7.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.
Files changed (68) hide show
  1. package/dist/DotplotDisplay/components/DotplotDisplay.d.ts +3 -4
  2. package/dist/DotplotDisplay/components/DotplotDisplay.js +3 -3
  3. package/dist/DotplotDisplay/stateModelFactory.d.ts +4 -4
  4. package/dist/DotplotDisplay/stateModelFactory.js +3 -3
  5. package/dist/DotplotRenderer/DotplotRenderer.js +12 -4
  6. package/dist/DotplotRenderer/components/DotplotRendering.d.ts +2 -3
  7. package/dist/DotplotRenderer/components/DotplotRendering.js +3 -3
  8. package/dist/DotplotView/blockTypes.d.ts +1 -9
  9. package/dist/DotplotView/blockTypes.js +2 -15
  10. package/dist/DotplotView/components/Axes.js +37 -35
  11. package/dist/DotplotView/components/DotplotControls.d.ts +6 -0
  12. package/dist/DotplotView/components/DotplotControls.js +94 -0
  13. package/dist/DotplotView/components/DotplotTooltip.d.ts +0 -1
  14. package/dist/DotplotView/components/DotplotTooltip.js +1 -2
  15. package/dist/DotplotView/components/DotplotWarnings.d.ts +2 -2
  16. package/dist/DotplotView/components/DotplotWarnings.js +2 -1
  17. package/dist/DotplotView/components/Header.d.ts +2 -2
  18. package/dist/DotplotView/components/Header.js +5 -120
  19. package/dist/DotplotView/components/ImportCustomTrack.d.ts +1 -1
  20. package/dist/DotplotView/components/ImportCustomTrack.js +1 -1
  21. package/dist/DotplotView/components/ImportSyntenyTrackSelector.js +4 -1
  22. package/dist/DotplotView/components/PanButtons.d.ts +2 -2
  23. package/dist/DotplotView/components/PanButtons.js +2 -1
  24. package/dist/DotplotView/components/WarningDialog.d.ts +2 -2
  25. package/dist/DotplotView/components/WarningDialog.js +2 -1
  26. package/dist/DotplotView/components/util.js +2 -5
  27. package/dist/DotplotView/model.d.ts +74 -45
  28. package/dist/DotplotView/model.js +15 -4
  29. package/dist/DotplotView/svgcomponents/SVGBackground.js +2 -1
  30. package/dist/ServerSideRenderedBlockContent.d.ts +2 -2
  31. package/dist/ServerSideRenderedBlockContent.js +2 -1
  32. package/dist/ServerSideSyntenyRendering.d.ts +11 -16
  33. package/dist/ServerSideSyntenyRendering.js +3 -11
  34. package/esm/DotplotDisplay/components/DotplotDisplay.d.ts +3 -4
  35. package/esm/DotplotDisplay/components/DotplotDisplay.js +3 -3
  36. package/esm/DotplotDisplay/stateModelFactory.d.ts +4 -4
  37. package/esm/DotplotDisplay/stateModelFactory.js +3 -3
  38. package/esm/DotplotRenderer/DotplotRenderer.js +12 -4
  39. package/esm/DotplotRenderer/components/DotplotRendering.d.ts +2 -3
  40. package/esm/DotplotRenderer/components/DotplotRendering.js +3 -3
  41. package/esm/DotplotView/blockTypes.d.ts +1 -9
  42. package/esm/DotplotView/blockTypes.js +2 -15
  43. package/esm/DotplotView/components/Axes.js +37 -35
  44. package/esm/DotplotView/components/DotplotControls.d.ts +6 -0
  45. package/esm/DotplotView/components/DotplotControls.js +89 -0
  46. package/esm/DotplotView/components/DotplotTooltip.d.ts +0 -1
  47. package/esm/DotplotView/components/DotplotTooltip.js +1 -1
  48. package/esm/DotplotView/components/DotplotView.js +1 -1
  49. package/esm/DotplotView/components/DotplotWarnings.d.ts +2 -2
  50. package/esm/DotplotView/components/DotplotWarnings.js +2 -1
  51. package/esm/DotplotView/components/Header.d.ts +2 -2
  52. package/esm/DotplotView/components/Header.js +5 -97
  53. package/esm/DotplotView/components/ImportCustomTrack.d.ts +1 -1
  54. package/esm/DotplotView/components/ImportCustomTrack.js +1 -1
  55. package/esm/DotplotView/components/ImportSyntenyTrackSelector.js +4 -1
  56. package/esm/DotplotView/components/PanButtons.d.ts +2 -2
  57. package/esm/DotplotView/components/PanButtons.js +2 -1
  58. package/esm/DotplotView/components/WarningDialog.d.ts +2 -2
  59. package/esm/DotplotView/components/WarningDialog.js +2 -1
  60. package/esm/DotplotView/components/util.js +2 -5
  61. package/esm/DotplotView/model.d.ts +74 -45
  62. package/esm/DotplotView/model.js +15 -4
  63. package/esm/DotplotView/svgcomponents/SVGBackground.js +2 -1
  64. package/esm/ServerSideRenderedBlockContent.d.ts +2 -2
  65. package/esm/ServerSideRenderedBlockContent.js +2 -1
  66. package/esm/ServerSideSyntenyRendering.d.ts +11 -16
  67. package/esm/ServerSideSyntenyRendering.js +4 -12
  68. package/package.json +3 -3
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
  import { DotplotDisplayModel } from '../stateModelFactory';
3
- declare function DotplotDisplay(props: {
3
+ declare const DotplotDisplay: (props: {
4
4
  model: DotplotDisplayModel;
5
5
  children?: React.ReactNode;
6
- }): React.JSX.Element;
7
- declare const _default: typeof DotplotDisplay;
8
- export default _default;
6
+ }) => React.JSX.Element;
7
+ export default DotplotDisplay;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
7
  const mobx_react_1 = require("mobx-react");
8
8
  const util_1 = require("@jbrowse/core/util");
9
- function DotplotDisplay(props) {
9
+ const DotplotDisplay = (0, mobx_react_1.observer)(function DotplotDisplay(props) {
10
10
  const { model, children } = props;
11
11
  const { offsetX = 0, offsetY = 0 } = model.data || {};
12
12
  const view = (0, util_1.getContainingView)(model);
@@ -19,5 +19,5 @@ function DotplotDisplay(props) {
19
19
  left,
20
20
  } }),
21
21
  children));
22
- }
23
- exports.default = (0, mobx_react_1.observer)(DotplotDisplay);
22
+ });
23
+ exports.default = DotplotDisplay;
@@ -50,7 +50,9 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
50
50
  }>;
51
51
  readonly DisplayBlurb: React.FC<{
52
52
  model: {
53
- id: string;
53
+ id: string; /**
54
+ * #getter
55
+ */
54
56
  type: string;
55
57
  rpcDriverName: string | undefined;
56
58
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
@@ -72,9 +74,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
72
74
  renderProps(): any;
73
75
  readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
74
76
  readonly DisplayMessageComponent: React.FC<any> | undefined;
75
- trackMenuItems(): import("@jbrowse/core/ui").MenuItem[]; /**
76
- * #action
77
- */
77
+ trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
78
78
  readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
79
79
  regionCannotBeRendered(): null;
80
80
  } & {
@@ -43,9 +43,9 @@ function stateModelFactory(configSchema) {
43
43
  })))
44
44
  .views(self => ({
45
45
  get shouldDisplay() {
46
- const view = (0, util_1.getContainingView)(self);
47
- return (view.vview.bpPerPx === self.data.bpPerPxY &&
48
- view.hview.bpPerPx === self.data.bpPerPxX);
46
+ const { vview, hview } = (0, util_1.getContainingView)(self);
47
+ return (vview.bpPerPx === self.data.bpPerPxY &&
48
+ hview.bpPerPx === self.data.bpPerPxX);
49
49
  },
50
50
  /**
51
51
  * #getter
@@ -48,7 +48,7 @@ class DotplotRenderer extends ComparativeServerSideRendererType_1.default {
48
48
  return args;
49
49
  }
50
50
  async drawDotplot(ctx, props) {
51
- var _a, _b, _c;
51
+ var _a, _b;
52
52
  const { config, views, height, drawCigar, theme } = props;
53
53
  const color = (0, configuration_1.readConfObject)(config, 'color');
54
54
  const posColor = (0, configuration_1.readConfObject)(config, 'posColor');
@@ -132,7 +132,7 @@ class DotplotRenderer extends ComparativeServerSideRendererType_1.default {
132
132
  width: vview.width,
133
133
  };
134
134
  const t = (0, ui_1.createJBrowseTheme)(theme);
135
- (_c = hview.features) === null || _c === void 0 ? void 0 : _c.forEach(feature => {
135
+ for (const feature of hview.features || []) {
136
136
  const strand = feature.get('strand') || 1;
137
137
  const start = strand === 1 ? feature.get('start') : feature.get('end');
138
138
  const end = strand === 1 ? feature.get('end') : feature.get('start');
@@ -190,6 +190,8 @@ class DotplotRenderer extends ComparativeServerSideRendererType_1.default {
190
190
  const cigarOps = parseCigar(cigar);
191
191
  ctx.beginPath();
192
192
  ctx.moveTo(currX, height - currY);
193
+ let lastDrawnX = currX;
194
+ let lastDrawnY = currX;
193
195
  for (let i = 0; i < cigarOps.length; i += 2) {
194
196
  const val = +cigarOps[i];
195
197
  const op = cigarOps[i + 1];
@@ -205,7 +207,13 @@ class DotplotRenderer extends ComparativeServerSideRendererType_1.default {
205
207
  }
206
208
  currX = clampWithWarnX(currX, b1, b2, feature);
207
209
  currY = clampWithWarnY(currY, e1, e2, feature);
208
- ctx.lineTo(currX, height - currY);
210
+ // only draw a line segment if it is bigger than 0.5px
211
+ if (Math.abs(currX - lastDrawnX) > 0.5 ||
212
+ Math.abs(currY - lastDrawnY) > 0.5) {
213
+ ctx.lineTo(currX, height - currY);
214
+ lastDrawnX = currX;
215
+ lastDrawnY = currY;
216
+ }
209
217
  }
210
218
  ctx.stroke();
211
219
  }
@@ -233,7 +241,7 @@ class DotplotRenderer extends ComparativeServerSideRendererType_1.default {
233
241
  }
234
242
  }
235
243
  }
236
- });
244
+ }
237
245
  return { warnings };
238
246
  }
239
247
  async render(renderProps) {
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
2
  import { DotplotRenderArgsDeserialized } from '../DotplotRenderer';
3
- declare function DotplotRendering(props: DotplotRenderArgsDeserialized): React.JSX.Element;
4
- declare const _default: typeof DotplotRendering;
5
- export default _default;
3
+ declare const DotplotRendering: (props: DotplotRenderArgsDeserialized) => React.JSX.Element;
4
+ export default DotplotRendering;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
7
  const ui_1 = require("@jbrowse/core/ui");
8
8
  const mobx_react_1 = require("mobx-react");
9
- function DotplotRendering(props) {
9
+ const DotplotRendering = (0, mobx_react_1.observer)(function (props) {
10
10
  return react_1.default.createElement(ui_1.PrerenderedCanvas, { ...props });
11
- }
12
- exports.default = (0, mobx_react_1.observer)(DotplotRendering);
11
+ });
12
+ exports.default = DotplotRendering;
@@ -23,15 +23,7 @@ export declare class BaseBlock {
23
23
  /**
24
24
  * a block that should be shown as filled with data
25
25
  */
26
- constructor(data: any);
27
- /**
28
- * rename the reference sequence of this block and return a new one
29
- *
30
- * @param refName -
31
- * @returns either a new block with a renamed reference sequence,
32
- * or the same block, if the ref name is not actually different
33
- */
34
- renameReference(refName: string): any;
26
+ constructor(data: Record<string, any>);
35
27
  toRegion(): {
36
28
  refName: string;
37
29
  start: number;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InterRegionPaddingBlock = exports.ElidedBlock = exports.ContentBlock = exports.BaseBlock = exports.BlockSet = void 0;
4
+ const util_1 = require("@jbrowse/core/util");
4
5
  class BlockSet {
5
6
  constructor(blocks = []) {
6
7
  this.blocks = blocks;
@@ -31,7 +32,7 @@ class BlockSet {
31
32
  }
32
33
  get totalWidthPx() {
33
34
  return this.blocks.length
34
- ? this.blocks.map(blocks => blocks.widthPx).reduce((a, b) => a + b)
35
+ ? (0, util_1.sum)(this.blocks.map(blocks => blocks.widthPx))
35
36
  : 0;
36
37
  }
37
38
  get offsetPx() {
@@ -57,20 +58,6 @@ class BaseBlock {
57
58
  this.end = data.end;
58
59
  this.key = data.key;
59
60
  }
60
- /**
61
- * rename the reference sequence of this block and return a new one
62
- *
63
- * @param refName -
64
- * @returns either a new block with a renamed reference sequence,
65
- * or the same block, if the ref name is not actually different
66
- */
67
- renameReference(refName) {
68
- if (this.refName && refName !== this.refName) {
69
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
- return new this.constructor({ ...this, refName });
71
- }
72
- return this;
73
- }
74
61
  toRegion() {
75
62
  return {
76
63
  refName: this.refName,
@@ -44,6 +44,20 @@ exports.HorizontalAxisRaw = (0, mobx_react_1.observer)(function ({ model, }) {
44
44
  width,
45
45
  staticBlocks: hview.staticBlocks,
46
46
  };
47
+ const ticks = hticks
48
+ .map(tick => {
49
+ var _a;
50
+ return [
51
+ tick,
52
+ (_a = (0, Base1DUtils_1.bpToPx)({
53
+ refName: tick.refName,
54
+ coord: tick.base,
55
+ self: hviewSnap,
56
+ })) === null || _a === void 0 ? void 0 : _a.offsetPx,
57
+ ];
58
+ })
59
+ .filter(f => f[1] !== undefined)
60
+ .map(f => [f[0], f[1] - offsetPx]);
47
61
  return (react_1.default.createElement(react_1.default.Fragment, null,
48
62
  dblocks
49
63
  .filter(region => !hide.has(region.key))
@@ -53,24 +67,12 @@ exports.HorizontalAxisRaw = (0, mobx_react_1.observer)(function ({ model, }) {
53
67
  const xoff = Math.floor(x - hview.offsetPx);
54
68
  return (react_1.default.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));
55
69
  }),
56
- hticks.map(tick => {
57
- var _a;
58
- const x = (((_a = (0, Base1DUtils_1.bpToPx)({
59
- refName: tick.refName,
60
- coord: tick.base,
61
- self: hviewSnap,
62
- })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - offsetPx;
63
- return (react_1.default.createElement("line", { key: `line-${JSON.stringify(tick)}`, x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, stroke: theme.palette.divider }));
70
+ ticks.map(([tick, x]) => {
71
+ return (react_1.default.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] }));
64
72
  }),
65
- hticks
66
- .filter(tick => tick.type === 'major')
67
- .map(tick => {
68
- var _a;
69
- const x = (((_a = (0, Base1DUtils_1.bpToPx)({
70
- refName: tick.refName,
71
- coord: tick.base,
72
- self: hviewSnap,
73
- })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - offsetPx;
73
+ ticks
74
+ .filter(t => t[0].type === 'major')
75
+ .map(([tick, x]) => {
74
76
  const y = 0;
75
77
  return x > 10 ? (react_1.default.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" }, (0, util_1.getTickDisplayStr)(tick.base + 1, bpPerPx))) : null;
76
78
  }),
@@ -93,6 +95,20 @@ exports.VerticalAxisRaw = (0, mobx_react_1.observer)(function ({ model, }) {
93
95
  width,
94
96
  staticBlocks: vview.staticBlocks,
95
97
  };
98
+ const ticks = vticks
99
+ .map(tick => {
100
+ var _a;
101
+ return [
102
+ tick,
103
+ (_a = (0, Base1DUtils_1.bpToPx)({
104
+ refName: tick.refName,
105
+ coord: tick.base,
106
+ self: vviewSnap,
107
+ })) === null || _a === void 0 ? void 0 : _a.offsetPx,
108
+ ];
109
+ })
110
+ .filter(f => f[1] !== undefined)
111
+ .map(f => [f[0], f[1] - offsetPx]);
96
112
  return (react_1.default.createElement(react_1.default.Fragment, null,
97
113
  dblocks
98
114
  .filter(region => !hide.has(region.key))
@@ -102,24 +118,10 @@ exports.VerticalAxisRaw = (0, mobx_react_1.observer)(function ({ model, }) {
102
118
  const yoff = Math.floor(viewHeight - y + offsetPx);
103
119
  return (react_1.default.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));
104
120
  }),
105
- vticks.map(tick => {
106
- var _a;
107
- const y = (((_a = (0, Base1DUtils_1.bpToPx)({
108
- refName: tick.refName,
109
- coord: tick.base,
110
- self: vviewSnap,
111
- })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - offsetPx;
112
- return (react_1.default.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.divider }));
113
- }),
114
- vticks
115
- .filter(tick => tick.type === 'major')
116
- .map(tick => {
117
- var _a;
118
- const y = (((_a = (0, Base1DUtils_1.bpToPx)({
119
- refName: tick.refName,
120
- coord: tick.base,
121
- self: vviewSnap,
122
- })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - offsetPx;
121
+ ticks.map(([tick, y]) => (react_1.default.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] }))),
122
+ ticks
123
+ .filter(t => t[0].type === 'major')
124
+ .map(([tick, y]) => {
123
125
  return y > 10 ? (react_1.default.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 }, (0, util_1.getTickDisplayStr)(tick.base + 1, bpPerPx))) : null;
124
126
  }),
125
127
  react_1.default.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(','))));
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { DotplotViewModel } from '../model';
3
+ declare const DotplotControls: ({ model, }: {
4
+ model: DotplotViewModel;
5
+ }) => React.JSX.Element;
6
+ export default DotplotControls;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const material_1 = require("@mui/material");
8
+ const mobx_react_1 = require("mobx-react");
9
+ const CascadingMenuButton_1 = __importDefault(require("@jbrowse/core/ui/CascadingMenuButton"));
10
+ // icons
11
+ const ZoomOut_1 = __importDefault(require("@mui/icons-material/ZoomOut"));
12
+ const ZoomIn_1 = __importDefault(require("@mui/icons-material/ZoomIn"));
13
+ const MoreVert_1 = __importDefault(require("@mui/icons-material/MoreVert"));
14
+ const CursorIcon_1 = require("./CursorIcon");
15
+ const Icons_1 = require("@jbrowse/core/ui/Icons");
16
+ const DotplotControls = (0, mobx_react_1.observer)(function ({ model, }) {
17
+ return (react_1.default.createElement("div", null,
18
+ react_1.default.createElement(material_1.IconButton, { onClick: model.zoomOutButton },
19
+ react_1.default.createElement(ZoomOut_1.default, null)),
20
+ react_1.default.createElement(material_1.IconButton, { onClick: model.zoomInButton },
21
+ react_1.default.createElement(ZoomIn_1.default, null)),
22
+ react_1.default.createElement(material_1.IconButton, { onClick: () => model.activateTrackSelector(), title: "Open track selector" },
23
+ react_1.default.createElement(Icons_1.TrackSelector, null)),
24
+ react_1.default.createElement(CascadingMenuButton_1.default, { menuItems: [
25
+ {
26
+ onClick: () => model.squareView(),
27
+ label: 'Square view - same base pairs per pixel',
28
+ },
29
+ {
30
+ onClick: () => model.squareViewProportional(),
31
+ label: 'Rectanglularize view - same total bp',
32
+ },
33
+ {
34
+ onClick: () => model.showAllRegions(),
35
+ label: 'Show all regions',
36
+ },
37
+ {
38
+ onClick: () => model.setDrawCigar(!model.drawCigar),
39
+ type: 'checkbox',
40
+ label: 'Draw CIGAR',
41
+ checked: model.drawCigar,
42
+ },
43
+ {
44
+ onClick: () => model.setShowPanButtons(!model.showPanButtons),
45
+ label: 'Show pan buttons',
46
+ type: 'checkbox',
47
+ checked: model.showPanButtons,
48
+ },
49
+ {
50
+ label: 'Click and drag mode',
51
+ subMenu: [
52
+ {
53
+ onClick: () => model.setCursorMode('move'),
54
+ label: 'Pan by default, select region when ctrl key is held',
55
+ icon: CursorIcon_1.CursorMove,
56
+ type: 'radio',
57
+ checked: model.cursorMode === 'move',
58
+ },
59
+ {
60
+ onClick: () => model.setCursorMode('crosshair'),
61
+ label: 'Select region by default, pan when ctrl key is held',
62
+ icon: CursorIcon_1.CursorMouse,
63
+ type: 'radio',
64
+ checked: model.cursorMode === 'crosshair',
65
+ },
66
+ ],
67
+ },
68
+ {
69
+ label: 'Wheel scroll mode',
70
+ subMenu: [
71
+ {
72
+ onClick: () => model.setWheelMode('pan'),
73
+ label: 'Pans view',
74
+ type: 'radio',
75
+ checked: model.wheelMode === 'pan',
76
+ },
77
+ {
78
+ onClick: () => model.setWheelMode('zoom'),
79
+ label: 'Zooms view',
80
+ type: 'radio',
81
+ checked: model.wheelMode === 'zoom',
82
+ },
83
+ {
84
+ onClick: () => model.setWheelMode('none'),
85
+ label: 'Disable',
86
+ type: 'radio',
87
+ checked: model.wheelMode === 'none',
88
+ },
89
+ ],
90
+ },
91
+ ] },
92
+ react_1.default.createElement(MoreVert_1.default, null))));
93
+ });
94
+ exports.default = DotplotControls;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { DotplotViewModel } from '../model';
3
- export declare function round(value: number): number;
4
3
  type Coord = [number, number] | undefined;
5
4
  export declare const TooltipWhereMouseovered: ({ model, mouserect, mouserectClient, xdistance, ydistance, }: {
6
5
  model: DotplotViewModel;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.TooltipWhereClicked = exports.TooltipWhereMouseovered = exports.round = void 0;
26
+ exports.TooltipWhereClicked = exports.TooltipWhereMouseovered = void 0;
27
27
  const react_1 = __importStar(require("react"));
28
28
  const mobx_react_1 = require("mobx-react");
29
29
  const mui_1 = require("tss-react/mui");
@@ -33,7 +33,6 @@ const react_popper_1 = require("react-popper");
33
33
  function round(value) {
34
34
  return Math.round(value * 1e5) / 1e5;
35
35
  }
36
- exports.round = round;
37
36
  const useStyles = (0, mui_1.makeStyles)()(theme => ({
38
37
  // these styles come from
39
38
  // https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Tooltip/Tooltip.js
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { DotplotViewModel } from '../model';
3
- declare const _default: ({ model }: {
3
+ declare const DotplotWarnings: ({ model, }: {
4
4
  model: DotplotViewModel;
5
5
  }) => React.JSX.Element | null;
6
- export default _default;
6
+ export default DotplotWarnings;
@@ -28,7 +28,7 @@ const material_1 = require("@mui/material");
28
28
  const mobx_react_1 = require("mobx-react");
29
29
  // lazy components
30
30
  const WarningDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./WarningDialog'))));
31
- exports.default = (0, mobx_react_1.observer)(function ({ model }) {
31
+ const DotplotWarnings = (0, mobx_react_1.observer)(function ({ model, }) {
32
32
  const trackWarnings = model.tracks.filter(t => { var _a; return (_a = t.displays[0].warnings) === null || _a === void 0 ? void 0 : _a.length; });
33
33
  const [shown, setShown] = (0, react_1.useState)(false);
34
34
  return trackWarnings.length ? (react_1.default.createElement(material_1.Alert, { severity: "warning" },
@@ -37,3 +37,4 @@ exports.default = (0, mobx_react_1.observer)(function ({ model }) {
37
37
  react_1.default.createElement(material_1.Button, { onClick: () => setShown(true) }, "More info"),
38
38
  shown ? (react_1.default.createElement(WarningDialog, { trackWarnings: trackWarnings, handleClose: () => setShown(false) })) : null)) : null;
39
39
  });
40
+ exports.default = DotplotWarnings;
@@ -1,10 +1,10 @@
1
1
  import React from 'react';
2
2
  import { DotplotViewModel } from '../model';
3
- declare const _default: ({ model, selection, }: {
3
+ declare const DotplotHeader: ({ model, selection, }: {
4
4
  model: DotplotViewModel;
5
5
  selection?: {
6
6
  width: number;
7
7
  height: number;
8
8
  } | undefined;
9
9
  }) => React.JSX.Element;
10
- export default _default;
10
+ export default DotplotHeader;
@@ -1,49 +1,17 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const react_1 = __importStar(require("react"));
6
+ const react_1 = __importDefault(require("react"));
30
7
  const material_1 = require("@mui/material");
31
8
  const mobx_react_1 = require("mobx-react");
32
9
  const mui_1 = require("tss-react/mui");
33
10
  const util_1 = require("@jbrowse/core/util");
34
- const ui_1 = require("@jbrowse/core/ui");
35
- // icons
36
- const ZoomOut_1 = __importDefault(require("@mui/icons-material/ZoomOut"));
37
- const ZoomIn_1 = __importDefault(require("@mui/icons-material/ZoomIn"));
38
- const MoreVert_1 = __importDefault(require("@mui/icons-material/MoreVert"));
39
- const CursorIcon_1 = require("./CursorIcon");
40
- const Icons_1 = require("@jbrowse/core/ui/Icons");
41
11
  const DotplotWarnings_1 = __importDefault(require("./DotplotWarnings"));
42
12
  const PanButtons_1 = __importDefault(require("./PanButtons"));
13
+ const DotplotControls_1 = __importDefault(require("./DotplotControls"));
43
14
  const useStyles = (0, mui_1.makeStyles)()({
44
- iconButton: {
45
- margin: 5,
46
- },
47
15
  bp: {
48
16
  display: 'flex',
49
17
  alignItems: 'center',
@@ -57,95 +25,11 @@ const useStyles = (0, mui_1.makeStyles)()({
57
25
  position: 'relative',
58
26
  },
59
27
  });
60
- const DotplotControls = (0, mobx_react_1.observer)(({ model }) => {
61
- const { classes } = useStyles();
62
- const [menuAnchorEl, setMenuAnchorEl] = (0, react_1.useState)();
63
- return (react_1.default.createElement("div", null,
64
- react_1.default.createElement(material_1.IconButton, { onClick: model.zoomOutButton, className: classes.iconButton },
65
- react_1.default.createElement(ZoomOut_1.default, null)),
66
- react_1.default.createElement(material_1.IconButton, { onClick: model.zoomInButton, className: classes.iconButton },
67
- react_1.default.createElement(ZoomIn_1.default, null)),
68
- react_1.default.createElement(material_1.IconButton, { onClick: () => model.activateTrackSelector(), className: classes.iconButton, title: "Open track selector", "data-testid": "circular_track_select" },
69
- react_1.default.createElement(Icons_1.TrackSelector, null)),
70
- react_1.default.createElement(material_1.IconButton, { onClick: event => setMenuAnchorEl(event.currentTarget), className: classes.iconButton },
71
- react_1.default.createElement(MoreVert_1.default, null)),
72
- menuAnchorEl ? (react_1.default.createElement(ui_1.Menu, { anchorEl: menuAnchorEl, open: true, onMenuItemClick: (_event, callback) => {
73
- callback();
74
- setMenuAnchorEl(undefined);
75
- }, menuItems: [
76
- {
77
- onClick: () => model.squareView(),
78
- label: 'Square view - same base pairs per pixel',
79
- },
80
- {
81
- onClick: () => model.squareViewProportional(),
82
- label: 'Rectanglularize view - same total bp',
83
- },
84
- {
85
- onClick: () => model.showAllRegions(),
86
- label: 'Show all regions',
87
- },
88
- {
89
- onClick: () => model.setDrawCigar(!model.drawCigar),
90
- type: 'checkbox',
91
- label: 'Draw CIGAR',
92
- checked: model.drawCigar,
93
- },
94
- {
95
- onClick: () => model.setShowPanButtons(!model.showPanButtons),
96
- label: 'Show pan buttons',
97
- type: 'checkbox',
98
- checked: model.showPanButtons,
99
- },
100
- {
101
- label: 'Click and drag mode',
102
- subMenu: [
103
- {
104
- onClick: () => model.setCursorMode('move'),
105
- label: 'Pan by default, select region when ctrl key is held',
106
- icon: CursorIcon_1.CursorMove,
107
- type: 'radio',
108
- checked: model.cursorMode === 'move',
109
- },
110
- {
111
- onClick: () => model.setCursorMode('crosshair'),
112
- label: 'Select region by default, pan when ctrl key is held',
113
- icon: CursorIcon_1.CursorMouse,
114
- type: 'radio',
115
- checked: model.cursorMode === 'crosshair',
116
- },
117
- ],
118
- },
119
- {
120
- label: 'Wheel scroll mode',
121
- subMenu: [
122
- {
123
- onClick: () => model.setWheelMode('pan'),
124
- label: 'Pans view',
125
- type: 'radio',
126
- checked: model.wheelMode === 'pan',
127
- },
128
- {
129
- onClick: () => model.setWheelMode('zoom'),
130
- label: 'Zooms view',
131
- type: 'radio',
132
- checked: model.wheelMode === 'zoom',
133
- },
134
- {
135
- onClick: () => model.setWheelMode('none'),
136
- label: 'Disable',
137
- type: 'radio',
138
- checked: model.wheelMode === 'none',
139
- },
140
- ],
141
- },
142
- ], onClose: () => setMenuAnchorEl(undefined) })) : null));
143
- });
144
- exports.default = (0, mobx_react_1.observer)(function Header({ model, selection, }) {
28
+ const DotplotHeader = (0, mobx_react_1.observer)(function ({ model, selection, }) {
145
29
  const { classes } = useStyles();
146
30
  const { hview, vview, showPanButtons } = model;
147
31
  return (react_1.default.createElement("div", { className: classes.headerBar },
148
- react_1.default.createElement(DotplotControls, { model: model }),
32
+ react_1.default.createElement(DotplotControls_1.default, { model: model }),
149
33
  react_1.default.createElement(material_1.Typography, { className: classes.bp, variant: "body2", color: "textSecondary" },
150
34
  "x: ",
151
35
  hview.assemblyNames.join(','),
@@ -165,3 +49,4 @@ exports.default = (0, mobx_react_1.observer)(function Header({ model, selection,
165
49
  react_1.default.createElement(DotplotWarnings_1.default, { model: model }),
166
50
  showPanButtons ? react_1.default.createElement(PanButtons_1.default, { model: model }) : null));
167
51
  });
52
+ exports.default = DotplotHeader;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { SnapshotIn } from 'mobx-state-tree';
3
3
  import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
4
  type Conf = SnapshotIn<AnyConfigurationModel>;
5
- declare const OpenTrack: ({ sessionTrackData, assembly1, assembly2, setSessionTrackData, }: {
5
+ declare const OpenTrack: ({ assembly1, assembly2, setSessionTrackData, }: {
6
6
  sessionTrackData: Conf;
7
7
  assembly1: string;
8
8
  assembly2: string;
@@ -99,7 +99,7 @@ function getAdapter({ radioOption, assembly1, assembly2, fileLocation, bed1Locat
99
99
  throw new Error('Unknown type');
100
100
  }
101
101
  }
102
- const OpenTrack = (0, mobx_react_1.observer)(({ sessionTrackData, assembly1, assembly2, setSessionTrackData, }) => {
102
+ const OpenTrack = (0, mobx_react_1.observer)(({ assembly1, assembly2, setSessionTrackData, }) => {
103
103
  const [bed2Location, setBed2Location] = (0, react_1.useState)();
104
104
  const [bed1Location, setBed1Location] = (0, react_1.useState)();
105
105
  const [fileLocation, setFileLocation] = (0, react_1.useState)();
@@ -42,7 +42,10 @@ const Selector = (0, mobx_react_1.observer)(({ model, assembly1, assembly2, setS
42
42
  var _a;
43
43
  const session = (0, util_1.getSession)(model);
44
44
  const { tracks, sessionTracks } = session;
45
- const allTracks = [...tracks, ...sessionTracks];
45
+ const allTracks = [
46
+ ...tracks,
47
+ ...(sessionTracks || []),
48
+ ];
46
49
  const filteredTracks = allTracks.filter(t => f(t, assembly2, assembly1));
47
50
  const resetTrack = ((_a = filteredTracks[0]) === null || _a === void 0 ? void 0 : _a.trackId) || '';
48
51
  const [value, setValue] = (0, react_1.useState)(resetTrack);