@jbrowse/plugin-linear-comparative-view 4.0.2 → 4.0.4

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 (26) hide show
  1. package/esm/LGVSyntenyDisplay/model.d.ts +20 -1
  2. package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +3 -0
  3. package/esm/LinearComparativeView/components/LinearComparativeRenderArea.js +3 -0
  4. package/esm/LinearComparativeView/components/OpacitySlider.js +7 -3
  5. package/esm/LinearComparativeView/components/useRangeSelect.js +3 -0
  6. package/esm/LinearComparativeView/model.d.ts +33 -6
  7. package/esm/LinearSyntenyDisplay/afterAttach.js +9 -0
  8. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +15 -15
  9. package/esm/LinearSyntenyDisplay/components/util.d.ts +1 -0
  10. package/esm/LinearSyntenyDisplay/components/util.js +23 -38
  11. package/esm/LinearSyntenyDisplay/drawCigarClickMap.d.ts +2 -0
  12. package/esm/LinearSyntenyDisplay/drawCigarClickMap.js +88 -0
  13. package/esm/LinearSyntenyDisplay/{drawMouseoverClickMap.js → drawMouseover.js} +9 -11
  14. package/esm/LinearSyntenyDisplay/drawRef.d.ts +2 -0
  15. package/esm/LinearSyntenyDisplay/drawRef.js +190 -0
  16. package/esm/LinearSyntenyDisplay/drawSynteny.d.ts +4 -6
  17. package/esm/LinearSyntenyDisplay/drawSynteny.js +4 -461
  18. package/esm/LinearSyntenyDisplay/drawSyntenyUtils.d.ts +58 -0
  19. package/esm/LinearSyntenyDisplay/drawSyntenyUtils.js +62 -0
  20. package/esm/LinearSyntenyDisplay/model.d.ts +47 -2
  21. package/esm/LinearSyntenyDisplay/model.js +50 -2
  22. package/esm/LinearSyntenyView/model.d.ts +54 -18
  23. package/esm/LinearSyntenyView/model.js +23 -24
  24. package/esm/SyntenyFeatureDetail/LinkToSyntenyView.js +4 -4
  25. package/package.json +4 -4
  26. /package/esm/LinearSyntenyDisplay/{drawMouseoverClickMap.d.ts → drawMouseover.d.ts} +0 -0
@@ -147,6 +147,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
147
147
  }> | null;
148
148
  readonly adapterConfig: any;
149
149
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
150
+ readonly isMinimized: boolean;
150
151
  readonly parentDisplay: any;
151
152
  readonly effectiveRpcDriverName: any;
152
153
  } & {
@@ -203,6 +204,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
203
204
  }> | null;
204
205
  readonly adapterConfig: any;
205
206
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
207
+ readonly isMinimized: boolean;
206
208
  readonly parentDisplay: any;
207
209
  readonly effectiveRpcDriverName: any;
208
210
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -256,6 +258,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
256
258
  }> | null;
257
259
  readonly adapterConfig: any;
258
260
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
261
+ readonly isMinimized: boolean;
259
262
  readonly parentDisplay: any;
260
263
  readonly effectiveRpcDriverName: any;
261
264
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -537,6 +540,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
537
540
  }> | null;
538
541
  readonly adapterConfig: any;
539
542
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
543
+ readonly isMinimized: boolean;
540
544
  readonly parentDisplay: any;
541
545
  readonly effectiveRpcDriverName: any;
542
546
  } & {
@@ -593,6 +597,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
593
597
  }> | null;
594
598
  readonly adapterConfig: any;
595
599
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
600
+ readonly isMinimized: boolean;
596
601
  readonly parentDisplay: any;
597
602
  readonly effectiveRpcDriverName: any;
598
603
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -646,6 +651,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
646
651
  }> | null;
647
652
  readonly adapterConfig: any;
648
653
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
654
+ readonly isMinimized: boolean;
649
655
  readonly parentDisplay: any;
650
656
  readonly effectiveRpcDriverName: any;
651
657
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -872,6 +878,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
872
878
  }> | null;
873
879
  readonly adapterConfig: any;
874
880
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
881
+ readonly isMinimized: boolean;
875
882
  readonly parentDisplay: any;
876
883
  readonly effectiveRpcDriverName: any;
