mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-27 15:22:56 +08:00
Center first matched node on canvas
This commit is contained in:
parent
e671358c01
commit
5f6b97a197
@ -45,10 +45,12 @@ export const useFocusNode = () => {
|
|||||||
|
|
||||||
const newPositionX =
|
const newPositionX =
|
||||||
(zoomPanPinch.offsetLeft - x) * newScale +
|
(zoomPanPinch.offsetLeft - x) * newScale +
|
||||||
firstMatchedNode.getBoundingClientRect().width;
|
zoomPanPinch.clientWidth / 2 -
|
||||||
|
firstMatchedNode.getBoundingClientRect().width / 2;
|
||||||
const newPositionY =
|
const newPositionY =
|
||||||
(zoomPanPinch.offsetTop - y) * newScale +
|
(zoomPanPinch.offsetLeft - y) * newScale +
|
||||||
firstMatchedNode.getBoundingClientRect().height;
|
zoomPanPinch.clientHeight / 2 -
|
||||||
|
firstMatchedNode.getBoundingClientRect().height / 2;
|
||||||
|
|
||||||
highlightMatchedNodes(matchedNodes);
|
highlightMatchedNodes(matchedNodes);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user