Merge branch 'fe/develop' of https://lab.ssafy.com/s11-s-project/S11P21S002 into fe/refactor/review-detail
This commit is contained in:
commit
9e2a6033aa
@ -1,4 +1,4 @@
|
|||||||
import { useRef, useState } from 'react';
|
import { useEffect, useRef, useState } from 'react';
|
||||||
import { Group, Rect, Text, Image } from 'react-konva';
|
import { Group, Rect, Text, Image } from 'react-konva';
|
||||||
import { CommentResponse } from '@/types';
|
import { CommentResponse } from '@/types';
|
||||||
import useImage from 'use-image';
|
import useImage from 'use-image';
|
||||||
@ -7,6 +7,7 @@ import deleteIconSrc from '@/assets/icons/delete.svg';
|
|||||||
import toggleUpIconSrc from '@/assets/icons/chevron-up.svg';
|
import toggleUpIconSrc from '@/assets/icons/chevron-up.svg';
|
||||||
import toggleDownIconSrc from '@/assets/icons/chevron-down.svg';
|
import toggleDownIconSrc from '@/assets/icons/chevron-down.svg';
|
||||||
import Konva from 'konva';
|
import Konva from 'konva';
|
||||||
|
import { TRANSFORM_CHANGE_STR } from '@/constants';
|
||||||
|
|
||||||
interface CommentLabelProps {
|
interface CommentLabelProps {
|
||||||
stage: Konva.Stage;
|
stage: Konva.Stage;
|
||||||
@ -48,6 +49,23 @@ export default function CommentLabel({
|
|||||||
toggleComment(comment.id);
|
toggleComment(comment.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const transformEvents = TRANSFORM_CHANGE_STR.join(' ');
|
||||||
|
|
||||||
|
stage?.on(transformEvents, () => {
|
||||||
|
if (!groupRef.current) return;
|
||||||
|
|
||||||
|
groupRef.current?.scale({
|
||||||
|
x: 1 / stage.getAbsoluteScale().x,
|
||||||
|
y: 1 / stage.getAbsoluteScale().y,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
stage?.off(transformEvents);
|
||||||
|
};
|
||||||
|
}, [stage]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
stage && (
|
stage && (
|
||||||
<Group
|
<Group
|
||||||
|
@ -237,6 +237,7 @@ export default function ImageCanvas() {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (selectedLabelId === null) return;
|
||||||
if (e.target === e.target.getStage() || e.target.getClassName() === 'Image') {
|
if (e.target === e.target.getStage() || e.target.getClassName() === 'Image') {
|
||||||
setSelectedLabelId(null);
|
setSelectedLabelId(null);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user