-
-
Save amcdnl/331df000197c46c8b4555a51cc566573 to your computer and use it in GitHub Desktop.
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
/* | |
centerGraph() { | |
const { height, width } = this.graph.getGraphDimensions(); | |
this.panTo(width / 2, height / 2); | |
} | |
panTo(x: number, y: number) { | |
const { offsetX, offsetY, zoomLevel } = this.state; | |
const newOffsetX = (x - offsetX) * (zoomLevel + (this.chartWidth / 2)); | |
const newOffsetY = (y - offsetY) * (zoomLevel + (this.chartHeight / 2)); | |
this.setState({ | |
offsetY: newOffsetY, | |
offsetX: newOffsetX | |
}); | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment