Skip to content
Snippets Groups Projects
Commit b4197ad0 authored by Samuel Jugnet's avatar Samuel Jugnet
Browse files

amelioration comportement delete

parent 2a19677c
Branches
No related tags found
1 merge request!10Draft: MigratingAnnotationCreation to MUI5.
......@@ -54,6 +54,18 @@ function AnnotationDrawing(props) {
/** */
useEffect(() => {
// if tool is cursor or edit select latest shape
if (props.activeTool === 'cursor' || props.activeTool === 'edit') {
const newCurrentShape = shapes[shapes.length - 1];
// get latest shape in the list
if(newCurrentShape) {
setCurrentShape(newCurrentShape );
}
}
// console.log('shapes', shapes);
}, [shapes]);
......@@ -117,10 +129,6 @@ function AnnotationDrawing(props) {
const newShapes = shapes.filter((shape) => shape.id !== currentShape.id);
setShapes(newShapes);
// get latest shape in the list
const newCurrentShape = newShapes[newShapes.length - 1];
setCurrentShape(newShapes.length > 0 ? newCurrentShape : null);
updateCurrentShapeInShapes();
......
......@@ -32,10 +32,10 @@ function Freehand({
<>
<Group
ref={shapeRef}
width={ 1920}
height={1080}
x={ 0}
y={ 0}
// width={ 1920}
// height={1080}
// x={ 0}
// y={ 0}
onClick={handleClick}
>
{shape.lines.map((line, i) => (
......@@ -48,9 +48,7 @@ function Freehand({
tension={0.5}
lineCap="round"
lineJoin="round"
globalCompositeOperation={
line.tool === 'eraser' ? 'destination-out' : 'source-over'
}
/>
))}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment