🚸 (editor) Improve editor performance by rounding paths

Related to #575
This commit is contained in:
Baptiste Arnaud
2023-06-24 11:48:46 +02:00
parent 69254c3624
commit 0582ca74ac
6 changed files with 37 additions and 12 deletions

View File

@@ -39,10 +39,14 @@ export const SourceEndpoint = ({
const endpointY = useMemo(
() =>
ref.current
? (ref.current?.getBoundingClientRect().y +
(endpointHeight * graphPosition.scale) / 2 -
graphPosition.y) /
graphPosition.scale
? Number(
(
(ref.current?.getBoundingClientRect().y +
(endpointHeight * graphPosition.scale) / 2 -
graphPosition.y) /
graphPosition.scale
).toFixed(2)
)
: undefined,
// We need to force recompute whenever the group height and position changes
// eslint-disable-next-line react-hooks/exhaustive-deps

View File

@@ -28,10 +28,14 @@ export const TargetEndpoint = ({
const endpointY = useMemo(
() =>
ref.current
? (ref.current?.getBoundingClientRect().y +
(endpointHeight * graphPosition.scale) / 2 -
graphPosition.y) /
graphPosition.scale
? Number(
(
(ref.current?.getBoundingClientRect().y +
(endpointHeight * graphPosition.scale) / 2 -
graphPosition.y) /
graphPosition.scale
).toFixed(2)
)
: undefined,
// We need to force recompute whenever the group height and position changes
// eslint-disable-next-line react-hooks/exhaustive-deps