@jbrowse/plugin-dotplot-view 3.6.4 → 3.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.
- package/dist/DiagonalizeDotplotRpc.d.ts +30 -0
- package/dist/DiagonalizeDotplotRpc.js +156 -0
- package/dist/DotplotDisplay/renderDotplotBlock.js +3 -0
- package/dist/DotplotDisplay/stateModelFactory.d.ts +6 -0
- package/dist/DotplotDisplay/stateModelFactory.js +15 -0
- package/dist/DotplotRenderer/DotplotRenderer.d.ts +3 -12
- package/dist/DotplotRenderer/clamp.d.ts +7 -0
- package/dist/DotplotRenderer/clamp.js +62 -0
- package/dist/DotplotRenderer/drawDotplot.d.ts +5 -4
- package/dist/DotplotRenderer/drawDotplot.js +92 -96
- package/dist/DotplotView/1dview.js +5 -3
- package/dist/DotplotView/components/ColorBySelector.d.ts +5 -0
- package/dist/DotplotView/components/ColorBySelector.js +79 -0
- package/dist/DotplotView/components/DiagonalizationProgressDialog.d.ts +6 -0
- package/dist/DotplotView/components/DiagonalizationProgressDialog.js +125 -0
- package/dist/DotplotView/components/DotplotControls.js +84 -12
- package/dist/DotplotView/components/DotplotTooltips.d.ts +15 -0
- package/dist/DotplotView/components/DotplotTooltips.js +43 -0
- package/dist/DotplotView/components/DotplotView.js +16 -191
- package/dist/DotplotView/components/DotplotWarnings.js +3 -3
- package/dist/DotplotView/components/ImportForm/index.js +0 -1
- package/dist/DotplotView/components/MinLengthSlider.d.ts +5 -0
- package/dist/DotplotView/components/MinLengthSlider.js +44 -0
- package/dist/DotplotView/components/MouseInteractionLayer.d.ts +17 -0
- package/dist/DotplotView/components/MouseInteractionLayer.js +18 -0
- package/dist/DotplotView/components/OpacitySlider.d.ts +5 -0
- package/dist/DotplotView/components/OpacitySlider.js +43 -0
- package/dist/DotplotView/components/SelectionContextMenu.d.ts +13 -0
- package/dist/DotplotView/components/SelectionContextMenu.js +42 -0
- package/dist/DotplotView/components/SliderTooltip.d.ts +2 -0
- package/dist/DotplotView/components/SliderTooltip.js +9 -0
- package/dist/DotplotView/components/hooks/useCtrlKeyTracking.d.ts +1 -0
- package/dist/DotplotView/components/hooks/useCtrlKeyTracking.js +24 -0
- package/dist/DotplotView/components/hooks/useCursorMode.d.ts +7 -0
- package/dist/DotplotView/components/hooks/useCursorMode.js +19 -0
- package/dist/DotplotView/components/hooks/useMouseCoordinates.d.ts +29 -0
- package/dist/DotplotView/components/hooks/useMouseCoordinates.js +52 -0
- package/dist/DotplotView/components/hooks/useMouseMoveHandler.d.ts +6 -0
- package/dist/DotplotView/components/hooks/useMouseMoveHandler.js +27 -0
- package/dist/DotplotView/components/hooks/useMouseUpHandler.d.ts +3 -0
- package/dist/DotplotView/components/hooks/useMouseUpHandler.js +31 -0
- package/dist/DotplotView/components/hooks/useWheelHandler.d.ts +8 -0
- package/dist/DotplotView/components/hooks/useWheelHandler.js +47 -0
- package/dist/DotplotView/components/util.js +1 -3
- package/dist/DotplotView/model.d.ts +5 -0
- package/dist/DotplotView/model.js +35 -20
- package/dist/ServerSideRenderedBlockContent.js +3 -20
- package/dist/index.js +2 -0
- package/esm/DiagonalizeDotplotRpc.d.ts +30 -0
- package/esm/DiagonalizeDotplotRpc.js +150 -0
- package/esm/DotplotDisplay/renderDotplotBlock.js +3 -0
- package/esm/DotplotDisplay/stateModelFactory.d.ts +6 -0
- package/esm/DotplotDisplay/stateModelFactory.js +15 -0
- package/esm/DotplotRenderer/DotplotRenderer.d.ts +3 -12
- package/esm/DotplotRenderer/clamp.d.ts +7 -0
- package/esm/DotplotRenderer/clamp.js +58 -0
- package/esm/DotplotRenderer/drawDotplot.d.ts +5 -4
- package/esm/DotplotRenderer/drawDotplot.js +92 -96
- package/esm/DotplotView/1dview.js +5 -3
- package/esm/DotplotView/components/ColorBySelector.d.ts +5 -0
- package/esm/DotplotView/components/ColorBySelector.js +74 -0
- package/esm/DotplotView/components/DiagonalizationProgressDialog.d.ts +6 -0
- package/esm/DotplotView/components/DiagonalizationProgressDialog.js +123 -0
- package/esm/DotplotView/components/DotplotControls.js +52 -13
- package/esm/DotplotView/components/DotplotTooltips.d.ts +15 -0
- package/esm/DotplotView/components/DotplotTooltips.js +7 -0
- package/esm/DotplotView/components/DotplotView.js +17 -159
- package/esm/DotplotView/components/DotplotWarnings.js +4 -4
- package/esm/DotplotView/components/ImportForm/index.js +0 -1
- package/esm/DotplotView/components/MinLengthSlider.d.ts +5 -0
- package/esm/DotplotView/components/MinLengthSlider.js +39 -0
- package/esm/DotplotView/components/MouseInteractionLayer.d.ts +17 -0
- package/esm/DotplotView/components/MouseInteractionLayer.js +12 -0
- package/esm/DotplotView/components/OpacitySlider.d.ts +5 -0
- package/esm/DotplotView/components/OpacitySlider.js +38 -0
- package/esm/DotplotView/components/SelectionContextMenu.d.ts +13 -0
- package/esm/DotplotView/components/SelectionContextMenu.js +39 -0
- package/esm/DotplotView/components/SliderTooltip.d.ts +2 -0
- package/esm/DotplotView/components/SliderTooltip.js +6 -0
- package/esm/DotplotView/components/hooks/useCtrlKeyTracking.d.ts +1 -0
- package/esm/DotplotView/components/hooks/useCtrlKeyTracking.js +21 -0
- package/esm/DotplotView/components/hooks/useCursorMode.d.ts +7 -0
- package/esm/DotplotView/components/hooks/useCursorMode.js +16 -0
- package/esm/DotplotView/components/hooks/useMouseCoordinates.d.ts +29 -0
- package/esm/DotplotView/components/hooks/useMouseCoordinates.js +49 -0
- package/esm/DotplotView/components/hooks/useMouseMoveHandler.d.ts +6 -0
- package/esm/DotplotView/components/hooks/useMouseMoveHandler.js +24 -0
- package/esm/DotplotView/components/hooks/useMouseUpHandler.d.ts +3 -0
- package/esm/DotplotView/components/hooks/useMouseUpHandler.js +28 -0
- package/esm/DotplotView/components/hooks/useWheelHandler.d.ts +8 -0
- package/esm/DotplotView/components/hooks/useWheelHandler.js +44 -0
- package/esm/DotplotView/components/util.js +1 -3
- package/esm/DotplotView/model.d.ts +5 -0
- package/esm/DotplotView/model.js +35 -20
- package/esm/ServerSideRenderedBlockContent.js +4 -21
- package/esm/index.js +2 -0
- package/package.json +4 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export function useCtrlKeyTracking(setCtrlKeyDown) {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
function globalCtrlKeyDown(event) {
|
|
5
|
+
if (event.metaKey || event.ctrlKey) {
|
|
6
|
+
setCtrlKeyDown(true);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
function globalCtrlKeyUp(event) {
|
|
10
|
+
if (!event.metaKey && !event.ctrlKey) {
|
|
11
|
+
setCtrlKeyDown(false);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
window.addEventListener('keydown', globalCtrlKeyDown);
|
|
15
|
+
window.addEventListener('keyup', globalCtrlKeyUp);
|
|
16
|
+
return () => {
|
|
17
|
+
window.removeEventListener('keydown', globalCtrlKeyDown);
|
|
18
|
+
window.removeEventListener('keyup', globalCtrlKeyUp);
|
|
19
|
+
};
|
|
20
|
+
}, [setCtrlKeyDown]);
|
|
21
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function useCursorMode(cursorMode: string): {
|
|
2
|
+
ctrlKeyDown: boolean;
|
|
3
|
+
validPan: boolean;
|
|
4
|
+
validSelect: boolean;
|
|
5
|
+
setCtrlKeyWasUsed: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
6
|
+
setCtrlKeyDown: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
export function useCursorMode(cursorMode) {
|
|
3
|
+
const [ctrlKeyWasUsed, setCtrlKeyWasUsed] = useState(false);
|
|
4
|
+
const [ctrlKeyDown, setCtrlKeyDown] = useState(false);
|
|
5
|
+
const validPan = (cursorMode === 'move' && !ctrlKeyWasUsed) ||
|
|
6
|
+
(cursorMode === 'crosshair' && ctrlKeyWasUsed);
|
|
7
|
+
const validSelect = (cursorMode === 'move' && ctrlKeyWasUsed) ||
|
|
8
|
+
(cursorMode === 'crosshair' && !ctrlKeyWasUsed);
|
|
9
|
+
return {
|
|
10
|
+
ctrlKeyDown,
|
|
11
|
+
validPan,
|
|
12
|
+
validSelect,
|
|
13
|
+
setCtrlKeyWasUsed,
|
|
14
|
+
setCtrlKeyDown,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
type Coord = [number, number] | undefined;
|
|
2
|
+
interface Rect {
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function useMouseCoordinates(): {
|
|
9
|
+
mousecurrClient: Coord;
|
|
10
|
+
mousedownClient: Coord;
|
|
11
|
+
mouseupClient: Coord;
|
|
12
|
+
mouseOvered: boolean;
|
|
13
|
+
setMouseCurrClient: import("react").Dispatch<import("react").SetStateAction<Coord>>;
|
|
14
|
+
setMouseDownClient: import("react").Dispatch<import("react").SetStateAction<Coord>>;
|
|
15
|
+
setMouseUpClient: import("react").Dispatch<import("react").SetStateAction<Coord>>;
|
|
16
|
+
setMouseOvered: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
17
|
+
ref: import("react").RefObject<HTMLDivElement | null>;
|
|
18
|
+
root: import("react").RefObject<HTMLDivElement | null>;
|
|
19
|
+
svg: Rect;
|
|
20
|
+
rootRect: Rect;
|
|
21
|
+
mousedown: Coord;
|
|
22
|
+
mousecurr: Coord;
|
|
23
|
+
mouseup: Coord;
|
|
24
|
+
mouserect: Coord;
|
|
25
|
+
mouserectClient: Coord;
|
|
26
|
+
xdistance: number;
|
|
27
|
+
ydistance: number;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
const blank = { left: 0, top: 0, width: 0, height: 0 };
|
|
3
|
+
function getOffset(coord, rect) {
|
|
4
|
+
return coord && [coord[0] - rect.left, coord[1] - rect.top];
|
|
5
|
+
}
|
|
6
|
+
export function useMouseCoordinates() {
|
|
7
|
+
const [mousecurrClient, setMouseCurrClient] = useState();
|
|
8
|
+
const [mousedownClient, setMouseDownClient] = useState();
|
|
9
|
+
const [mouseupClient, setMouseUpClient] = useState();
|
|
10
|
+
const [mouseOvered, setMouseOvered] = useState(false);
|
|
11
|
+
const [rect, setRect] = useState(blank);
|
|
12
|
+
const ref = useRef(null);
|
|
13
|
+
const root = useRef(null);
|
|
14
|
+
useLayoutEffect(() => {
|
|
15
|
+
if (ref.current) {
|
|
16
|
+
setRect(ref.current.getBoundingClientRect());
|
|
17
|
+
}
|
|
18
|
+
}, [mousecurrClient, mousedownClient, mouseupClient]);
|
|
19
|
+
const svg = rect;
|
|
20
|
+
const rootRect = rect;
|
|
21
|
+
const mousedown = getOffset(mousedownClient, rect);
|
|
22
|
+
const mousecurr = getOffset(mousecurrClient, rect);
|
|
23
|
+
const mouseup = getOffset(mouseupClient, rect);
|
|
24
|
+
const mouserect = mouseup || mousecurr;
|
|
25
|
+
const mouserectClient = mouseupClient || mousecurrClient;
|
|
26
|
+
const xdistance = mousedown && mouserect ? mouserect[0] - mousedown[0] : 0;
|
|
27
|
+
const ydistance = mousedown && mouserect ? mouserect[1] - mousedown[1] : 0;
|
|
28
|
+
return {
|
|
29
|
+
mousecurrClient,
|
|
30
|
+
mousedownClient,
|
|
31
|
+
mouseupClient,
|
|
32
|
+
mouseOvered,
|
|
33
|
+
setMouseCurrClient,
|
|
34
|
+
setMouseDownClient,
|
|
35
|
+
setMouseUpClient,
|
|
36
|
+
setMouseOvered,
|
|
37
|
+
ref,
|
|
38
|
+
root,
|
|
39
|
+
svg,
|
|
40
|
+
rootRect,
|
|
41
|
+
mousedown,
|
|
42
|
+
mousecurr,
|
|
43
|
+
mouseup,
|
|
44
|
+
mouserect,
|
|
45
|
+
mouserectClient,
|
|
46
|
+
xdistance,
|
|
47
|
+
ydistance,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type Coord = [number, number] | undefined;
|
|
2
|
+
interface View {
|
|
3
|
+
scroll: (distance: number) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function useMouseMoveHandler(mousecurrClient: Coord, mousedownClient: Coord, mouseupClient: Coord, validPan: boolean, hview: View, vview: View, setMouseCurrClient: (coord: Coord) => void): void;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export function useMouseMoveHandler(mousecurrClient, mousedownClient, mouseupClient, validPan, hview, vview, setMouseCurrClient) {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
function globalMouseMove(event) {
|
|
5
|
+
setMouseCurrClient([event.clientX, event.clientY]);
|
|
6
|
+
if (mousecurrClient && mousedownClient && validPan && !mouseupClient) {
|
|
7
|
+
hview.scroll(-event.clientX + mousecurrClient[0]);
|
|
8
|
+
vview.scroll(event.clientY - mousecurrClient[1]);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
window.addEventListener('mousemove', globalMouseMove);
|
|
12
|
+
return () => {
|
|
13
|
+
window.removeEventListener('mousemove', globalMouseMove);
|
|
14
|
+
};
|
|
15
|
+
}, [
|
|
16
|
+
validPan,
|
|
17
|
+
mousecurrClient,
|
|
18
|
+
mousedownClient,
|
|
19
|
+
mouseupClient,
|
|
20
|
+
hview,
|
|
21
|
+
vview,
|
|
22
|
+
setMouseCurrClient,
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
type Coord = [number, number] | undefined;
|
|
2
|
+
export declare function useMouseUpHandler(mousedown: Coord, mouseup: Coord, xdistance: number, ydistance: number, validSelect: boolean, setMouseUpClient: (coord: Coord) => void, setMouseDownClient: (coord: Coord) => void): void;
|
|
3
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
export function useMouseUpHandler(mousedown, mouseup, xdistance, ydistance, validSelect, setMouseUpClient, setMouseDownClient) {
|
|
3
|
+
useEffect(() => {
|
|
4
|
+
function globalMouseUp(event) {
|
|
5
|
+
if (Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 && validSelect) {
|
|
6
|
+
setMouseUpClient([event.clientX, event.clientY]);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
setMouseDownClient(undefined);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (mousedown && !mouseup) {
|
|
13
|
+
window.addEventListener('mouseup', globalMouseUp, true);
|
|
14
|
+
return () => {
|
|
15
|
+
window.removeEventListener('mouseup', globalMouseUp, true);
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return () => { };
|
|
19
|
+
}, [
|
|
20
|
+
validSelect,
|
|
21
|
+
mousedown,
|
|
22
|
+
mouseup,
|
|
23
|
+
xdistance,
|
|
24
|
+
ydistance,
|
|
25
|
+
setMouseUpClient,
|
|
26
|
+
setMouseDownClient,
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type Coord = [number, number] | undefined;
|
|
2
|
+
interface View {
|
|
3
|
+
scroll: (distance: number) => void;
|
|
4
|
+
zoomTo: (bpPerPx: number, position: number) => void;
|
|
5
|
+
bpPerPx: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function useWheelHandler(ref: React.RefObject<HTMLDivElement | null>, wheelMode: string, hview: View, vview: View, mousecurr: Coord, rootRectHeight: number): void;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { transaction } from 'mobx';
|
|
3
|
+
export function useWheelHandler(ref, wheelMode, hview, vview, mousecurr, rootRectHeight) {
|
|
4
|
+
const distanceX = useRef(0);
|
|
5
|
+
const distanceY = useRef(0);
|
|
6
|
+
const scheduled = useRef(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
function onWheel(event) {
|
|
9
|
+
event.preventDefault();
|
|
10
|
+
distanceX.current += event.deltaX;
|
|
11
|
+
distanceY.current -= event.deltaY;
|
|
12
|
+
if (!scheduled.current) {
|
|
13
|
+
scheduled.current = true;
|
|
14
|
+
window.requestAnimationFrame(() => {
|
|
15
|
+
transaction(() => {
|
|
16
|
+
if (wheelMode === 'pan') {
|
|
17
|
+
hview.scroll(distanceX.current / 3);
|
|
18
|
+
vview.scroll(distanceY.current / 10);
|
|
19
|
+
}
|
|
20
|
+
else if (wheelMode === 'zoom') {
|
|
21
|
+
if (Math.abs(distanceY.current) > Math.abs(distanceX.current) * 2 &&
|
|
22
|
+
mousecurr) {
|
|
23
|
+
const val = distanceY.current < 0 ? 1.1 : 0.9;
|
|
24
|
+
hview.zoomTo(hview.bpPerPx * val, mousecurr[0]);
|
|
25
|
+
vview.zoomTo(vview.bpPerPx * val, rootRectHeight - mousecurr[1]);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
scheduled.current = false;
|
|
30
|
+
distanceX.current = 0;
|
|
31
|
+
distanceY.current = 0;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (ref.current) {
|
|
36
|
+
const curr = ref.current;
|
|
37
|
+
curr.addEventListener('wheel', onWheel);
|
|
38
|
+
return () => {
|
|
39
|
+
curr.removeEventListener('wheel', onWheel);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return () => { };
|
|
43
|
+
}, [hview, vview, wheelMode, mousecurr, rootRectHeight, ref]);
|
|
44
|
+
}
|
|
@@ -28,9 +28,7 @@ export function getBlockLabelKeysToHide(blocks, length, viewOffsetPx) {
|
|
|
28
28
|
export function chooseGridPitch(scale, minMajorPitchPx, minMinorPitchPx) {
|
|
29
29
|
scale = Math.abs(scale);
|
|
30
30
|
const minMajorPitchBp = minMajorPitchPx * scale;
|
|
31
|
-
const majorMagnitude = +
|
|
32
|
-
.toExponential()
|
|
33
|
-
.split(/e/i)[1];
|
|
31
|
+
const majorMagnitude = +minMajorPitchBp.toExponential().split(/e/i)[1];
|
|
34
32
|
let majorPitch = 10 ** majorMagnitude;
|
|
35
33
|
while (majorPitch < minMajorPitchBp) {
|
|
36
34
|
majorPitch *= 2;
|
|
@@ -390,6 +390,7 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
|
|
|
390
390
|
setError(e: unknown): void;
|
|
391
391
|
zoomOut(): void;
|
|
392
392
|
zoomIn(): void;
|
|
393
|
+
} & {
|
|
393
394
|
activateTrackSelector(): import("@jbrowse/core/util").Widget;
|
|
394
395
|
showTrack(trackId: string, initialSnapshot?: {}): void;
|
|
395
396
|
hideTrack(trackId: string): number;
|
|
@@ -408,6 +409,10 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
|
|
|
408
409
|
reversed?: boolean;
|
|
409
410
|
}[] | undefined;
|
|
410
411
|
zoomInToMouseCoords(mousedown: Coord, mouseup: Coord): void;
|
|
412
|
+
calculateBorders(): {
|
|
413
|
+
borderX: number;
|
|
414
|
+
borderY: number;
|
|
415
|
+
};
|
|
411
416
|
showAllRegions(): void;
|
|
412
417
|
onDotplotView(mousedown: Coord, mouseup: Coord): void;
|
|
413
418
|
} & {
|
package/esm/DotplotView/model.js
CHANGED
|
@@ -172,6 +172,8 @@ export default function stateModelFactory(pm) {
|
|
|
172
172
|
self.hview.zoomIn();
|
|
173
173
|
self.vview.zoomIn();
|
|
174
174
|
},
|
|
175
|
+
}))
|
|
176
|
+
.actions(self => ({
|
|
175
177
|
activateTrackSelector() {
|
|
176
178
|
if (self.trackSelectorType === 'hierarchical') {
|
|
177
179
|
const session = getSession(self);
|
|
@@ -249,7 +251,31 @@ export default function stateModelFactory(pm) {
|
|
|
249
251
|
self.vview.moveTo(y2, y1);
|
|
250
252
|
}
|
|
251
253
|
},
|
|
254
|
+
calculateBorders() {
|
|
255
|
+
if (self.volatileWidth === undefined) {
|
|
256
|
+
return { borderX: self.borderX, borderY: self.borderY };
|
|
257
|
+
}
|
|
258
|
+
const { vview, hview, viewHeight, viewWidth } = self;
|
|
259
|
+
const padding = 40;
|
|
260
|
+
const vblocks = vview.dynamicBlocks.contentBlocks;
|
|
261
|
+
const hblocks = hview.dynamicBlocks.contentBlocks;
|
|
262
|
+
const hoffset = hview.offsetPx;
|
|
263
|
+
const voffset = vview.offsetPx;
|
|
264
|
+
const vhide = getBlockLabelKeysToHide(vblocks, viewHeight, voffset);
|
|
265
|
+
const hhide = getBlockLabelKeysToHide(hblocks, viewWidth, hoffset);
|
|
266
|
+
const by = pxWidthForBlocks(hblocks, vview.bpPerPx, hhide);
|
|
267
|
+
const bx = pxWidthForBlocks(vblocks, hview.bpPerPx, vhide);
|
|
268
|
+
return {
|
|
269
|
+
borderX: Math.max(bx + padding, 50),
|
|
270
|
+
borderY: Math.max(by + padding, 50),
|
|
271
|
+
};
|
|
272
|
+
},
|
|
252
273
|
showAllRegions() {
|
|
274
|
+
self.hview.zoomTo(self.hview.maxBpPerPx);
|
|
275
|
+
self.vview.zoomTo(self.vview.maxBpPerPx);
|
|
276
|
+
const { borderX, borderY } = this.calculateBorders();
|
|
277
|
+
self.setBorderX(borderX);
|
|
278
|
+
self.setBorderY(borderY);
|
|
253
279
|
self.hview.zoomTo(self.hview.maxBpPerPx);
|
|
254
280
|
self.vview.zoomTo(self.vview.maxBpPerPx);
|
|
255
281
|
self.vview.center();
|
|
@@ -343,17 +369,15 @@ export default function stateModelFactory(pm) {
|
|
|
343
369
|
!self.assembliesInitialized) {
|
|
344
370
|
return;
|
|
345
371
|
}
|
|
346
|
-
|
|
347
|
-
|
|
372
|
+
const { hview, assemblyNames, vview } = self;
|
|
373
|
+
if (hview.displayedRegions.length &&
|
|
374
|
+
vview.displayedRegions.length) {
|
|
348
375
|
return;
|
|
349
376
|
}
|
|
350
|
-
const views = [self.hview, self.vview];
|
|
351
377
|
transaction(() => {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
view.setDisplayedRegions((assembly === null || assembly === void 0 ? void 0 : assembly.regions) || []);
|
|
356
|
-
}
|
|
378
|
+
var _a, _b;
|
|
379
|
+
hview.setDisplayedRegions(((_a = session.assemblyManager.get(assemblyNames[0])) === null || _a === void 0 ? void 0 : _a.regions) || []);
|
|
380
|
+
vview.setDisplayedRegions(((_b = session.assemblyManager.get(assemblyNames[1])) === null || _b === void 0 ? void 0 : _b.regions) || []);
|
|
357
381
|
self.showAllRegions();
|
|
358
382
|
});
|
|
359
383
|
}, { delay: 1000 }));
|
|
@@ -361,18 +385,9 @@ export default function stateModelFactory(pm) {
|
|
|
361
385
|
if (self.volatileWidth === undefined) {
|
|
362
386
|
return;
|
|
363
387
|
}
|
|
364
|
-
const {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
const hblocks = hview.dynamicBlocks.contentBlocks;
|
|
368
|
-
const hoffset = hview.offsetPx;
|
|
369
|
-
const voffset = vview.offsetPx;
|
|
370
|
-
const vhide = getBlockLabelKeysToHide(vblocks, viewHeight, voffset);
|
|
371
|
-
const hhide = getBlockLabelKeysToHide(hblocks, viewWidth, hoffset);
|
|
372
|
-
const by = pxWidthForBlocks(hblocks, vview.bpPerPx, hhide);
|
|
373
|
-
const bx = pxWidthForBlocks(vblocks, hview.bpPerPx, vhide);
|
|
374
|
-
self.setBorderY(Math.max(by + padding, 50));
|
|
375
|
-
self.setBorderX(Math.max(bx + padding, 50));
|
|
388
|
+
const { borderX, borderY } = self.calculateBorders();
|
|
389
|
+
self.setBorderX(borderX);
|
|
390
|
+
self.setBorderY(borderY);
|
|
376
391
|
}));
|
|
377
392
|
},
|
|
378
393
|
squareView() {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { LoadingEllipses } from '@jbrowse/core/ui';
|
|
4
|
-
import { Typography } from '@mui/material';
|
|
2
|
+
import { ErrorMessage, LoadingEllipses } from '@jbrowse/core/ui';
|
|
5
3
|
import { observer } from 'mobx-react';
|
|
6
4
|
import { makeStyles } from 'tss-react/mui';
|
|
7
5
|
const useStyles = makeStyles()(theme => {
|
|
@@ -17,33 +15,18 @@ const useStyles = makeStyles()(theme => {
|
|
|
17
15
|
backgroundColor: bg,
|
|
18
16
|
padding: '10px',
|
|
19
17
|
},
|
|
20
|
-
blockError: {
|
|
21
|
-
backgroundColor: bg,
|
|
22
|
-
padding: '10px',
|
|
23
|
-
color: 'red',
|
|
24
|
-
},
|
|
25
18
|
};
|
|
26
19
|
});
|
|
27
20
|
function LoadingMessage() {
|
|
28
|
-
const [shown, setShown] = useState(false);
|
|
29
21
|
const { classes } = useStyles();
|
|
30
|
-
|
|
31
|
-
const timeout = setTimeout(() => {
|
|
32
|
-
setShown(true);
|
|
33
|
-
}, 300);
|
|
34
|
-
return () => {
|
|
35
|
-
clearTimeout(timeout);
|
|
36
|
-
};
|
|
37
|
-
}, []);
|
|
38
|
-
return shown ? (_jsx("div", { className: classes.loading, children: _jsx(LoadingEllipses, {}) })) : null;
|
|
22
|
+
return (_jsx("div", { className: classes.loading, children: _jsx(LoadingEllipses, {}) }));
|
|
39
23
|
}
|
|
40
24
|
function BlockMessage({ messageText }) {
|
|
41
25
|
const { classes } = useStyles();
|
|
42
|
-
return (_jsx("div", { className: classes.
|
|
26
|
+
return (_jsx("div", { className: classes.loading, children: _jsx(LoadingEllipses, { message: messageText }) }));
|
|
43
27
|
}
|
|
44
28
|
function BlockError({ error }) {
|
|
45
|
-
|
|
46
|
-
return (_jsx("div", { className: classes.blockError, children: _jsx(Typography, { children: `${error}` }) }));
|
|
29
|
+
return _jsx(ErrorMessage, { error: error });
|
|
47
30
|
}
|
|
48
31
|
const ServerSideRenderedDotplotContent = observer(function ({ model, style, }) {
|
|
49
32
|
if (model.error) {
|
package/esm/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import Plugin from '@jbrowse/core/Plugin';
|
|
|
2
2
|
import { isAbstractMenuManager } from '@jbrowse/core/util';
|
|
3
3
|
import TimelineIcon from '@mui/icons-material/Timeline';
|
|
4
4
|
import ComparativeRenderer from './ComparativeRenderer';
|
|
5
|
+
import DiagonalizeDotplotRpc from './DiagonalizeDotplotRpc';
|
|
5
6
|
import DotplotDisplayF from './DotplotDisplay';
|
|
6
7
|
import DotplotReadVsRefMenuItem from './DotplotReadVsRef';
|
|
7
8
|
import DotplotRendererF from './DotplotRenderer';
|
|
@@ -19,6 +20,7 @@ export default class DotplotPlugin extends Plugin {
|
|
|
19
20
|
LaunchDotplotViewF(pluginManager);
|
|
20
21
|
DotplotReadVsRefMenuItem(pluginManager);
|
|
21
22
|
pluginManager.addRpcMethod(() => new ComparativeRenderer(pluginManager));
|
|
23
|
+
pluginManager.addRpcMethod(() => new DiagonalizeDotplotRpc(pluginManager));
|
|
22
24
|
}
|
|
23
25
|
configure(pluginManager) {
|
|
24
26
|
if (isAbstractMenuManager(pluginManager.rootModel)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-dotplot-view",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "JBrowse 2 dotplot view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"clean": "rimraf dist esm *.tsbuildinfo"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@jbrowse/core": "^3.
|
|
40
|
-
"@jbrowse/plugin-alignments": "^3.
|
|
39
|
+
"@jbrowse/core": "^3.7.0",
|
|
40
|
+
"@jbrowse/plugin-alignments": "^3.7.0",
|
|
41
41
|
"@mui/icons-material": "^7.0.0",
|
|
42
42
|
"@mui/material": "^7.0.0",
|
|
43
43
|
"@mui/x-data-grid": "^8.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "85bdd0d58286b7adbfd408146b15847676317635"
|
|
63
63
|
}
|