-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Due to the way that the Highlight component handles the mouse events, it is pretty much required that it is one of the last children of the XYPlot. Since it renders a transparent `rect` over the entire `XYPlot` it currently disables any mouse events for controls lower in the dom tree. If the `Highlight` component is moved higher in the dom tree, then the `onMouseLeave` event will fire when a lower component is hovered over. The ZoomHandler delegates the handling of the mouse events to the XYPlot itself. The XYPlot now holds a collection of `Event` objects that will be passed to the children, where they can subscribe to the ones that they are interested in. When the appropriate Event in the XYPlot is fired, it will execute the callbacks for all listeners. This approach does not cause the `XYPlot` to re-render, and only the listeners that perform an operation in their callback will be re-rendered. Also created a `useStateWithGet` that wraps a `useState` call and also provides a memoized `getState` method. Since the `getState` method is only created once for the component, it will not trigger re-renders when listed in the dependencies of `useEffect` / `useCallback`. This drastically cuts down the number of event handlers that are subscribed / unsubscribed.
- Loading branch information
Chris Thomas
committed
Jun 10, 2020
1 parent
8e56d05
commit 58a1ee2
Showing
9 changed files
with
265 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.