🐛 Fixed pinch zooming mouse issue (with ctrl key) (#940)
**Fixed the drastic zoom increase decrease on ctrl + mouse scroll.** The issue was occuring due to the "scale" property in the pinch gesture. The scale was getting bigger values, leading to more zooming. What I did was, made sure that maximum scale difference between current and last value cannot be more than the scaling factor used in zoomin/zoomout buttons. That is. 0.2 Also, the pinch zoom would work as expected. /claim #567 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ### Summary by CodeRabbit - Improvement: Enhanced zoom precision in the Graph component. This update allows for more accurate scaling when adjusting the view in the graph builder. The change ensures that the zoom level adjusts more precisely, providing a smoother and more controlled user experience when interacting with graphs. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@ -171,7 +171,12 @@ export const Graph = ({
|
||||
}) => {
|
||||
const { x: mouseX, y } = mousePosition ?? getCenterOfGraph()
|
||||
const mouseY = y - headerHeight
|
||||
let newScale = scale ?? graphPosition.scale + (delta ?? 0)
|
||||
let newScale = graphPosition.scale + (delta ?? 0)
|
||||
if (scale) {
|
||||
const scaleDiff = scale - graphPosition.scale
|
||||
newScale += Math.min(zoomButtonsScaleBlock, Math.abs(scaleDiff)) * Math.sign(scaleDiff)
|
||||
}
|
||||
|
||||
if (
|
||||
(newScale >= maxScale && graphPosition.scale === maxScale) ||
|
||||
(newScale <= minScale && graphPosition.scale === minScale)
|
||||
|
Reference in New Issue
Block a user