mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): memoize event handlers on bounding box
This commit is contained in:
parent
53eb23b8b6
commit
ba4aaea45b
@ -213,45 +213,45 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
|
|||||||
[scaledStep]
|
[scaledStep]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleStartedTransforming = () => {
|
const handleStartedTransforming = useCallback(() => {
|
||||||
dispatch(setIsTransformingBoundingBox(true));
|
dispatch(setIsTransformingBoundingBox(true));
|
||||||
};
|
}, [dispatch]);
|
||||||
|
|
||||||
const handleEndedTransforming = () => {
|
const handleEndedTransforming = useCallback(() => {
|
||||||
dispatch(setIsTransformingBoundingBox(false));
|
dispatch(setIsTransformingBoundingBox(false));
|
||||||
dispatch(setIsMovingBoundingBox(false));
|
dispatch(setIsMovingBoundingBox(false));
|
||||||
dispatch(setIsMouseOverBoundingBox(false));
|
dispatch(setIsMouseOverBoundingBox(false));
|
||||||
setIsMouseOverBoundingBoxOutline(false);
|
setIsMouseOverBoundingBoxOutline(false);
|
||||||
};
|
}, [dispatch]);
|
||||||
|
|
||||||
const handleStartedMoving = () => {
|
const handleStartedMoving = useCallback(() => {
|
||||||
dispatch(setIsMovingBoundingBox(true));
|
dispatch(setIsMovingBoundingBox(true));
|
||||||
};
|
}, [dispatch]);
|
||||||
|
|
||||||
const handleEndedModifying = () => {
|
const handleEndedModifying = useCallback(() => {
|
||||||
dispatch(setIsTransformingBoundingBox(false));
|
dispatch(setIsTransformingBoundingBox(false));
|
||||||
dispatch(setIsMovingBoundingBox(false));
|
dispatch(setIsMovingBoundingBox(false));
|
||||||
dispatch(setIsMouseOverBoundingBox(false));
|
dispatch(setIsMouseOverBoundingBox(false));
|
||||||
setIsMouseOverBoundingBoxOutline(false);
|
setIsMouseOverBoundingBoxOutline(false);
|
||||||
};
|
}, [dispatch]);
|
||||||
|
|
||||||
const handleMouseOver = () => {
|
const handleMouseOver = useCallback(() => {
|
||||||
setIsMouseOverBoundingBoxOutline(true);
|
setIsMouseOverBoundingBoxOutline(true);
|
||||||
};
|
}, []);
|
||||||
|
|
||||||
const handleMouseOut = () => {
|
const handleMouseOut = useCallback(() => {
|
||||||
!isTransformingBoundingBox &&
|
!isTransformingBoundingBox &&
|
||||||
!isMovingBoundingBox &&
|
!isMovingBoundingBox &&
|
||||||
setIsMouseOverBoundingBoxOutline(false);
|
setIsMouseOverBoundingBoxOutline(false);
|
||||||
};
|
}, [isMovingBoundingBox, isTransformingBoundingBox]);
|
||||||
|
|
||||||
const handleMouseEnterBoundingBox = () => {
|
const handleMouseEnterBoundingBox = useCallback(() => {
|
||||||
dispatch(setIsMouseOverBoundingBox(true));
|
dispatch(setIsMouseOverBoundingBox(true));
|
||||||
};
|
}, [dispatch]);
|
||||||
|
|
||||||
const handleMouseLeaveBoundingBox = () => {
|
const handleMouseLeaveBoundingBox = useCallback(() => {
|
||||||
dispatch(setIsMouseOverBoundingBox(false));
|
dispatch(setIsMouseOverBoundingBox(false));
|
||||||
};
|
}, [dispatch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Group {...rest}>
|
<Group {...rest}>
|
||||||
|
Loading…
Reference in New Issue
Block a user