Skip to content

WDFN-885 - Part 1, refactor to save the cursor x position rather than time offset in the Redux store

Bucknell, Mary S. requested to merge mbucknell/waterdataui:wdfn-885 into main

Before making a pull request

  • Put the appropriate EXEMPT flag if needed in the MR label (see https://practices.wma.chs.usgs.gov/practice/peer_code_review/)
  • Run all linters (make lint)
  • Run all tests (make test)
  • Update the changelog appropriately
  • If making a release, update code.json metadataLastUpdated and bump CHANGELOG.md to next version.

Description

As a first step in removing the graph brush and implementing zoom on the time series graph, we decided that the current focus behavior on the time series graph was inconsistent and confusing, particularly when zooming or panning. We had been saving the cursor time offset which is really a calculated value in the store. Rather than do this, we decided to save the X position of the cursor in the Redux store. The behavior is now that when focus is removed from a time series graph, the focus line physically stays in place, regardless of whether the graph is panned or zoomed.

The most substantive changes were in the src/scripts/vue-components which implement the time series tooltips and graph. In some cases, by using the X position, the xScale no longer needed to be passed as a property to the components. I also took this opportunity to but the styling for tooltip focus line and circles directly in the components and removed from the implementation specific vue components.

There will be a second part of this ticket to remove the brush from desktop and implement zoom on all browser widths.

Please note that this MR took out the zoom on mobile temporarily to make this refactor easier to work on. The next MR will put it back in.

After making a pull request

  • If appropriate, put the link to the PR in the JIRA ticket
  • Assign someone to review unless the change is trivial
  • Check the accessibility CI step and fix or explain any issues.
Edited by Bucknell, Mary S.

Merge request reports