11import { PolygonSpec } from "components/Annotation/Editor/type" ;
2- import { SAVE_REMOTE_NEW_CLASS_LABEL } from "reduxes/annotationmanager/constants" ;
2+ import { SAVE_ANNOTATION_STATE_MANAGER } from "reduxes/annotationmanager/constants" ;
33import { v4 as uuidv4 } from "uuid" ;
44import {
55 ADD_DRAW_OBJECTS_BY_AI ,
@@ -18,8 +18,6 @@ import {
1818 SET_IS_DRAGGING_VIEW_PORT ,
1919 SET_KEY_DOWN_IN_EDITOR ,
2020 SET_LOCK_DRAW_OBJECT ,
21- SET_MOUSE_DOWN_OUT_LAYER_POSITION ,
22- SET_MOUSE_UP_OUT_LAYER_POSITION ,
2321 SET_SELECT_SHAPE ,
2422 SHOW_ALL_DRAW_OBJECTS_BY_AI ,
2523 SHOW_DRAW_OBJECTS_BY_AI ,
@@ -46,7 +44,6 @@ import {
4644 SetKeyDownPayload ,
4745 SetLockDetectedAreaPayload ,
4846 SetLockDrawObecjtPayload ,
49- SetMouseOutLayerPosition ,
5047 SetSelectShapePayload ,
5148 ShowDrawObjectStateIdByAIPayload ,
5249 StateHistory ,
@@ -104,8 +101,6 @@ const inititalState: AnnotationReducer = {
104101 isDraggingViewport : false ,
105102 drawObjectStateIdByAI : { } ,
106103 keyDownInEditor : null ,
107- mouseUpOutLayerPosition : null ,
108- mouseDownOutLayerPosition : null ,
109104} ;
110105const updateStateHistory = (
111106 drawObjectById : Record < string , DrawObject > ,
@@ -370,12 +365,9 @@ const annotationReducer = (
370365 } ;
371366 }
372367 case SET_DETECTED_AREA : {
373- const { detectedArea, scale } = payload as SetLockDetectedAreaPayload ;
368+ const { detectedArea } = payload as SetLockDetectedAreaPayload ;
374369 const newDrawObjectStateIdByAI = { ...state . drawObjectStateIdByAI } ;
375370 if ( detectedArea ) {
376- const scaleX = 1 / scale . x ;
377- const scaleY = 1 / scale . y ;
378-
379371 Object . keys ( state . drawObjectStateIdByAI ) . forEach ( ( drawObjectId ) => {
380372 const drawObject = state . drawObjectById [ drawObjectId ] ;
381373 if ( drawObject ) {
@@ -384,10 +376,10 @@ const annotationReducer = (
384376 const { points } = data as PolygonSpec ;
385377 const isInvalid = points . some (
386378 ( point ) =>
387- point . x < detectedArea . x * scaleX ||
388- point . y < detectedArea . y * scaleY ||
389- point . x > ( detectedArea . x + detectedArea . width ) * scaleX ||
390- point . y > ( detectedArea . y + detectedArea . height ) * scaleY
379+ point . x < detectedArea . x ||
380+ point . y < detectedArea . y ||
381+ point . x > detectedArea . x + detectedArea . width ||
382+ point . y > detectedArea . y + detectedArea . height
391383 ) ;
392384 if ( ! isInvalid ) {
393385 delete newDrawObjectStateIdByAI [ drawObjectId ] ;
@@ -461,28 +453,14 @@ const annotationReducer = (
461453 const { keyDownInEditor } = payload as SetKeyDownPayload ;
462454 return { ...state , keyDownInEditor } ;
463455 }
464- case SET_MOUSE_UP_OUT_LAYER_POSITION : {
465- const { position } = payload as SetMouseOutLayerPosition ;
466- return {
467- ...state ,
468- mouseUpOutLayerPosition : position ,
469- } ;
470- }
471- case SET_MOUSE_DOWN_OUT_LAYER_POSITION : {
472- const { position } = payload as SetMouseOutLayerPosition ;
473- return {
474- ...state ,
475- mouseDownOutLayerPosition : position ,
476- } ;
477- }
478- case SAVE_REMOTE_NEW_CLASS_LABEL . SUCCEEDED : {
456+ case SAVE_ANNOTATION_STATE_MANAGER . SUCCEEDED : {
479457 const history = state . statehHistory ;
480458 return {
481459 ...state ,
482460 statehHistory : {
483461 ...history ,
484462 savedStateHistoryId :
485- history . stateHistoryItems [ history . historyStep ] . id ,
463+ history . stateHistoryItems [ history . historyStep - 1 ] . id ,
486464 } ,
487465 } ;
488466 }
0 commit comments