@jbrowse/plugin-linear-genome-view 1.6.7 → 1.6.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-linear-genome-view",
3
- "version": "1.6.7",
3
+ "version": "1.6.8",
4
4
  "description": "JBrowse 2 linear genome view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "02012ec299c36647f755316571775d36b0fee5ec"
64
+ "gitHead": "585e522096651ef4afb188366bb46d723439dc1b"
65
65
  }
@@ -1,8 +1,8 @@
1
1
  import React, { useState, useRef, useMemo } from 'react'
2
+ import { observer } from 'mobx-react'
2
3
  import { Portal, alpha, useTheme, makeStyles } from '@material-ui/core'
3
4
  import { getConf } from '@jbrowse/core/configuration'
4
5
  import { Menu } from '@jbrowse/core/ui'
5
- import { observer } from 'mobx-react'
6
6
  import { usePopper } from 'react-popper'
7
7
 
8
8
  // locals
@@ -56,7 +56,6 @@ const Tooltip = observer(
56
56
  const classes = useStyles()
57
57
  const { featureUnderMouse } = model
58
58
  const [width, setWidth] = useState(0)
59
-
60
59
  const [popperElt, setPopperElt] = useState<HTMLDivElement | null>(null)
61
60
 
62
61
  // must be memoized a la https://github.com/popperjs/react-popper/issues/391
@@ -111,7 +110,7 @@ const BaseLinearDisplay = observer(
111
110
  const classes = useStyles()
112
111
  const theme = useTheme()
113
112
  const ref = useRef<HTMLDivElement>(null)
114
- const [clientRect, setClientRect] = useState<ClientRect>()
113
+ const [clientRect, setClientRect] = useState<DOMRect>()
115
114
  const [offsetMouseCoord, setOffsetMouseCoord] = useState<Coord>([0, 0])
116
115
  const [clientMouseCoord, setClientMouseCoord] = useState<Coord>([0, 0])
117
116
  const [contextCoord, setContextCoord] = useState<Coord>()
@@ -139,17 +138,15 @@ const BaseLinearDisplay = observer(
139
138
  }
140
139
  }}
