@jbrowse/plugin-linear-comparative-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.
Files changed (231) hide show
  1. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +6 -5
  2. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +36 -60
  3. package/dist/LGVSyntenyDisplay/components/util.d.ts +9 -6
  4. package/dist/LGVSyntenyDisplay/components/util.js +6 -13
  5. package/dist/LGVSyntenyDisplay/configSchemaF.d.ts +19 -10
  6. package/dist/LGVSyntenyDisplay/configSchemaF.js +12 -9
  7. package/dist/LGVSyntenyDisplay/index.d.ts +1 -1
  8. package/dist/LGVSyntenyDisplay/index.js +1 -1
  9. package/dist/LGVSyntenyDisplay/model.d.ts +122 -69
  10. package/dist/LGVSyntenyDisplay/model.js +20 -37
  11. package/dist/LaunchLinearSyntenyView.d.ts +1 -1
  12. package/dist/LaunchLinearSyntenyView.js +1 -3
  13. package/dist/LinearComparativeDisplay/configSchemaF.d.ts +0 -3
  14. package/dist/LinearComparativeDisplay/configSchemaF.js +0 -6
  15. package/dist/LinearComparativeDisplay/index.d.ts +1 -1
  16. package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +12 -69
  17. package/dist/LinearComparativeDisplay/stateModelFactory.js +13 -57
  18. package/dist/LinearComparativeView/components/Header.d.ts +2 -3
  19. package/dist/LinearComparativeView/components/Header.js +56 -86
  20. package/dist/LinearComparativeView/components/HeaderSearchBoxes.d.ts +2 -3
  21. package/dist/LinearComparativeView/components/HeaderSearchBoxes.js +5 -15
  22. package/dist/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +2 -3
  23. package/dist/LinearComparativeView/components/LinearComparativeRenderArea.js +17 -32
  24. package/dist/LinearComparativeView/components/LinearComparativeView.d.ts +2 -3
  25. package/dist/LinearComparativeView/components/LinearComparativeView.js +4 -9
  26. package/dist/LinearComparativeView/components/Rubberband.d.ts +2 -3
  27. package/dist/LinearComparativeView/components/Rubberband.js +36 -69
  28. package/dist/LinearComparativeView/components/VerticalGuide.d.ts +2 -3
  29. package/dist/LinearComparativeView/components/VerticalGuide.js +5 -9
  30. package/dist/LinearComparativeView/index.d.ts +1 -1
  31. package/dist/LinearComparativeView/index.js +17 -7
  32. package/dist/LinearComparativeView/model.d.ts +38 -90
  33. package/dist/LinearComparativeView/model.js +40 -107
  34. package/dist/LinearReadVsRef/LinearReadVsRef.d.ts +2 -3
  35. package/dist/LinearReadVsRef/LinearReadVsRef.js +10 -55
  36. package/dist/LinearReadVsRef/index.d.ts +1 -1
  37. package/dist/LinearReadVsRef/index.js +17 -9
  38. package/dist/LinearSyntenyDisplay/afterAttach.d.ts +1 -1
  39. package/dist/LinearSyntenyDisplay/afterAttach.js +8 -12
  40. package/dist/LinearSyntenyDisplay/components/Component.d.ts +2 -3
  41. package/dist/LinearSyntenyDisplay/components/Component.js +11 -36
  42. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.d.ts +2 -3
  43. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +95 -106
  44. package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.d.ts +3 -4
  45. package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.js +3 -6
  46. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.d.ts +1 -2
  47. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +3 -4
  48. package/dist/LinearSyntenyDisplay/components/util.d.ts +3 -3
  49. package/dist/LinearSyntenyDisplay/components/util.js +0 -9
  50. package/dist/LinearSyntenyDisplay/configSchemaF.d.ts +1 -12
  51. package/dist/LinearSyntenyDisplay/configSchemaF.js +0 -15
  52. package/dist/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
  53. package/dist/LinearSyntenyDisplay/drawSynteny.js +1 -23
  54. package/dist/LinearSyntenyDisplay/index.d.ts +1 -1
  55. package/dist/LinearSyntenyDisplay/index.js +18 -9
  56. package/dist/LinearSyntenyDisplay/model.d.ts +8 -102
  57. package/dist/LinearSyntenyDisplay/model.js +18 -99
  58. package/dist/LinearSyntenyView/components/ExportSvgDialog.d.ts +2 -3
  59. package/dist/LinearSyntenyView/components/ExportSvgDialog.js +35 -76
  60. package/dist/LinearSyntenyView/components/Icons.d.ts +3 -4
  61. package/dist/LinearSyntenyView/components/Icons.js +3 -8
  62. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +8 -0
  63. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +130 -0
  64. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyPreConfigured.d.ts +8 -0
  65. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyPreConfigured.js +39 -0
  66. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelectorArea.d.ts +7 -0
  67. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelectorArea.js +22 -0
  68. package/dist/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.d.ts +2 -3
  69. package/dist/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +49 -150
  70. package/dist/LinearSyntenyView/components/ImportForm/doSubmit.d.ts +5 -0
  71. package/dist/LinearSyntenyView/components/ImportForm/doSubmit.js +43 -0
  72. package/dist/LinearSyntenyView/components/ImportForm/getAdapter.d.ts +117 -0
  73. package/dist/LinearSyntenyView/components/ImportForm/getAdapter.js +68 -0
  74. package/dist/LinearSyntenyView/components/ImportForm/util.js +1 -3
  75. package/dist/LinearSyntenyView/components/LinearSyntenyView.d.ts +2 -3
  76. package/dist/LinearSyntenyView/components/LinearSyntenyView.js +20 -10
  77. package/dist/LinearSyntenyView/index.d.ts +1 -1
  78. package/dist/LinearSyntenyView/index.js +17 -7
  79. package/dist/LinearSyntenyView/model.d.ts +54 -58
  80. package/dist/LinearSyntenyView/model.js +61 -56
  81. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.d.ts +1 -2
  82. package/dist/LinearSyntenyView/svgcomponents/SVGBackground.js +3 -6
  83. package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +2 -3
  84. package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +3 -11
  85. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -1
  86. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +7 -24
  87. package/dist/LinearSyntenyView/types.d.ts +12 -0
  88. package/dist/LinearSyntenyView/types.js +2 -0
  89. package/dist/LinearSyntenyViewHelper/index.d.ts +1 -1
  90. package/dist/LinearSyntenyViewHelper/index.js +2 -2
  91. package/dist/LinearSyntenyViewHelper/stateModelFactory.d.ts +2 -14
  92. package/dist/LinearSyntenyViewHelper/stateModelFactory.js +2 -29
  93. package/dist/SyntenyFeatureDetail/LinkToSyntenyView.d.ts +5 -0
  94. package/dist/SyntenyFeatureDetail/LinkToSyntenyView.js +87 -0
  95. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +2 -11
  96. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +5 -90
  97. package/dist/SyntenyFeatureDetail/index.d.ts +1 -1
  98. package/dist/SyntenyFeatureDetail/index.js +18 -14
  99. package/dist/SyntenyFeatureDetail/types.d.ts +9 -0
  100. package/dist/SyntenyFeatureDetail/types.js +2 -0
  101. package/dist/SyntenyTrack/configSchema.d.ts +1 -1
  102. package/dist/SyntenyTrack/configSchema.js +1 -9
  103. package/dist/SyntenyTrack/index.d.ts +1 -1
  104. package/dist/SyntenyTrack/index.js +1 -1
  105. package/dist/index.d.ts +1 -1
  106. package/dist/index.js +4 -4
  107. package/dist/util.d.ts +2 -2
  108. package/dist/util.js +1 -11
  109. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +6 -5
  110. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +35 -36
  111. package/esm/LGVSyntenyDisplay/components/util.d.ts +9 -6
  112. package/esm/LGVSyntenyDisplay/components/util.js +6 -13
  113. package/esm/LGVSyntenyDisplay/configSchemaF.d.ts +19 -10
  114. package/esm/LGVSyntenyDisplay/configSchemaF.js +12 -9
  115. package/esm/LGVSyntenyDisplay/index.d.ts +1 -1
  116. package/esm/LGVSyntenyDisplay/index.js +1 -1
  117. package/esm/LGVSyntenyDisplay/model.d.ts +122 -69
  118. package/esm/LGVSyntenyDisplay/model.js +4 -31
  119. package/esm/LaunchLinearSyntenyView.d.ts +1 -1
  120. package/esm/LaunchLinearSyntenyView.js +1 -3
  121. package/esm/LinearComparativeDisplay/configSchemaF.d.ts +0 -3
  122. package/esm/LinearComparativeDisplay/configSchemaF.js +0 -6
  123. package/esm/LinearComparativeDisplay/index.d.ts +1 -1
  124. package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +12 -69
  125. package/esm/LinearComparativeDisplay/stateModelFactory.js +14 -58
  126. package/esm/LinearComparativeView/components/Header.d.ts +2 -3
  127. package/esm/LinearComparativeView/components/Header.js +56 -63
  128. package/esm/LinearComparativeView/components/HeaderSearchBoxes.d.ts +2 -3
  129. package/esm/LinearComparativeView/components/HeaderSearchBoxes.js +5 -12
  130. package/esm/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +2 -3
  131. package/esm/LinearComparativeView/components/LinearComparativeRenderArea.js +17 -29
  132. package/esm/LinearComparativeView/components/LinearComparativeView.d.ts +2 -3
  133. package/esm/LinearComparativeView/components/LinearComparativeView.js +4 -9
  134. package/esm/LinearComparativeView/components/Rubberband.d.ts +2 -3
  135. package/esm/LinearComparativeView/components/Rubberband.js +36 -46
  136. package/esm/LinearComparativeView/components/VerticalGuide.d.ts +2 -3
  137. package/esm/LinearComparativeView/components/VerticalGuide.js +5 -6
  138. package/esm/LinearComparativeView/index.d.ts +1 -1
  139. package/esm/LinearComparativeView/model.d.ts +38 -90
  140. package/esm/LinearComparativeView/model.js +24 -101
  141. package/esm/LinearReadVsRef/LinearReadVsRef.d.ts +2 -3
  142. package/esm/LinearReadVsRef/LinearReadVsRef.js +10 -32
  143. package/esm/LinearReadVsRef/index.d.ts +1 -1
  144. package/esm/LinearReadVsRef/index.js +1 -3
  145. package/esm/LinearSyntenyDisplay/afterAttach.d.ts +1 -1
  146. package/esm/LinearSyntenyDisplay/afterAttach.js +8 -12
  147. package/esm/LinearSyntenyDisplay/components/Component.d.ts +2 -3
  148. package/esm/LinearSyntenyDisplay/components/Component.js +11 -13
  149. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.d.ts +2 -3
  150. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +79 -100
  151. package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.d.ts +3 -4
  152. package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.js +3 -3
  153. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.d.ts +1 -2
  154. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +3 -4
  155. package/esm/LinearSyntenyDisplay/components/util.d.ts +3 -3
  156. package/esm/LinearSyntenyDisplay/components/util.js +2 -11
  157. package/esm/LinearSyntenyDisplay/configSchemaF.d.ts +1 -12
  158. package/esm/LinearSyntenyDisplay/configSchemaF.js +0 -15
  159. package/esm/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
  160. package/esm/LinearSyntenyDisplay/drawSynteny.js +1 -23
  161. package/esm/LinearSyntenyDisplay/index.d.ts +1 -1
  162. package/esm/LinearSyntenyDisplay/index.js +1 -2
  163. package/esm/LinearSyntenyDisplay/model.d.ts +8 -102
  164. package/esm/LinearSyntenyDisplay/model.js +1 -92
  165. package/esm/LinearSyntenyView/components/ExportSvgDialog.d.ts +2 -3
  166. package/esm/LinearSyntenyView/components/ExportSvgDialog.js +35 -53
  167. package/esm/LinearSyntenyView/components/Icons.d.ts +3 -4
  168. package/esm/LinearSyntenyView/components/Icons.js +3 -5
  169. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +8 -0
  170. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +125 -0
  171. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyPreConfigured.d.ts +8 -0
  172. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyPreConfigured.js +37 -0
  173. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelectorArea.d.ts +7 -0
  174. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelectorArea.js +16 -0
  175. package/esm/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.d.ts +2 -3
  176. package/esm/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +49 -127
  177. package/esm/LinearSyntenyView/components/ImportForm/doSubmit.d.ts +5 -0
  178. package/esm/LinearSyntenyView/components/ImportForm/doSubmit.js +40 -0
  179. package/esm/LinearSyntenyView/components/ImportForm/getAdapter.d.ts +117 -0
  180. package/esm/LinearSyntenyView/components/ImportForm/getAdapter.js +65 -0
  181. package/esm/LinearSyntenyView/components/ImportForm/util.js +1 -3
  182. package/esm/LinearSyntenyView/components/LinearSyntenyView.d.ts +2 -3
  183. package/esm/LinearSyntenyView/components/LinearSyntenyView.js +3 -3
  184. package/esm/LinearSyntenyView/index.d.ts +1 -1
  185. package/esm/LinearSyntenyView/model.d.ts +54 -58
  186. package/esm/LinearSyntenyView/model.js +44 -49
  187. package/esm/LinearSyntenyView/svgcomponents/SVGBackground.d.ts +1 -2
  188. package/esm/LinearSyntenyView/svgcomponents/SVGBackground.js +3 -3
  189. package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +2 -3
  190. package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +4 -9
  191. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -1
  192. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +8 -25
  193. package/esm/LinearSyntenyView/types.d.ts +12 -0
  194. package/esm/LinearSyntenyView/types.js +1 -0
  195. package/esm/LinearSyntenyViewHelper/index.d.ts +1 -1
  196. package/esm/LinearSyntenyViewHelper/index.js +2 -2
  197. package/esm/LinearSyntenyViewHelper/stateModelFactory.d.ts +2 -14
  198. package/esm/LinearSyntenyViewHelper/stateModelFactory.js +2 -29
  199. package/esm/SyntenyFeatureDetail/LinkToSyntenyView.d.ts +5 -0
  200. package/esm/SyntenyFeatureDetail/LinkToSyntenyView.js +52 -0
  201. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +2 -11
  202. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +6 -68
  203. package/esm/SyntenyFeatureDetail/index.d.ts +1 -1
  204. package/esm/SyntenyFeatureDetail/index.js +1 -7
  205. package/esm/SyntenyFeatureDetail/types.d.ts +9 -0
  206. package/esm/SyntenyFeatureDetail/types.js +1 -0
  207. package/esm/SyntenyTrack/configSchema.d.ts +1 -1
  208. package/esm/SyntenyTrack/configSchema.js +1 -9
  209. package/esm/SyntenyTrack/index.d.ts +1 -1
  210. package/esm/SyntenyTrack/index.js +1 -1
  211. package/esm/index.d.ts +1 -1
  212. package/esm/index.js +4 -4
  213. package/esm/util.d.ts +2 -2
  214. package/esm/util.js +1 -11
  215. package/package.json +2 -4
  216. package/dist/LinearSyntenyView/components/ImportForm/AddCustomTrack.d.ts +0 -10
  217. package/dist/LinearSyntenyView/components/ImportForm/AddCustomTrack.js +0 -194
  218. package/dist/LinearSyntenyView/components/ImportForm/Spacer.d.ts +0 -2
  219. package/dist/LinearSyntenyView/components/ImportForm/Spacer.js +0 -10
  220. package/dist/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +0 -10
  221. package/dist/LinearSyntenyView/components/ImportForm/TrackSelector.js +0 -59
  222. package/dist/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +0 -14
  223. package/dist/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.js +0 -52
  224. package/esm/LinearSyntenyView/components/ImportForm/AddCustomTrack.d.ts +0 -10
  225. package/esm/LinearSyntenyView/components/ImportForm/AddCustomTrack.js +0 -169
  226. package/esm/LinearSyntenyView/components/ImportForm/Spacer.d.ts +0 -2
  227. package/esm/LinearSyntenyView/components/ImportForm/Spacer.js +0 -4
  228. package/esm/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +0 -10
  229. package/esm/LinearSyntenyView/components/ImportForm/TrackSelector.js +0 -34
  230. package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +0 -14
  231. package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.js +0 -23