877
884
  } & {
@@ -928,6 +935,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
928
935
  }> | null;
929
936
  readonly adapterConfig: any;
930
937
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
938
+ readonly isMinimized: boolean;
931
939
  readonly parentDisplay: any;
932
940
  readonly effectiveRpcDriverName: any;
933
941
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -981,6 +989,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
981
989
  }> | null;
982
990
  readonly adapterConfig: any;
983
991
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
992
+ readonly isMinimized: boolean;
984
993
  readonly parentDisplay: any;
985
994
  readonly effectiveRpcDriverName: any;
986
995
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -1113,10 +1122,18 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
1113
1122
  setHideLargeIndels(arg: boolean): void;
1114
1123
  } & {
1115
1124
  copyFeatureToClipboard(feature: Feature): Promise<void>;
1116
- readonly rendererConfig: any;
1125
+ readonly rendererConfig: {
1126
+ height: any;
1127
+ noSpacing: any;
1128
+ maxHeight: any;
1129
+ hideSmallIndels: any;
1130
+ hideMismatches: any;
1131
+ hideLargeIndels: any;
1132
+ };
1117
1133
  } & {
1118
1134
  readonly maxHeight: any;
1119
1135
  readonly featureHeightSetting: any;
1136
+ readonly noSpacingSetting: any;
1120
1137
  readonly featureUnderMouse: Feature | undefined;
1121
1138
  renderReady(): boolean;
1122
1139
  readonly filters: import("@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain").default;
@@ -1206,6 +1223,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
1206
1223
  }> | null;
1207
1224
  readonly adapterConfig: any;
1208
1225
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
1226
+ readonly isMinimized: boolean;
1209
1227
  readonly parentDisplay: any;
1210
1228
  readonly effectiveRpcDriverName: any;
1211
1229
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -1259,6 +1277,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
1259
1277
  }> | null;
1260
1278
  readonly adapterConfig: any;
1261
1279
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
1280
+ readonly isMinimized: boolean;
1262
1281
  readonly parentDisplay: any;
1263
1282
  readonly effectiveRpcDriverName: any;
1264
1283
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -55,6 +55,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
55
55
  }> | null;
56
56
  readonly adapterConfig: any;
57
57
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
58
+ readonly isMinimized: boolean;
58
59
  readonly parentDisplay: any;
59
60
  readonly effectiveRpcDriverName: any;
60
61
  } & {
@@ -111,6 +112,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
111
112
  }> | null;
112
113
  readonly adapterConfig: any;
113
114
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
115
+ readonly isMinimized: boolean;
114
116
  readonly parentDisplay: any;
115
117
  readonly effectiveRpcDriverName: any;
116
118
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -164,6 +166,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
164
166
  }> | null;
165
167
  readonly adapterConfig: any;
166
168
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
169
+ readonly isMinimized: boolean;
167
170
  readonly parentDisplay: any;
168
171
  readonly effectiveRpcDriverName: any;
169
172
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -16,6 +16,9 @@ const useStyles = makeStyles()({
16
16
  resizeHandle: {
17
17
  height: 4,
18
18
  background: '#ccc',
19
+ '&:hover': {
20
+ background: '#aaa',
21
+ },
19
22
  },
20
23
  });