141
140
  onMouseMove={event => {
142
- if (ref.current) {
143
- const rect = ref.current.getBoundingClientRect()
144
- setOffsetMouseCoord([
145
- event.clientX - rect.left,
146
- event.clientY - rect.top,
147
- ])
148
- setClientMouseCoord([event.clientX, event.clientY])
149
- setClientRect(rect)
141
+ if (!ref.current) {
142
+ return
150
143
  }
144
+ const rect = ref.current.getBoundingClientRect()
145
+ const { left, top } = rect
146
+ setOffsetMouseCoord([event.clientX - left, event.clientY - top])
147
+ setClientMouseCoord([event.clientX, event.clientY])
148
+ setClientRect(rect)
151
149
  }}
152
- role="presentation"
153
150
  >
154
151
  {DisplayMessageComponent ? (
155
152
  <DisplayMessageComponent model={model} />
@@ -3,6 +3,7 @@ import { observer } from 'mobx-react'
3
3
  import {
4
4
  Button,
5
5
  Dialog,
6
+ DialogActions,
6
7
  DialogContent,
7
8
  DialogTitle,
8
9
  IconButton,
@@ -57,21 +58,22 @@ function SetMaxHeightDlg(props: {
57
58
  <CloseIcon />
58
59
  </IconButton>
59
60
  </DialogTitle>
60
- <DialogContent>
61
- <div className={classes.root}>
62
- <Typography>Set max height for the track</Typography>
63
- <TextField
64
- value={max}
65
- onChange={event => {
66
- setMax(event.target.value)
67
- }}
68
- placeholder="Enter max score"
69
- />
61
+ <DialogContent className={classes.root}>
62
+ <Typography>
63
+ Set max height for the track. For example, you can increase this if
64
+ the layout says "Max height reached"
65
+ </Typography>
66
+ <TextField
67
+ value={max}
68
+ onChange={event => setMax(event.target.value)}
69
+ placeholder="Enter max score"
70
+ />
71
+ <DialogActions>
70
72
  <Button
71
73
  variant="contained"
72
74
  color="primary"
73
75
  type="submit"
74
- style={{ marginLeft: 20 }}
76
+ autoFocus
75
77
  onClick={() => {
76
78
  model.setMaxHeight(
77
79
  max !== '' && !Number.isNaN(+max) ? +max : undefined,
@@ -81,7 +83,14 @@ function SetMaxHeightDlg(props: {
81
83
  >
82
84
  Submit
83
85
  </Button>
84
- </div>
86
+ <Button
87
+ variant="contained"
88
+ color="secondary"
89
+ onClick={() => handleClose()}
90
+ >
91
+ Cancel
92
+ </Button>
93
+ </DialogActions>
85
94
  </DialogContent>
86
95
  </Dialog>
87
96
  )
@@ -13,9 +13,7 @@ import { LinearGenomeViewModel, RESIZE_HANDLE_HEIGHT } from '..'
13
13
  import TrackLabel from './TrackLabel'
14
14
 
15
15
  const useStyles = makeStyles(theme => ({
16
- root: {
17
- margin: 2,
18
- },
16
+ root: { marginTop: 2 },
19
17
  resizeHandle: {
20
18
  height: RESIZE_HANDLE_HEIGHT,
21
19
  boxSizing: 'border-box',
@@ -34,6 +32,16 @@ const useStyles = makeStyles(theme => ({
34
32
  trackLabel: {
35
33
  zIndex: 3,
36
34
  },
35
+
36
+ // aligns with block bounderies. check for example the breakpoint split view
37
+ // demo to see if features align if wanting to change things
38
+ renderingComponentContainer: {
39
+ position: 'absolute',
40
+ // -1 offset because of the 1px border of the Paper
41
+ left: -1,
42
+ height: '100%',
43
+ width: '100%',
44
+ },
37
45
  trackLabelInline: {
38
46
  position: 'relative',
39
47
  display: 'inline-block',
@@ -48,31 +56,26 @@ const useStyles = makeStyles(theme => ({
48
56
  position: 'relative',
49
57
  background: 'none',
50
58
  zIndex: 2,
51
- boxSizing: 'content-box',
52
59
  },
53
60
  }))
54
61
 
55
62
  type LGV = LinearGenomeViewModel
56
63
 
57
- function TrackContainerLabel({
58
- model,
59
- view,
60
- }: {
61
- model: BaseTrackModel
62
- view: LGV
63
- }) {
64
- const classes = useStyles()
65
- const labelStyle =
66
- view.trackLabels === 'overlapping'
67
- ? classes.trackLabelOverlap
68
- : classes.trackLabelInline
69
- return view.trackLabels !== 'hidden' ? (
70
- <TrackLabel
71
- track={model}
72
- className={clsx(classes.trackLabel, labelStyle)}
73
- />
74
- ) : null
75
- }
64
+ const TrackContainerLabel = observer(
65
+ ({ model, view }: { model: BaseTrackModel; view: LGV }) => {
66
+ const classes = useStyles()
67
+ const labelStyle =
68
+ view.trackLabels === 'overlapping'
69
+ ? classes.trackLabelOverlap
70
+ : classes.trackLabelInline
71
+ return view.trackLabels !== 'hidden' ? (
72
+ <TrackLabel
73
+ track={model}
74
+ className={clsx(classes.trackLabel, labelStyle)}
75
+ />
76
+ ) : null
77
+ },
78
+ )
76
79
 
77
80
  function TrackContainer({
78
81
  model,
@@ -123,7 +126,11 @@ function TrackContainer({
123
126
  data-testid={`trackRenderingContainer-${model.id}-${trackId}`}
124
127
  role="presentation"
125
128
  >
126
- <div ref={ref} style={{ transform: `scaleX(${model.scaleFactor})` }}>
129
+ <div
130
+ ref={ref}
131
+ className={classes.renderingComponentContainer}
132
+ style={{ transform: `scaleX(${model.scaleFactor})` }}
133
+ >
127
134
  <RenderingComponent
128
135
  model={display}
129
136
  onHorizontalScroll={horizontalScroll}
@@ -533,12 +533,12 @@ exports[`<LinearGenomeView /> renders one track, one region 1`] = `
533
533
  style="height: 100px;"
534
534
  >
535
535
  <div
536
+ class="makeStyles-renderingComponentContainer"
536
537
  style="transform: scaleX(1);"
537
538
  >
538
539
  <div
539
540
  class="makeStyles-display"
540
541
  data-testid="display-testConfig-LinearBareDisplay"
541
- role="presentation"
542
542
  >
543
543
  <div
544
544
  class="makeStyles-linearBlocks"
@@ -1423,12 +1423,12 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1423
1423
  style="height: 100px;"
1424
1424
  >
1425
1425
  <div
1426
+ class="makeStyles-renderingComponentContainer"
1426
1427
  style="transform: scaleX(1);"
1427
1428
  >
1428
1429
  <div
1429
1430
  class="makeStyles-display"
1430
1431
  data-testid="display-testConfig-LinearBareDisplay"
1431
- role="presentation"
1432
1432
  >
1433
1433
  <div
1434
1434
  class="makeStyles-linearBlocks"
@@ -1443,17 +1443,12 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1443
1443
  class="makeStyles-contentBlock"
1444
1444
  style="width: 100px;"
1445
1445
  >
1446
- <div
1447
- style="position: relative;"
1448
- >
1449
- <svg
1450
- class="SvgFeatureRendering"
1451
- data-testid="svgfeatures"
1452
- height="100"
1453
- style="display: block;"
1454
- width="100"
1455
- />
1456
- </div>
1446
+ <svg
1447
+ class="SvgFeatureRendering"
1448
+ data-testid="svgfeatures"
1449
+ height="100"
1450
+ width="100"
1451
+ />
1457
1452
  </div>
1458
1453
  <div
1459
1454
  class="makeStyles-interRegionPaddingBlock"
@@ -1463,17 +1458,12 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1463
1458
  class="makeStyles-contentBlock"
1464
1459
  style="width: 1000px;"
1465
1460
  >
1466
- <div
1467
- style="position: relative;"
1468
- >
1469
- <svg
1470
- class="SvgFeatureRendering"
1471
- data-testid="svgfeatures"
1472
- height="100"
1473
- style="display: block;"
1474
- width="1000"
1475
- />
1476
- </div>
1461
+ <svg
1462
+ class="SvgFeatureRendering"
1463
+ data-testid="svgfeatures"
1464
+ height="100"
1465
+ width="1000"
1466
+ />
1477
1467
  </div>
1478
1468
  <div
1479
1469
  class="makeStyles-boundaryPaddingBlock"
@@ -1578,12 +1568,12 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1578
1568
  style="height: 100px;"
1579
1569
  >
1580
1570
  <div
1571
+ class="makeStyles-renderingComponentContainer"
1581
1572
  style="transform: scaleX(1);"
1582
1573
  >
1583
1574
  <div
1584
1575
  class="makeStyles-display"
1585
1576
  data-testid="display-testConfig2-LinearBareDisplay"
1586
- role="presentation"
1587
1577
  >
1588
1578
  <div
1589
1579
  class="makeStyles-linearBlocks"
@@ -1598,17 +1588,12 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1598
1588
  class="makeStyles-contentBlock"
1599
1589
  style="width: 100px;"
1600
1590
  >
1601
- <div
1602
- style="position: relative;"
1603
- >
1604
- <svg
1605
- class="SvgFeatureRendering"
1606
- data-testid="svgfeatures"
1607
- height="100"
1608
- style="display: block;"
1609
- width="100"
1610
- />
1611
- </div>
1591
+ <svg
1592
+ class="SvgFeatureRendering"
1593
+ data-testid="svgfeatures"
1594
+ height="100"
1595
+ width="100"
1596
+ />
1612
1597
  </div>
1613
1598
  <div
1614
1599
  class="makeStyles-interRegionPaddingBlock"
@@ -1618,17 +1603,12 @@ exports[`<LinearGenomeView /> renders two tracks, two regions 1`] = `
1618
1603
  class="makeStyles-contentBlock"
1619
1604
  style="width: 1000px;"
1620
1605
  >
1621
- <div
1622
- style="position: relative;"
1623
- >
1624
- <svg
1625
- class="SvgFeatureRendering"
1626
- data-testid="svgfeatures"
1627
- height="100"
1628
- style="display: block;"
1629
- width="1000"
1630
- />
1631
- </div>
1606
+ <svg
1607
+ class="SvgFeatureRendering"
1608
+ data-testid="svgfeatures"
1609
+ height="100"
1610
+ width="1000"
1611
+ />
1632
1612
  </div>
1633
1613
  <div
1634
1614
  class="makeStyles-boundaryPaddingBlock"