@jbrowse/plugin-linear-genome-view
Version:
JBrowse 2 linear genome view
31 lines (30 loc) • 2.1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const ui_1 = require("@jbrowse/core/ui");
const util_1 = require("@jbrowse/core/util");
const material_1 = require("@mui/material");
const mobx_react_1 = require("mobx-react");
const toP = (s = 0) => +(+s).toFixed(1);
const RegionWidthEditorDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, }) {
const { bpPerPx, width } = model;
const [val, setVal] = (0, react_1.useState)((0, util_1.toLocale)(toP(bpPerPx * width)));
(0, react_1.useEffect)(() => {
setVal((0, util_1.toLocale)(bpPerPx * width));
}, [bpPerPx, width]);
const val2 = val.replace(/,/g, '');
return ((0, jsx_runtime_1.jsxs)(ui_1.Dialog, { title: "Edit zoom level", open: true, onClose: handleClose, children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { style: {
display: 'flex',
flexDirection: 'column',
gap: 30,
}, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: "Enter a specific number of base pairs to change the viewport to show. This is approximate and does not account for padding between regions or off-screen scrolling" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { helperText: "current zoom level (in bp)", value: val, onChange: event => {
setVal(event.target.value);
} })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
handleClose();
}, children: "Cancel" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", onClick: () => {
model.zoomTo(+val2 / model.width);
handleClose();
}, children: "Submit" })] })] }));
});
exports.default = RegionWidthEditorDialog;