21
24
  function View({ view }) {
@@ -3,7 +3,7 @@ import { makeStyles } from '@jbrowse/core/util/tss-react';
3
3
  import { Box, Slider, Typography } from '@mui/material';
4
4
  import { observer } from 'mobx-react';
5
5
  import SliderTooltip from "./SliderTooltip.js";
6
- const useStyles = makeStyles()({
6
+ const useStyles = makeStyles()(theme => ({
7
7
  container: {
8
8
  display: 'flex',
9
9
  alignItems: 'center',
@@ -11,7 +11,11 @@ const useStyles = makeStyles()({
11
11
  marginRight: 16,
12
12
  minWidth: 150,
13
13
  },
14
- });
14
+ slider: {
15
+ width: 100,
16
+ color: theme.palette.text.secondary,
17
+ },
18
+ }));
15
19
  const OpacitySlider = observer(function OpacitySlider({ model, }) {
16
20
  const { classes } = useStyles();
17
21
  const { levels } = model;
@@ -33,7 +37,7 @@ const OpacitySlider = observer(function OpacitySlider({ model, }) {
33
37
  }
34
38
  }
35
39
  };
36
- return (_jsxs(Box, { className: classes.container, children: [_jsx(Typography, { variant: "body2", style: { marginRight: 8 }, children: "Opacity:" }), _jsx(Slider, { value: sliderValue, onChange: handleAlphaChange, min: 0, max: 1, step: 0.01, valueLabelDisplay: "auto", size: "small", style: { minWidth: 100 }, slots: {
40
+ return (_jsxs(Box, { className: classes.container, children: [_jsx(Typography, { variant: "body2", style: { marginRight: 8 }, children: "Opacity:" }), _jsx(Slider, { value: sliderValue, onChange: handleAlphaChange, min: 0, max: 1, step: 0.01, valueLabelDisplay: "auto", size: "small", className: classes.slider, slots: {
37
41
  valueLabel: SliderTooltip,
38
42
  }, valueLabelFormat: (value) => sliderToAlpha(value).toFixed(3) })] }));
39
43
  });
@@ -72,6 +72,9 @@ export function useRangeSelect(ref, model) {
72
72
  setCurrentX(relativeX);
73
73
  }
74
74
  function mouseMove(event) {
75
+ if (anchorPosition) {
76
+ return;
77
+ }
75
78
  setGuideX(getRelativeX(event, ref.current));
76
79
  }
77
80
  function mouseOut() {
@@ -53,11 +53,14 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
53
53
  lastTrackDragY: undefined | number;
54
54
  volatileError: unknown;
55
55
  scaleFactor: number;
56
+ targetBpPerPx: number | undefined;
56
57
  trackRefs: Record<string, HTMLDivElement>;
57
58
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
58
59
  coarseTotalBp: number;
59
60
  leftOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
60
61
  rightOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
62
+ isScalebarRefNameMenuOpen: boolean;
63
+ scalebarRefNameClickPending: boolean;
61
64
  } & {
62
65
  readonly pinnedTracks: any[];
63
66
  readonly unpinnedTracks: any[];
@@ -111,6 +114,8 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
111
114
  setShowCytobands(flag: boolean): void;
112
115
  setWidth(newWidth: number): void;
113
116
  setError(error: unknown): void;
117
+ setIsScalebarRefNameMenuOpen(isOpen: boolean): void;
118
+ setScalebarRefNameClickPending(pending: boolean): void;
114
119
  setHideHeader(b: boolean): void;
115
120
  setHideHeaderOverview(b: boolean): void;
116
121
  setHideNoTracksActive(b: boolean): void;
@@ -150,6 +155,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
150
155
  setDraggingTrackId(idx?: string): void;
151
156
  setLastTrackDragY(y: number): void;
152
157
  setScaleFactor(factor: number): void;
158
+ setTargetBpPerPx(target: number | undefined): void;
153
159
  clearView(): void;
154
160
  setInit(arg?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState): void;
155
161
  exportSvg(opts?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").ExportSvgOptions): Promise<void>;
@@ -171,6 +177,9 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
171
177
  readonly visibleLocStrings: string;
172
178
  readonly coarseVisibleLocStrings: string;
173
179
  readonly coarseTotalBpDisplayStr: string;
180
+ readonly effectiveBpPerPx: number;
181
+ readonly effectiveTotalBp: number;
182
+ readonly effectiveTotalBpDisplayStr: string;
174
183
  } & {
175
184
  setCoarseDynamicBlocks(blocks: import("@jbrowse/core/util/blockTypes").BlockSet): void;
176
185
  } & {
@@ -182,8 +191,8 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
182
191
  }): Promise<void>;
183
192
  navToLocation(parsedLocString: import("@jbrowse/core/util").ParsedLocString, assemblyName?: string, grow?: number): Promise<void>;
184
193
  navToLocations(regions: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string, grow?: number): Promise<void>;
185
- navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation): void;
186
- navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[]): void;
194
+ navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation, grow?: number): void;
195
+ navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[], grow?: number): void;
187
196
  } & {
188
197
  rubberBandMenuItems(): MenuItem[];
189
198
  bpToPx({ refName, coord, regionNumber, }: {
@@ -365,11 +374,14 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
365
374
  lastTrackDragY: undefined | number;
366
375
  volatileError: unknown;
367
376
  scaleFactor: number;
377
+ targetBpPerPx: number | undefined;
368
378
  trackRefs: Record<string, HTMLDivElement>;
369
379
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
370
380
  coarseTotalBp: number;
371
381
  leftOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
372
382
  rightOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
383
+ isScalebarRefNameMenuOpen: boolean;
384
+ scalebarRefNameClickPending: boolean;
373
385
  } & {
374
386
  readonly pinnedTracks: any[];
375
387
  readonly unpinnedTracks: any[];
@@ -423,6 +435,8 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
423
435
  setShowCytobands(flag: boolean): void;
424
436
  setWidth(newWidth: number): void;
425
437
  setError(error: unknown): void;
438
+ setIsScalebarRefNameMenuOpen(isOpen: boolean): void;
439
+ setScalebarRefNameClickPending(pending: boolean): void;
426
440
  setHideHeader(b: boolean): void;
427
441
  setHideHeaderOverview(b: boolean): void;
428
442
  setHideNoTracksActive(b: boolean): void;
@@ -462,6 +476,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
462
476
  setDraggingTrackId(idx?: string): void;
463
477
  setLastTrackDragY(y: number): void;
464
478
  setScaleFactor(factor: number): void;
479
+ setTargetBpPerPx(target: number | undefined): void;
465
480
  clearView(): void;
466
481
  setInit(arg?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState): void;
467
482
  exportSvg(opts?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").ExportSvgOptions): Promise<void>;
@@ -483,6 +498,9 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
483
498
  readonly visibleLocStrings: string;
484
499
  readonly coarseVisibleLocStrings: string;
485
500
  readonly coarseTotalBpDisplayStr: string;
501
+ readonly effectiveBpPerPx: number;
502
+ readonly effectiveTotalBp: number;
503
+ readonly effectiveTotalBpDisplayStr: string;
486
504
  } & {
487
505
  setCoarseDynamicBlocks(blocks: import("@jbrowse/core/util/blockTypes").BlockSet): void;
488
506
  } & {
@@ -494,8 +512,8 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
494
512
  }): Promise<void>;
495
513
  navToLocation(parsedLocString: import("@jbrowse/core/util").ParsedLocString, assemblyName?: string, grow?: number): Promise<void>;
496
514
  navToLocations(regions: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string, grow?: number): Promise<void>;
497
- navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation): void;
498
- navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[]): void;
515
+ navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation, grow?: number): void;
516
+ navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[], grow?: number): void;
499
517
  } & {
500
518
  rubberBandMenuItems(): MenuItem[];
501
519
  bpToPx({ refName, coord, regionNumber, }: {
@@ -634,11 +652,14 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
634
652
  lastTrackDragY: undefined | number;
635
653
  volatileError: unknown;
636
654
  scaleFactor: number;
655
+ targetBpPerPx: number | undefined;
637
656
  trackRefs: Record<string, HTMLDivElement>;
638
657
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
639
658
  coarseTotalBp: number;
640
659
  leftOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
641
660
  rightOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
661
+ isScalebarRefNameMenuOpen: boolean;
662
+ scalebarRefNameClickPending: boolean;
642
663
  } & {
643
664
  readonly pinnedTracks: any[];
644
665
  readonly unpinnedTracks: any[];
@@ -692,6 +713,8 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
692
713
  setShowCytobands(flag: boolean): void;
693
714
  setWidth(newWidth: number): void;
694
715
  setError(error: unknown): void;
716
+ setIsScalebarRefNameMenuOpen(isOpen: boolean): void;
717
+ setScalebarRefNameClickPending(pending: boolean): void;
695
718
  setHideHeader(b: boolean): void;
696
719
  setHideHeaderOverview(b: boolean): void;
697
720
  setHideNoTracksActive(b: boolean): void;
@@ -731,6 +754,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
731
754
  setDraggingTrackId(idx?: string): void;
732
755
  setLastTrackDragY(y: number): void;
733
756
  setScaleFactor(factor: number): void;
757
+ setTargetBpPerPx(target: number | undefined): void;
734
758
  clearView(): void;
735
759
  setInit(arg?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").InitState): void;
736
760
  exportSvg(opts?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").ExportSvgOptions): Promise<void>;
@@ -752,6 +776,9 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
752
776
  readonly visibleLocStrings: string;
753
777
  readonly coarseVisibleLocStrings: string;
754
778
  readonly coarseTotalBpDisplayStr: string;
779
+ readonly effectiveBpPerPx: number;
780
+ readonly effectiveTotalBp: number;
781
+ readonly effectiveTotalBpDisplayStr: string;
755
782
  } & {
756
783
  setCoarseDynamicBlocks(blocks: import("@jbrowse/core/util/blockTypes").BlockSet): void;
757
784
  } & {
@@ -763,8 +790,8 @@ declare function stateModelFactory(pluginManager: PluginManager): import("@jbrow
763
790
  }): Promise<void>;
764
791
  navToLocation(parsedLocString: import("@jbrowse/core/util").ParsedLocString, assemblyName?: string, grow?: number): Promise<void>;
765
792
  navToLocations(regions: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string, grow?: number): Promise<void>;
766
- navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation): void;
767
- navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[]): void;
793
+ navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation, grow?: number): void;
794
+ navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[], grow?: number): void;
768
795
  } & {
769
796
  rubberBandMenuItems(): MenuItem[];
770
797
  bpToPx({ refName, coord, regionNumber, }: {
@@ -6,6 +6,9 @@ import { autorun, reaction } from 'mobx';
6
6
  import { drawCigarClickMap, drawMouseoverClickMap, drawRef, } from "./drawSynteny.js";
7
7
  export function doAfterAttach(self) {
8
8
  addDisposer(self, autorun(function syntenyDrawAutorun() {
9
+ if (self.isMinimized) {
10
+ return;
11
+ }
9
12
  const view = getContainingView(self);
10
13
  if (!view.initialized ||
11
14
  !view.views.every(a => a.displayedRegions.length > 0 && a.initialized)) {
@@ -24,6 +27,9 @@ export function doAfterAttach(self) {
24
27
  drawCigarClickMap(self, ctx3);
25
28
  }, { name: 'SyntenyDraw' }));
26
29
  addDisposer(self, autorun(function syntenyMouseoverAutorun() {
30
+ if (self.isMinimized) {
31
+ return;
32
+ }
27
33
  const view = getContainingView(self);
28
34
  if (!view.initialized ||
29
35
  !view.views.every(a => a.displayedRegions.length > 0 && a.initialized)) {
@@ -33,6 +39,9 @@ export function doAfterAttach(self) {
33
39
  drawMouseoverClickMap(self);
34
40
  }, { name: 'SyntenyMouseover' }));
35
41
  addDisposer(self, reaction(() => {
42
+ if (self.isMinimized) {
43
+ return { initialized: false };
44
+ }
36
45
  const view = getContainingView(self);
37
46
  return {
38
47
  bpPerPx: view.views.map(v => v.bpPerPx),
@@ -20,7 +20,7 @@ const useStyles = makeStyles()({
20
20
  },
21
21
  mouseoverCanvas: {
22
22
  position: 'absolute',
23
- pointEvents: 'none',
23
+ pointerEvents: 'none',
24
24
  },
25
25
  mainCanvas: {
26
26
  position: 'absolute',
@@ -101,7 +101,7 @@ const LinearSyntenyRendering = observer(function LinearSyntenyRendering({ model,
101
101
  const cigarClickMapCanvasRef = useCallback((ref) => {
102
102
  model.setCigarClickMapCanvasRef(ref);
103
103
  }, [model, height, width]);
104
- return (_jsxs("div", { className: classes.rel, children: [_jsx("canvas", { ref: mouseoverDetectionCanvasRef, width: width, height: height, className: classes.mouseoverCanvas }), _jsx("canvas", { ref: mainSyntenyCanvasRef, onMouseMove: event => {
104
+ return (_jsxs("div", { className: classes.rel, children: [_jsx("canvas", { ref: mainSyntenyCanvasRef, onMouseMove: event => {
105
105
  if (mouseCurrDownX !== undefined) {
106
106
  xOffset.current += mouseCurrDownX - event.clientX;
107
107
  setMouseCurrDownX(event.clientX);
@@ -137,26 +137,26 @@ const LinearSyntenyRendering = observer(function LinearSyntenyRendering({ model,
137
137
  setCurrY(clientY);
138
138
  const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
139
139
  const [r2, g2, b2] = ctx2.getImageData(x, y, 1, 1).data;
140
+ if (model.numFeats === 0) {
141
+ setTooltip('');
142
+ return;
143
+ }
140
144
  const unitMultiplier = Math.floor(MAX_COLOR_RANGE / model.numFeats);
141
145
  const id = getId(r1, g1, b1, unitMultiplier);
142
146
  model.setMouseoverId(model.featPositions[id]?.f.id());
143
- if (id === -1) {
147
+ if (id === -1 || !model.featPositions[id]) {
144
148
  setTooltip('');
145
149
  }
146
- else if (model.featPositions[id]) {
150
+ else {
147
151
  const { f, cigar } = model.featPositions[id];
148
152
  const unitMultiplier2 = Math.floor(MAX_COLOR_RANGE / cigar.length);
149
153
  const cigarIdx = getId(r2, g2, b2, unitMultiplier2);
150
- if (cigarIdx % 2 === 0 && (r2 !== 0 || g2 !== 0 || b2 !== 0)) {
151
- setTooltip(getTooltip({
152
- feature: f,
153
- cigarOp: cigar[cigarIdx + 1],
154
- cigarOpLen: cigar[cigarIdx],
155
- }));
156
- }
157
- else {
158
- setTooltip('');
159
- }
154
+ const hasCigarData = cigarIdx % 2 === 0 && (r2 !== 0 || g2 !== 0 || b2 !== 0);
155
+ setTooltip(getTooltip({
156
+ feature: f,
157
+ cigarOp: hasCigarData ? cigar[cigarIdx + 1] : undefined,
158
+ cigarOpLen: hasCigarData ? cigar[cigarIdx] : undefined,
159
+ }));
160
160
  }
161
161
  }
162
162
  }, onMouseLeave: () => {
@@ -174,7 +174,7 @@ const LinearSyntenyRendering = observer(function LinearSyntenyRendering({ model,
174
174
  }
175
175
  }, onContextMenu: evt => {
176
176
  onSynContextClick(evt, model, setAnchorEl);
177
- }, "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
+ }, "data-testid": "synteny_canvas", className: classes.mainCanvas, width: width, height: height }), _jsx("canvas", { ref: mouseoverDetectionCanvasRef, width: width, height: height, className: classes.mouseoverCanvas }), _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: () => {
178
178
  setAnchorEl(undefined);
179
179
  } })) : null] }));
180
180
  });
@@ -35,6 +35,7 @@ export declare function draw(ctx: CanvasRenderingContext2D, x1: number, x2: numb
35
35
  export declare function drawLocationMarkers(ctx: CanvasRenderingContext2D, x1: number, x2: number, y1: number, x3: number, x4: number, y2: number, mid: number, bpPerPx1: number, bpPerPx2: number, drawCurves?: boolean): void;
36
36
  export declare function drawBox(ctx: CanvasRenderingContext2D, x1: number, x2: number, y1: number, x3: number, x4: number, y2: number): void;
37
37
  export declare function drawBezierBox(ctx: CanvasRenderingContext2D, x1: number, x2: number, y1: number, x3: number, x4: number, y2: number, mid: number): void;
38
+ export declare function getFeatureAtClick(event: React.MouseEvent, model: LinearSyntenyDisplayModel): import("../model.ts").FeatPos | undefined;
38
39
  export declare function onSynClick(event: React.MouseEvent, model: LinearSyntenyDisplayModel): import("../model.ts").FeatPos | undefined;
39
40
  export declare function onSynContextClick(event: React.MouseEvent, model: LinearSyntenyDisplayModel, setAnchorEl: (arg: ClickCoord) => void): void;
40
41
  export declare function getTooltip({ feature, cigarOp, cigarOpLen, }: {
@@ -102,35 +102,37 @@ export function drawBezierBox(ctx, x1, x2, y1, x3, x4, y2, mid) {
102
102
  ctx.bezierCurveTo(x4, mid, x1, mid, x1, y1);
103
103
  ctx.closePath();
104
104
  }
105
- export function onSynClick(event, model) {
106
- const view = getContainingView(model);
107
- const track = getContainingTrack(model);
108
- const { featPositions, numFeats, clickMapCanvas: ref1, cigarClickMapCanvas: ref2, level, } = model;
109
- if (!ref1 || !ref2) {
110
- return;
105
+ export function getFeatureAtClick(event, model) {
106
+ const { clickMapCanvas, numFeats, featPositions } = model;
107
+ if (!clickMapCanvas) {
108
+ return undefined;
111
109
  }
112
- const rect = ref1.getBoundingClientRect();
113
- const ctx1 = ref1.getContext('2d');
114
- const ctx2 = ref2.getContext('2d');
115
- if (!ctx1 || !ctx2) {
116
- return;
110
+ const ctx = clickMapCanvas.getContext('2d');
111
+ if (!ctx) {
112
+ return undefined;
117
113
  }
114
+ const rect = clickMapCanvas.getBoundingClientRect();
118
115
  const x = event.clientX - rect.left;
119
116
  const y = event.clientY - rect.top;
120
- const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
117
+ const [r, g, b] = ctx.getImageData(x, y, 1, 1).data;
121
118
  const unitMultiplier = Math.floor(MAX_COLOR_RANGE / numFeats);
122
- const id = getId(r1, g1, b1, unitMultiplier);
123
- const feat = featPositions[id];
119
+ const id = getId(r, g, b, unitMultiplier);
120
+ return featPositions[id];
121
+ }
122
+ export function onSynClick(event, model) {
123
+ const feat = getFeatureAtClick(event, model);
124
124
  if (feat) {
125
125
  const { f } = feat;
126
126
  model.setClickId(f.id());
127
127
  const session = getSession(model);
128
128
  if (isSessionModelWithWidgets(session)) {
129
+ const view = getContainingView(model);
130
+ const track = getContainingTrack(model);
129
131
  session.showWidget(session.addWidget('SyntenyFeatureWidget', 'syntenyFeature', {
130
132
  view,
131
133
  track,
132
134
  featureData: f.toJSON(),
133
- level,
135
+ level: model.level,
134
136
  }));
135
137
  }
136
138
  }
@@ -138,30 +140,13 @@ export function onSynClick(event, model) {
138
140
  }
139
141
  export function onSynContextClick(event, model, setAnchorEl) {
140
142
  event.preventDefault();
141
- const ref1 = model.clickMapCanvas;
142
- const ref2 = model.cigarClickMapCanvas;
143
- if (!ref1 || !ref2) {
144
- return;
145
- }
146
- const rect = ref1.getBoundingClientRect();
147
- const ctx1 = ref1.getContext('2d');
148
- const ctx2 = ref2.getContext('2d');
149
- if (!ctx1 || !ctx2) {
150
- return;
151
- }
152
- const { clientX, clientY } = event;
153
- const x = clientX - rect.left;
154
- const y = clientY - rect.top;
155
- const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
156
- const unitMultiplier = Math.floor(MAX_COLOR_RANGE / model.numFeats);
157
- const id = getId(r1, g1, b1, unitMultiplier);
158
- const f = model.featPositions[id];
159
- if (f) {
160
- model.setClickId(f.f.id());
143
+ const feat = getFeatureAtClick(event, model);
144
+ if (feat) {
145
+ model.setClickId(feat.f.id());
161
146
  setAnchorEl({
162
- clientX,
163
- clientY,
164
- feature: f,
147
+ clientX: event.clientX,
148
+ clientY: event.clientY,
149
+ feature: feat,
165
150
  });
166
151
  }
167
152
  }
@@ -0,0 +1,2 @@
1
+ import type { LinearSyntenyDisplayModel } from './model.ts';
2
+ export declare function drawCigarClickMap(model: LinearSyntenyDisplayModel, cigarClickMapCanvas: CanvasRenderingContext2D): void;
@@ -0,0 +1,88 @@
1
+ import { doesIntersect2, getContainingView } from '@jbrowse/core/util';
2
+ import { draw } from "./components/util.js";
3
+ import { MAX_COLOR_RANGE, lineLimit, makeColor, oobLimit, } from "./drawSyntenyUtils.js";
4
+ export function drawCigarClickMap(model, cigarClickMapCanvas) {
5
+ const view = getContainingView(model);
6
+ const drawCurves = view.drawCurves;
7
+ const drawCIGAR = view.drawCIGAR;
8
+ const drawCIGARMatchesOnly = view.drawCIGARMatchesOnly;
9
+ const { level, height, featPositions } = model;
10
+ const width = view.width;
11
+ const bpPerPxs = view.views.map(v => v.bpPerPx);
12
+ cigarClickMapCanvas.imageSmoothingEnabled = false;
13
+ cigarClickMapCanvas.clearRect(0, 0, width, height);
14
+ const offsets = view.views.map(v => v.offsetPx);
15
+ const bpPerPxInv0 = 1 / bpPerPxs[level];
16
+ const bpPerPxInv1 = 1 / bpPerPxs[level + 1];
17
+ for (const { p11, p12, p21, p22, f, cigar } of featPositions) {
18
+ const x11 = p11.offsetPx - offsets[level];
19
+ const x12 = p12.offsetPx - offsets[level];
20
+ const x21 = p21.offsetPx - offsets[level + 1];
21
+ const x22 = p22.offsetPx - offsets[level + 1];
22
+ const l1 = Math.abs(x12 - x11);
23
+ const l2 = Math.abs(x22 - x21);
24
+ const minX = Math.min(x21, x22);
25
+ const maxX = Math.max(x21, x22);
26
+ const y1 = 0;
27
+ const y2 = height;
28
+ const mid = (y2 - y1) / 2;
29
+ if (!(l1 <= lineLimit && l2 <= lineLimit) &&
30
+ doesIntersect2(minX, maxX, -oobLimit, view.width + oobLimit)) {
31
+ const s1 = f.get('strand');
32
+ const k1 = s1 === -1 ? x12 : x11;
33
+ const k2 = s1 === -1 ? x11 : x12;
34
+ const rev1 = k1 < k2 ? 1 : -1;
35
+ const rev2 = (x21 < x22 ? 1 : -1) * s1;
36
+ let cx1 = k1;
37
+ let cx2 = s1 === -1 ? x22 : x21;
38
+ if (cigar.length && drawCIGAR) {
39
+ let continuingFlag = false;
40
+ let px1 = 0;
41
+ let px2 = 0;
42
+ const unitMultiplier2 = Math.floor(MAX_COLOR_RANGE / cigar.length);
43
+ for (let j = 0; j < cigar.length; j += 2) {
44
+ const len = +cigar[j];
45
+ const op = cigar[j + 1];
46
+ if (!continuingFlag) {
47
+ px1 = cx1;
48
+ px2 = cx2;
49
+ }
50
+ const d1 = len * bpPerPxInv0;
51
+ const d2 = len * bpPerPxInv1;
52
+ if (op === 'M' || op === '=' || op === 'X') {
53
+ cx1 += d1 * rev1;
54
+ cx2 += d2 * rev2;
55
+ }
56
+ else if (op === 'D' || op === 'N') {
57
+ cx1 += d1 * rev1;
58
+ }
59
+ else if (op === 'I') {
60
+ cx2 += d2 * rev2;
61
+ }
62
+ if (!(Math.max(px1, px2, cx1, cx2) < 0 ||
63
+ Math.min(px1, px2, cx1, cx2) > width)) {
64
+ const isNotLast = j < cigar.length - 2;
65
+ if (Math.abs(cx1 - px1) <= 1 &&
66
+ Math.abs(cx2 - px2) <= 1 &&
67
+ isNotLast) {
68
+ continuingFlag = true;
69
+ }
70
+ else {
71
+ continuingFlag = false;
72
+ const shouldDraw = !drawCIGARMatchesOnly ||
73
+ ((op === 'M' || op === '=' || op === 'X') &&
74
+ Math.abs(cx1 - px1) > 1 &&
75
+ Math.abs(cx2 - px2) > 1);
76
+ if (shouldDraw) {
77
+ const idx = j * unitMultiplier2 + 1;
78
+ cigarClickMapCanvas.fillStyle = makeColor(idx);
79
+ draw(cigarClickMapCanvas, px1, cx1, y1, cx2, px2, y2, mid, drawCurves);
80
+ cigarClickMapCanvas.fill();
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }