Skip to content

Commit

Permalink
Only double-click zoom if not clicking on feature (#3670)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed May 18, 2023
1 parent 4e250ae commit 9bc89e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function TrackContainer({
const { horizontalScroll, draggingTrackId, moveTrack } = model
const { height, RenderingComponent, DisplayBlurb } = display
const trackId = getConf(track, 'trackId')
const ref = useRef(null)
const ref = useRef<HTMLDivElement>(null)
const dimmed = draggingTrackId !== undefined && draggingTrackId !== display.id
const minimized = track.minimized
const debouncedOnDragEnter = useDebouncedCallback(() => {
Expand All @@ -111,7 +111,17 @@ function TrackContainer({
}, [model.trackRefs, trackId])

return (
<Paper className={classes.root} variant="outlined">
<Paper
ref={ref}
className={classes.root}
variant="outlined"
onClick={event => {
if (event.detail === 2 && !track.displays[0].featureIdUnderMouse) {
const left = ref.current?.getBoundingClientRect().left || 0
model.zoomTo(model.bpPerPx / 2, event.clientX - left, true)
}
}}
>
<TrackContainerLabel model={track} view={model} />
<ErrorBoundary
key={track.id}
Expand All @@ -127,7 +137,6 @@ function TrackContainer({
{!minimized ? (
<>
<div
ref={ref}
className={classes.renderingComponentContainer}
style={{ transform: `scaleX(${model.scaleFactor})` }}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,6 @@ export default observer(function TracksContainer({
ref={ref}
data-testid="trackContainer"
className={classes.tracksContainer}
onClick={event => {
if (event.detail === 2) {
const left = ref.current?.getBoundingClientRect().left || 0
model.zoomTo(model.bpPerPx / 2, event.clientX - left, true)
}
}}
onMouseDown={event => {
mouseDown1(event)
mouseDown2(event)
Expand Down

0 comments on commit 9bc89e7

Please sign in to comment.