@@ -6,7 +6,6 @@ import RegionRect, { RegionRectRef } from './RegionRect';
66import { AnnotationRegion , Rect } from '../@types' ;
77import { CreateArg } from './actions' ;
88import { CreatorItem , CreatorStatus } from '../store/creator' ;
9- import { scaleShape } from './regionUtil' ;
109import './RegionAnnotations.scss' ;
1110
1211type Props = {
@@ -16,7 +15,6 @@ type Props = {
1615 isCreating : boolean ;
1716 message : string ;
1817 page : number ;
19- scale : number ;
2018 setActiveAnnotationId : ( annotationId : string | null ) => void ;
2119 setMessage : ( message : string ) => void ;
2220 setStaged : ( staged : CreatorItem | null ) => void ;
@@ -33,27 +31,21 @@ export default class RegionAnnotations extends React.PureComponent<Props, State>
3331 static defaultProps = {
3432 annotations : [ ] ,
3533 isCreating : false ,
36- scale : 1 ,
3734 } ;
3835
3936 state : State = { } ;
4037
41- setStatus ( status : CreatorStatus ) : void {
42- const { setStatus } = this . props ;
43- setStatus ( status ) ;
44- }
45-
4638 handleAnnotationActive = ( annotationId : string | null ) : void => {
4739 const { setActiveAnnotationId } = this . props ;
4840
4941 setActiveAnnotationId ( annotationId ) ;
5042 } ;
5143
5244 handleCancel = ( ) : void => {
53- const { setMessage, setStaged } = this . props ;
45+ const { setMessage, setStaged, setStatus } = this . props ;
5446 setMessage ( '' ) ;
5547 setStaged ( null ) ;
56- this . setStatus ( CreatorStatus . init ) ;
48+ setStatus ( CreatorStatus . init ) ;
5749 } ;
5850
5951 handleChange = ( text ?: string ) : void => {
@@ -62,15 +54,15 @@ export default class RegionAnnotations extends React.PureComponent<Props, State>
6254 } ;
6355
6456 handleStart = ( ) : void => {
65- const { setStaged } = this . props ;
57+ const { setStaged, setStatus } = this . props ;
6658 setStaged ( null ) ;
67- this . setStatus ( CreatorStatus . init ) ;
59+ setStatus ( CreatorStatus . init ) ;
6860 } ;
6961
7062 handleStop = ( shape : Rect ) : void => {
71- const { page, scale , setStaged } = this . props ;
72- setStaged ( { location : page , shape : scaleShape ( shape , scale , true ) } ) ;
73- this . setStatus ( CreatorStatus . staged ) ;
63+ const { page, setStaged , setStatus } = this . props ;
64+ setStaged ( { location : page , shape } ) ;
65+ setStatus ( CreatorStatus . staged ) ;
7466 } ;
7567
7668 handleSubmit = ( ) : void => {
@@ -88,7 +80,7 @@ export default class RegionAnnotations extends React.PureComponent<Props, State>
8880 } ;
8981
9082 render ( ) : JSX . Element {
91- const { activeAnnotationId, annotations, isCreating, message, scale , staged, status } = this . props ;
83+ const { activeAnnotationId, annotations, isCreating, message, staged, status } = this . props ;
9284 const { rectRef } = this . state ;
9385 const canReply = status !== CreatorStatus . init ;
9486 const isPending = status === CreatorStatus . pending ;
@@ -101,7 +93,6 @@ export default class RegionAnnotations extends React.PureComponent<Props, State>
10193 annotations = { annotations }
10294 className = "ba-RegionAnnotations-list"
10395 onSelect = { this . handleAnnotationActive }
104- scale = { scale }
10596 />
10697
10798 { /* Layer 2: Drawn (unsaved) incomplete annotation target, if any */ }
@@ -116,7 +107,7 @@ export default class RegionAnnotations extends React.PureComponent<Props, State>
116107 { /* Layer 3a: Staged (unsaved) annotation target, if any */ }
117108 { isCreating && staged && (
118109 < div className = "ba-RegionAnnotations-target" >
119- < RegionRect ref = { this . setRectRef } isActive shape = { scaleShape ( staged . shape , scale ) } />
110+ < RegionRect ref = { this . setRectRef } isActive shape = { staged . shape } />
120111 </ div >
121112 ) }
122113
0 commit comments