@@ -1,9 +1,10 @@
1
- import React, { useState, useCallback, useRef, lazy, useEffect } from 'react';
2
- import { observer } from 'mobx-react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { lazy, useCallback, useEffect, useRef, useState } from 'react';
3
3
  import { getContainingView } from '@jbrowse/core/util';
4
4
  import { transaction } from 'mobx';
5
+ import { observer } from 'mobx-react';
5
6
  import { makeStyles } from 'tss-react/mui';
6
- import { getId, MAX_COLOR_RANGE } from '../drawSynteny';
7
+ import { MAX_COLOR_RANGE, getId } from '../drawSynteny';
7
8
  import SyntenyContextMenu from './SyntenyContextMenu';
8
9
  import { getTooltip, onSynClick, onSynContextClick } from './util';
9
10
  const SyntenyTooltip = lazy(() => import('./SyntenyTooltip'));
@@ -33,30 +34,21 @@ const LinearSyntenyRendering = observer(function ({ model, }) {
33
34
  const width = view.width;
34
35
  const delta = useRef(0);
35
36
  const scheduled = useRef(false);
36
- const timeout = useRef();
37
+ const timeout = useRef(null);
37
38
  const [anchorEl, setAnchorEl] = useState();
38
39
  const [tooltip, setTooltip] = useState('');
39
40
  const [currX, setCurrX] = useState();
40
41
  const [mouseCurrDownX, setMouseCurrDownX] = useState();
41
42
  const [mouseInitialDownX, setMouseInitialDownX] = useState();
42
43
  const [currY, setCurrY] = useState();
43
- const mainSyntenyCanvasRefp = useRef();
44
- // these useCallbacks avoid new refs from being created on any mouseover,
45
- // etc.
46
- // biome-ignore lint/correctness/useExhaustiveDependencies:
44
+ const mainSyntenyCanvasRefp = useRef(null);
47
45
  const mouseoverDetectionCanvasRef = useCallback((ref) => {
48
46
  model.setMouseoverCanvasRef(ref);
49
- },
50
- // eslint-disable-next-line react-hooks/exhaustive-deps
51
- [model, height, width]);
52
- // biome-ignore lint/correctness/useExhaustiveDependencies:
47
+ }, [model, height, width]);
53
48
  const mainSyntenyCanvasRef = useCallback((ref) => {
54
49
  model.setMainCanvasRef(ref);
55
- mainSyntenyCanvasRefp.current = ref; // this ref is additionally used in useEffect below
56
- },
57
- // eslint-disable-next-line react-hooks/exhaustive-deps
58
- [model, height, width]);
59
- // biome-ignore lint/correctness/useExhaustiveDependencies:
50
+ mainSyntenyCanvasRefp.current = ref;
51
+ }, [model, height, width]);
60
52
  useEffect(() => {
61
53
  var _a;
62
54
  function onWheel(event) {
@@ -105,97 +97,84 @@ const LinearSyntenyRendering = observer(function ({ model, }) {
105
97
  var _a;
106
98
  (_a = mainSyntenyCanvasRefp.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('wheel', onWheel);
107
99
  };
108
- // eslint-disable-next-line react-hooks/exhaustive-deps
109
100
  }, [model, height, width]);
110
- // biome-ignore lint/correctness/useExhaustiveDependencies:
111
101
  const clickMapCanvasRef = useCallback((ref) => {
112
102
  model.setClickMapCanvasRef(ref);
113
- },
114
- // eslint-disable-next-line react-hooks/exhaustive-deps
115
- [model, height, width]);
116
- // biome-ignore lint/correctness/useExhaustiveDependencies:
103
+ }, [model, height, width]);
117
104
  const cigarClickMapCanvasRef = useCallback((ref) => {
118
105
  model.setCigarClickMapCanvasRef(ref);
119
- },
120
- // eslint-disable-next-line react-hooks/exhaustive-deps
121
- [model, height, width]);
122
- return (React.createElement("div", { className: classes.rel },
123
- React.createElement("canvas", { ref: mouseoverDetectionCanvasRef, width: width, height: height, className: classes.mouseoverCanvas }),
124
- React.createElement("canvas", { ref: mainSyntenyCanvasRef, onMouseMove: event => {
125
- var _a;
126
- if (mouseCurrDownX !== undefined) {
127
- xOffset.current += mouseCurrDownX - event.clientX;
128
- setMouseCurrDownX(event.clientX);
129
- if (!scheduled.current) {
130
- scheduled.current = true;
131
- window.requestAnimationFrame(() => {
132
- transaction(() => {
133
- for (const v of view.views) {
134
- v.horizontalScroll(xOffset.current);
135
- }
136
- xOffset.current = 0;
137
- scheduled.current = false;
106
+ }, [model, height, width]);
107
+ return (_jsxs("div", { className: classes.rel, children: [_jsx("canvas", { ref: mouseoverDetectionCanvasRef, width: width, height: height, className: classes.mouseoverCanvas }), _jsx("canvas", { ref: mainSyntenyCanvasRef, onMouseMove: event => {
108
+ var _a;
109
+ if (mouseCurrDownX !== undefined) {
110
+ xOffset.current += mouseCurrDownX - event.clientX;
111
+ setMouseCurrDownX(event.clientX);
112
+ if (!scheduled.current) {
113
+ scheduled.current = true;
114
+ window.requestAnimationFrame(() => {
115
+ transaction(() => {
116
+ for (const v of view.views) {
117
+ v.horizontalScroll(xOffset.current);
118
+ }
119
+ xOffset.current = 0;
120
+ scheduled.current = false;
121
+ });
138
122
  });
139
- });
140
- }
141
- }
142
- else {
143
- const ref1 = model.clickMapCanvas;
144
- const ref2 = model.cigarClickMapCanvas;
145
- if (!ref1 || !ref2) {
146
- return;
123
+ }
147
124
  }
148
- const rect = ref1.getBoundingClientRect();
149
- const ctx1 = ref1.getContext('2d');
150
- const ctx2 = ref2.getContext('2d');
151
- if (!ctx1 || !ctx2) {
152
- return;
125
+ else {
126
+ const ref1 = model.clickMapCanvas;
127
+ const ref2 = model.cigarClickMapCanvas;
128
+ if (!ref1 || !ref2) {
129
+ return;
130
+ }
131
+ const rect = ref1.getBoundingClientRect();
132
+ const ctx1 = ref1.getContext('2d');
133
+ const ctx2 = ref2.getContext('2d');
134
+ if (!ctx1 || !ctx2) {
135
+ return;
136
+ }
137
+ const { clientX, clientY } = event;
138
+ const x = clientX - rect.left;
139
+ const y = clientY - rect.top;
140
+ setCurrX(clientX);
141
+ setCurrY(clientY);
142
+ const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
143
+ const [r2, g2, b2] = ctx2.getImageData(x, y, 1, 1).data;
144
+ const unitMultiplier = Math.floor(MAX_COLOR_RANGE / model.numFeats);
145
+ const id = getId(r1, g1, b1, unitMultiplier);
146
+ model.setMouseoverId((_a = model.featPositions[id]) === null || _a === void 0 ? void 0 : _a.f.id());
147
+ if (id === -1) {
148
+ setTooltip('');
149
+ }
150
+ else if (model.featPositions[id]) {
151
+ const { f, cigar } = model.featPositions[id];
152
+ const unitMultiplier2 = Math.floor(MAX_COLOR_RANGE / cigar.length);
153
+ const cigarIdx = getId(r2, g2, b2, unitMultiplier2);
154
+ setTooltip(getTooltip({
155
+ feature: f,
156
+ cigarOp: cigar[cigarIdx],
157
+ cigarOpLen: cigar[cigarIdx + 1],
158
+ }));
159
+ }
153
160
  }
154
- const { clientX, clientY } = event;
155
- const x = clientX - rect.left;
156
- const y = clientY - rect.top;
157
- setCurrX(clientX);
158
- setCurrY(clientY);
159
- const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
160
- const [r2, g2, b2] = ctx2.getImageData(x, y, 1, 1).data;
161
- const unitMultiplier = Math.floor(MAX_COLOR_RANGE / model.numFeats);
162
- const id = getId(r1, g1, b1, unitMultiplier);
163
- model.setMouseoverId((_a = model.featPositions[id]) === null || _a === void 0 ? void 0 : _a.f.id());
164
- if (id === -1) {
165
- setTooltip('');
161
+ }, onMouseLeave: () => {
162
+ model.setMouseoverId(undefined);
163
+ setMouseInitialDownX(undefined);
164
+ setMouseCurrDownX(undefined);
165
+ }, onMouseDown: evt => {
166
+ setMouseCurrDownX(evt.clientX);
167
+ setMouseInitialDownX(evt.clientX);
168
+ }, onMouseUp: evt => {
169
+ setMouseCurrDownX(undefined);
170
+ if (mouseInitialDownX !== undefined &&
171
+ Math.abs(evt.clientX - mouseInitialDownX) < 5) {
172
+ onSynClick(evt, model);
166
173
  }
167
- else if (model.featPositions[id]) {
168
- const { f, cigar } = model.featPositions[id];
169
- const unitMultiplier2 = Math.floor(MAX_COLOR_RANGE / cigar.length);
170
- const cigarIdx = getId(r2, g2, b2, unitMultiplier2);
171
- setTooltip(getTooltip({
172
- feature: f,
173
- cigarOp: cigar[cigarIdx],
174
- cigarOpLen: cigar[cigarIdx + 1],
175
- }));
176
- }
177
- }
178
- }, onMouseLeave: () => {
179
- model.setMouseoverId(undefined);
180
- setMouseInitialDownX(undefined);
181
- setMouseCurrDownX(undefined);
182
- }, onMouseDown: evt => {
183
- setMouseCurrDownX(evt.clientX);
184
- setMouseInitialDownX(evt.clientX);
185
- }, onMouseUp: evt => {
186
- setMouseCurrDownX(undefined);
187
- if (mouseInitialDownX !== undefined &&
188
- Math.abs(evt.clientX - mouseInitialDownX) < 5) {
189
- onSynClick(evt, model);
190
- }
191
- }, onContextMenu: evt => {
192
- onSynContextClick(evt, model, setAnchorEl);
193
- }, "data-testid": "synteny_canvas", className: classes.mainCanvas, width: width, height: height }),
194
- React.createElement("canvas", { ref: clickMapCanvasRef, className: classes.pix, width: width, height: height }),
195
- React.createElement("canvas", { ref: cigarClickMapCanvasRef, className: classes.pix, width: width, height: height }),
196
- mouseoverId && tooltip && currX && currY ? (React.createElement(SyntenyTooltip, { title: tooltip })) : null,
197
- anchorEl ? (React.createElement(SyntenyContextMenu, { model: model, anchorEl: anchorEl, onClose: () => {
198
- setAnchorEl(undefined);
199
- } })) : null));
174
+ }, onContextMenu: evt => {
175
+ onSynContextClick(evt, model, setAnchorEl);
176
+ }, "data-testid": "synteny_canvas", className: classes.mainCanvas, width: width, height: height }), _jsx("canvas", { ref: clickMapCanvasRef, className: classes.pix, width: width, height: height }), _jsx("canvas", { ref: cigarClickMapCanvasRef, className: classes.pix, width: width, height: height }), mouseoverId && tooltip && currX && currY ? (_jsx(SyntenyTooltip, { title: tooltip })) : null, anchorEl ? (_jsx(SyntenyContextMenu, { model: model, anchorEl: anchorEl, onClose: () => {
177
+ setAnchorEl(undefined);
178
+ } })) : null] }));
200
179
  });
201
180
  export default LinearSyntenyRendering;
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
- import { Feature } from '@jbrowse/core/util';
3
- import { LinearSyntenyDisplayModel } from '../model';
1
+ import type { LinearSyntenyDisplayModel } from '../model';
2
+ import type { Feature } from '@jbrowse/core/util';
4
3
  interface ClickCoord {
5
4
  clientX: number;
6
5
  clientY: number;
@@ -12,5 +11,5 @@ export default function SyntenyContextMenu({ model, onClose, anchorEl, }: {
12
11
  onClose: () => void;
13
12
  model: LinearSyntenyDisplayModel;
14
13
  anchorEl: ClickCoord;
15
- }): React.JSX.Element;
14
+ }): import("react/jsx-runtime").JSX.Element;
16
15
  export {};
@@ -1,10 +1,10 @@
1
- import React from 'react';
2
- import { getContainingView, getSession } from '@jbrowse/core/util';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { Menu } from '@jbrowse/core/ui';
3
+ import { getContainingView, getSession } from '@jbrowse/core/util';
4
4
  export default function SyntenyContextMenu({ model, onClose, anchorEl, }) {
5
5
  const view = getContainingView(model);
6
6
  const { clientX, clientY, feature } = anchorEl;
7
- return (React.createElement(Menu, { onMenuItemClick: (event, callback) => {
7
+ return (_jsx(Menu, { onMenuItemClick: (event, callback) => {
8
8
  callback(event);
9
9
  onClose();
10
10
  }, anchorEl: {
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
1
  declare const SyntenyTooltip: ({ title }: {
3
2
  title: string;
4
- }) => React.JSX.Element | null;
3
+ }) => import("react/jsx-runtime").JSX.Element | null;
5
4
  export default SyntenyTooltip;
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
- import { observer } from 'mobx-react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
3
2
  import { SanitizedHTML } from '@jbrowse/core/ui';
4
3
  import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
4
+ import { observer } from 'mobx-react';
5
5
  const SyntenyTooltip = observer(function ({ title }) {
6
- return title ? (React.createElement(BaseTooltip, null,
7
- React.createElement(SanitizedHTML, { html: title }))) : null;
6
+ return title ? (_jsx(BaseTooltip, { children: _jsx(SanitizedHTML, { html: title }) })) : null;
8
7
  });
9
8
  export default SyntenyTooltip;
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { Feature } from '@jbrowse/core/util';
3
- import { LinearSyntenyDisplayModel } from '../model';
1
+ import type React from 'react';
2
+ import type { LinearSyntenyDisplayModel } from '../model';
3
+ import type { Feature } from '@jbrowse/core/util';
4
4
  interface Pos {
5
5
  offsetPx: number;
6
6
  }
@@ -1,6 +1,5 @@
1
- import { assembleLocString, doesIntersect2, getSession, isSessionModelWithWidgets, getContainingTrack, getContainingView, } from '@jbrowse/core/util';
2
- // locals
3
- import { getId, MAX_COLOR_RANGE } from '../drawSynteny';
1
+ import { assembleLocString, doesIntersect2, getContainingTrack, getContainingView, getSession, isSessionModelWithWidgets, } from '@jbrowse/core/util';
2
+ import { MAX_COLOR_RANGE, getId } from '../drawSynteny';
4
3
  export function drawMatchSimple({ feature, ctx, offsets, level, cb, height, drawCurves, oobLimit, viewWidth, hideTiny, }) {
5
4
  const { p11, p12, p21, p22 } = feature;
6
5
  const x11 = p11.offsetPx - offsets[level];
@@ -17,11 +16,7 @@ export function drawMatchSimple({ feature, ctx, offsets, level, cb, height, draw
17
16
  if (!doesIntersect2(minX, maxX, -oobLimit, viewWidth + oobLimit)) {
18
17
  return;
19
18
  }
20
- // drawing a line if the results are thin: drawing a line results in much
21
- // less pixellation than filling in a thin polygon
22
19
  if (l1 <= 1 && l2 <= 1) {
23
- // hideTiny can be used to avoid drawing mouseover for thin lines in this
24
- // case
25
20
  if (!hideTiny) {
26
21
  ctx.beginPath();
27
22
  ctx.moveTo(x11, y1);
@@ -58,9 +53,6 @@ export function drawBox(ctx, x1, x2, y1, x3, x4, y2) {
58
53
  export function drawBezierBox(ctx, x1, x2, y1, x3, x4, y2, mid) {
59
54
  const len1 = Math.abs(x1 - x2);
60
55
  const len2 = Math.abs(x1 - x2);
61
- // heuristic to not draw hourglass inversions with bezier curves when they
62
- // are thin and far apart because it results in areas that are not drawn well
63
- // demo https://codesandbox.io/s/fast-glitter-q3b1or?file=/src/index.js
64
56
  if (len1 < 5 && len2 < 5 && x2 < x1 && Math.abs(x1 - x3) > 100) {
65
57
  const tmp = x1;
66
58
  x1 = x2;
@@ -134,7 +126,6 @@ export function onSynContextClick(event, model, setAnchorEl) {
134
126
  }
135
127
  }
136
128
  export function getTooltip({ feature, cigarOp, cigarOpLen, }) {
137
- // @ts-expect-error
138
129
  const f1 = feature.toJSON();
139
130
  const f2 = f1.mate;
140
131
  const l1 = f1.end - f1.start;
@@ -1,20 +1,9 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
2
- /**
3
- * #config LinearSyntenyDisplay
4
- */
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
5
2
  declare function configSchemaFactory(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
6
- /**
7
- * #slot
8
- * currently unused
9
- */
10
3
  trackIds: {
11
4
  type: string;
12
5
  defaultValue: never[];
13
6
  };
14
- /**
15
- * #slot
16
- * currently unused
17
- */
18
7
  middle: {
19
8
  type: string;
20
9
  defaultValue: boolean;
@@ -1,28 +1,13 @@
1
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
2
  import baseConfigFactory from '../LinearComparativeDisplay/configSchemaF';
3
- /**
4
- * #config LinearSyntenyDisplay
5
- */
6
3
  function configSchemaFactory(pluginManager) {
7
4
  return ConfigurationSchema('LinearSyntenyDisplay', {
8
- /**
9
- * #slot
10
- * currently unused
11
- */
12
5
  trackIds: {
13
6
  type: 'stringArray',
14
7
  defaultValue: [],
15
8
  },
16
- /**
17
- * #slot
18
- * currently unused
19
- */
20
9
  middle: { type: 'boolean', defaultValue: true },
21
10
  }, {
22
- /**
23
- * #baseConfiguration
24
- * this refers to the LinearComparativeDisplay
25
- */
26
11
  baseConfiguration: baseConfigFactory(pluginManager),
27
12
  explicitlyTyped: true,
28
13
  });
@@ -1,4 +1,4 @@
1
- import { LinearSyntenyDisplayModel } from './model';
1
+ import type { LinearSyntenyDisplayModel } from './model';
2
2
  export declare const MAX_COLOR_RANGE: number;
3
3
  export declare function getId(r: number, g: number, b: number, unitMultiplier: number): number;
4
4
  export declare function drawRef(model: LinearSyntenyDisplayModel, ctx1: CanvasRenderingContext2D, ctx3?: CanvasRenderingContext2D): void;
@@ -1,6 +1,6 @@
1
1
  import { doesIntersect2, getContainingView } from '@jbrowse/core/util';
2
2
  import { draw, drawMatchSimple } from './components/util';
3
- export const MAX_COLOR_RANGE = 255 * 255 * 255; // max color range
3
+ export const MAX_COLOR_RANGE = 255 * 255 * 255;
4
4
  function makeColor(idx) {
5
5
  const r = Math.floor(idx / (255 * 255)) % 255;
6
6
  const g = Math.floor(idx / 255) % 255;
@@ -34,8 +34,6 @@ export function drawRef(model, ctx1, ctx3) {
34
34
  ctx1.beginPath();
35
35
  const offsets = view.views.map(v => v.offsetPx);
36
36
  const unitMultiplier = Math.floor(MAX_COLOR_RANGE / featPositions.length);
37
- // this loop is optimized to draw many thin lines with a single ctx.stroke
38
- // call, a separate loop below draws larger boxes
39
37
  ctx1.fillStyle = colorMap.M;
40
38
  ctx1.strokeStyle = colorMap.M;
41
39
  for (const { p11, p12, p21, p22 } of featPositions) {
@@ -48,8 +46,6 @@ export function drawRef(model, ctx1, ctx3) {
48
46
  const y1 = 0;
49
47
  const y2 = height;
50
48
  const mid = (y2 - y1) / 2;
51
- // drawing a line if the results are thin results in much less pixellation
52
- // than filling in a thin polygon
53
49
  if (l1 <= lineLimit &&
54
50
  l2 <= lineLimit &&
55
51
  x21 < width + oobLimit &&
@@ -64,8 +60,6 @@ export function drawRef(model, ctx1, ctx3) {
64
60
  }
65
61
  }
66
62
  ctx1.stroke();
67
- // this loop only draws small lines as a polyline, the polyline calls
68
- // ctx.stroke once is much more efficient than calling stroke() many times
69
63
  ctx1.fillStyle = colorMap.M;
70
64
  ctx1.strokeStyle = colorMap.M;
71
65
  for (const { p11, p12, p21, p22, f, cigar } of featPositions) {
@@ -85,17 +79,12 @@ export function drawRef(model, ctx1, ctx3) {
85
79
  const s1 = f.get('strand');
86
80
  const k1 = s1 === -1 ? x12 : x11;
87
81
  const k2 = s1 === -1 ? x11 : x12;
88
- // rev1/rev2 flip the direction of the CIGAR drawing in horizontally flipped
89
- // modes. somewhat heuristically determined, but tested for
90
82
  const rev1 = k1 < k2 ? 1 : -1;
91
83
  const rev2 = (x21 < x22 ? 1 : -1) * s1;
92
- // cx1/cx2 are the current x positions on top and bottom rows
93
84
  let cx1 = k1;
94
85
  let cx2 = s1 === -1 ? x22 : x21;
95
86
  if (cigar.length && drawCIGAR) {
96
- // continuingFlag skips drawing commands on very small CIGAR features
97
87
  let continuingFlag = false;
98
- // px1/px2 are the previous x positions on the top and bottom rows
99
88
  let px1 = 0;
100
89
  let px2 = 0;
101
90
  const unitMultiplier2 = Math.floor(MAX_COLOR_RANGE / cigar.length);
@@ -116,17 +105,11 @@ export function drawRef(model, ctx1, ctx3) {
116
105
  else if (op === 'D' || op === 'N') {
117
106
  cx1 += d1 * rev1;
118
107
  }
119
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
120
108
  else if (op === 'I') {
121
109
  cx2 += d2 * rev2;
122
110
  }
123
- // check that we are even drawing in view here, e.g. that all
124
- // points are not all less than 0 or greater than width
125
111
  if (!(Math.max(px1, px2, cx1, cx2) < 0 ||
126
112
  Math.min(px1, px2, cx1, cx2) > width)) {
127
- // if it is a small feature and not the last element of the
128
- // CIGAR (which could skip rendering it entire if we did turn
129
- // it on), then turn on continuing flag
130
113
  const isNotLast = j < cigar.length - 2;
131
114
  if (Math.abs(cx1 - px1) <= 1 &&
132
115
  Math.abs(cx2 - px2) <= 1 &&
@@ -134,9 +117,6 @@ export function drawRef(model, ctx1, ctx3) {
134
117
  continuingFlag = true;
135
118
  }
136
119
  else {
137
- // allow rendering the dominant color when using continuing
138
- // flag if the last element of continuing was a large
139
- // feature, else just use match
140
120
  ctx1.fillStyle =
141
121
  colorMap[(continuingFlag && d1 > 1) || d2 > 1 ? op : 'M'];
142
122
  continuingFlag = false;
@@ -157,7 +137,6 @@ export function drawRef(model, ctx1, ctx3) {
157
137
  }
158
138
  }
159
139
  }
160
- // draw click map
161
140
  const ctx2 = (_a = model.clickMapCanvas) === null || _a === void 0 ? void 0 : _a.getContext('2d');
162
141
  if (!ctx2) {
163
142
  return;
@@ -168,7 +147,6 @@ export function drawRef(model, ctx1, ctx3) {
168
147
  const feature = featPositions[i];
169
148
  const idx = i * unitMultiplier + 1;
170
149
  ctx2.fillStyle = makeColor(idx);
171
- // too many click map false positives with colored stroked lines
172
150
  drawMatchSimple({
173
151
  cb: ctx => {
174
152
  ctx.fill();
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function LinearSyntenyDisplayF(pluginManager: PluginManager): void;
@@ -1,8 +1,7 @@
1
+ import { lazy } from 'react';
1
2
  import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
2
- // locals
3
3
  import configSchemaF from './configSchemaF';
4
4
  import stateModelFactory from './model';
5
- import { lazy } from 'react';
6
5
  export default function LinearSyntenyDisplayF(pluginManager) {
7
6
  pluginManager.addDisplayType(() => {
8
7
  const configSchema = configSchemaF(pluginManager);