@jbrowse/plugin-linear-genome-view 4.1.1 → 4.1.3

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.
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getContainingView } from '@jbrowse/core/util';
2
3
  import { makeStyles } from '@jbrowse/core/util/tss-react';
3
4
  import { observer } from 'mobx-react';
4
5
  import RenderedBlocks from "./RenderedBlocks.js";
@@ -14,8 +15,9 @@ const useStyles = makeStyles()({
14
15
  const LinearBlocks = observer(function LinearBlocks({ model, }) {
15
16
  const { classes } = useStyles();
16
17
  const { blockDefinitions } = model;
18
+ const viewModel = getContainingView(model);
17
19
  return (_jsx("div", { className: classes.linearBlocks, style: {
18
- left: `calc(${blockDefinitions.offsetPx}px - var(--offset-px))`,
20
+ left: blockDefinitions.offsetPx - viewModel.offsetPx,
19
21
  }, children: _jsx(RenderedBlocks, { model: model }) }));
20
22
  });
21
23
  export default LinearBlocks;
@@ -1171,8 +1171,8 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
1171
1171
  showLegend: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1172
1172
  showTooltips: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1173
1173
  }>>, {
1174
- id: string;
1175
1174
  type: string;
1175
+ id: string;
1176
1176
  configuration: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>;
1177
1177
  rpcDriverName: string | undefined;
1178
1178
  heightPreConfig: number | undefined;
@@ -1173,8 +1173,8 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
1173
1173
  showLegend: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1174
1174
  showTooltips: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1175
1175
  }>> & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & import("@jbrowse/mobx-state-tree")._NotCustomized, {
1176
- id: string;
1177
1176
  type: string;
1177
+ id: string;
1178
1178
  configuration: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>;
1179
1179
  rpcDriverName: string | undefined;
1180
1180
  heightPreConfig: number | undefined;
@@ -60,11 +60,12 @@ const RenderedVerticalGuides = observer(function RenderedVerticalGuides({ model,
60
60
  });
61
61
  const Gridlines = observer(function Gridlines({ model, offset = 0, }) {
62
62
  const { classes } = useStyles();
63
- const { staticBlocks, scaleFactor } = model;
63
+ const { staticBlocks, scaleFactor, offsetPx } = model;
64
+ const offsetLeft = staticBlocks.offsetPx - offsetPx;
64
65
  return (_jsx("div", { className: classes.verticalGuidesZoomContainer, style: {
65
66
  transform: scaleFactor !== 1 ? `scaleX(${scaleFactor})` : undefined,
66
67
  }, children: _jsx("div", { className: classes.verticalGuidesContainer, style: {
67
- left: `calc(${staticBlocks.offsetPx}px - var(--offset-px) - ${offset}px)`,
68
+ left: offsetLeft - offset,
68
69
  width: staticBlocks.totalWidthPx,
69
70
  }, children: _jsx(RenderedVerticalGuides, { model: model }) }) }));
70
71
  });
@@ -22,10 +22,11 @@ const useStyles = makeStyles()({
22
22
  const Scalebar = observer(function Scalebar({ model, style, className, ...other }) {
23
23
  const { classes } = useStyles();
24
24
  const { scaleFactor, staticBlocks, offsetPx } = model;
25
- return (_jsxs(Paper, { "data-resizer": "true", className: cx(classes.container, className), variant: "outlined", style: { ...style, '--offset-px': `${offsetPx}px` }, ...other, children: [_jsx(Gridlines, { model: model, offset: 1 }), _jsx("div", { className: classes.zoomContainer, style: {
25
+ const offsetLeft = Math.round(staticBlocks.offsetPx - offsetPx);
26
+ return (_jsxs(Paper, { "data-resizer": "true", className: cx(classes.container, className), variant: "outlined", style: style, ...other, children: [_jsx(Gridlines, { model: model, offset: 1 }), _jsx("div", { className: classes.zoomContainer, style: {
26
27
  transform: scaleFactor !== 1 ? `scaleX(${scaleFactor})` : undefined,
27
28
  }, children: _jsx("div", { className: classes.scalebar, style: {
28
- transform: `translateX(calc(${staticBlocks.offsetPx}px - var(--offset-px) - 1px))`,
29
+ transform: `translateX(${offsetLeft - 1}px)`,
29
30
  width: staticBlocks.totalWidthPx,
30
31
  }, children: _jsx(ScalebarCoordinateLabels, { model: model }) }) }), _jsx(ScalebarRefNameLabels, { model: model })] }));
31
32
  });
@@ -65,8 +65,8 @@ const ScalebarRefNameLabels = observer(function ScalebarRefNameLabels({ model, }
65
65
  (isLeftEndOfDisplayedRegion || last) &&
66
66
  hasEnoughSpace ? (_jsxs("span", { style: {
67
67
  left: last
68
- ? 'max(0px, calc(-1 * var(--offset-px)))'
69
- : `calc(${blockOffsetPx}px - var(--offset-px) - 1px)`,
68
+ ? Math.max(0, -offsetPx)
69
+ : blockOffsetPx - offsetPx - 1,
70
70
  paddingLeft: last ? 0 : 1,
71
71
  maxWidth: maxWidth !== undefined && maxWidth > 0 ? maxWidth : undefined,
72
72
  }, className: classes.refLabel, "data-testid": `refLabel-${refName}`, onMouseDown: () => {
@@ -30,7 +30,7 @@ const TracksContainer = observer(function TracksContainer({ children, model, })
30
30
  const { guideX, rubberbandOn, leftBpOffset, rightBpOffset, numOfBpSelected, width, left, anchorPosition, open, isClick, clickBpOffset, handleMenuItemClick, handleClose, mouseMove, mouseDown: mouseDown2, } = useRangeSelect(ref, model, true);
31
31
  useWheelScroll(ref, model);
32
32
  const additional = pluginManager.evaluateExtensionPoint('LinearGenomeView-TracksContainerComponent', undefined, { model });
33
- return (_jsxs("div", { ref: ref, "data-testid": "tracksContainer", className: classes.tracksContainer, style: { '--offset-px': `${model.offsetPx}px` }, onMouseDown: event => {
33
+ return (_jsxs("div", { ref: ref, "data-testid": "tracksContainer", className: classes.tracksContainer, onMouseDown: event => {
34
34
  mouseDown1(event);
35
35
  mouseDown2(event);
36
36
  }, onMouseMove: mouseMove, onMouseUp: mouseUp, children: [showGridlines ? _jsx(Gridlines, { model: model }) : null, _jsx(Suspense, { fallback: null, children: showCenterLine ? _jsx(CenterLine, { model: model }) : null }), guideX !== undefined && !isScalebarRefNameMenuOpen ? (_jsx(VerticalGuide, { model: model, coordX: guideX })) : rubberbandOn ? (_jsx(Suspense, { fallback: null, children: _jsx(RubberbandSpan, { leftBpOffset: leftBpOffset, rightBpOffset: rightBpOffset, numOfBpSelected: numOfBpSelected, width: width, left: left, top: rubberbandTop, sticky: stickyViewHeaders }) })) : null, model.volatileGuides.map((guide, idx) => (_jsx(VerticalGuide, { model: model, coordX: guide.xPos }, idx))), anchorPosition ? (_jsx(Menu, { anchorReference: "anchorPosition", anchorPosition: {
package/esm/index.d.ts CHANGED
@@ -1171,8 +1171,8 @@ export default class LinearGenomeViewPlugin extends Plugin {
1171
1171
  showLegend: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1172
1172
  showTooltips: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1173
1173
  }>>, {
1174
- id: string;
1175
1174
  type: string;
1175
+ id: string;
1176
1176
  configuration: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>;
1177
1177
  rpcDriverName: string | undefined;
1178
1178
  heightPreConfig: number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-linear-genome-view",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "type": "module",
5
5
  "description": "JBrowse 2 linear genome view",
6
6
  "keywords": [
@@ -29,8 +29,8 @@
29
29
  "file-saver-es": "^2.0.5",
30
30
  "mobx": "^6.15.0",
31
31
  "mobx-react": "^9.2.1",
32
- "@jbrowse/product-core": "^4.1.1",
33
- "@jbrowse/core": "^4.1.1"
32
+ "@jbrowse/product-core": "^4.1.3",
33
+ "@jbrowse/core": "^4.1.3"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=18.0.0",