jbrowse-plugin-protein3d 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ProteinView/components/ProteinAlignment.js +18 -4
- package/dist/ProteinView/components/ProteinViewHeader.js +1 -1
- package/dist/ProteinView/model.js +1 -1
- package/dist/jbrowse-plugin-protein3d.umd.production.min.js +9 -9
- package/dist/jbrowse-plugin-protein3d.umd.production.min.js.map +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/ProteinView/components/ProteinAlignment.tsx +17 -5
- package/src/ProteinView/components/ProteinViewHeader.tsx +1 -1
- package/src/ProteinView/model.ts +1 -1
- package/src/version.ts +1 -1
|
@@ -29,16 +29,30 @@ const ProteinAlignment = observer(function ProteinAlignment({ model, }) {
|
|
|
29
29
|
const containerRef = useRef(null);
|
|
30
30
|
const scrolledToSelectionRef = useRef(false);
|
|
31
31
|
const { data: featureData, isLoading: featureLoading, error: featureError, } = useProteinFeatureTrackData(model, uniprotId);
|
|
32
|
+
// Follow the hovered column, but only when it has scrolled off-screen, and
|
|
33
|
+
// then only far enough to bring it back to the nearest edge. Re-centering on
|
|
34
|
+
// every hover (the old behavior) made the panel drift continuously as the
|
|
35
|
+
// cursor moved; scroll-into-view keeps it still whenever the column is
|
|
36
|
+
// already visible.
|
|
32
37
|
useEffect(() => autorun(() => {
|
|
33
38
|
const container = containerRef.current;
|
|
34
39
|
if (model.autoScrollAlignment &&
|
|
35
40
|
!model.isMouseInAlignment &&
|
|
36
41
|
model.alignmentHoverPos !== undefined &&
|
|
37
42
|
container) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
const x = model.alignmentHoverPos * CHAR_WIDTH;
|
|
44
|
+
const margin = CHAR_WIDTH * 4;
|
|
45
|
+
const viewStart = container.scrollLeft;
|
|
46
|
+
const viewEnd = viewStart + container.clientWidth;
|
|
47
|
+
if (x < viewStart + margin) {
|
|
48
|
+
container.scrollTo({ left: x - margin, behavior: 'smooth' });
|
|
49
|
+
}
|
|
50
|
+
else if (x > viewEnd - margin) {
|
|
51
|
+
container.scrollTo({
|
|
52
|
+
left: x - container.clientWidth + margin,
|
|
53
|
+
behavior: 'smooth',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
42
56
|
}
|
|
43
57
|
}), [model]);
|
|
44
58
|
// Scroll the persistent selection into view once it first resolves, so a
|