Skip to content

Commit

Permalink
Fixed AAM bug: #1750
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev committed Jun 19, 2020
1 parent 4047df9 commit 4065bb3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface StateToProps {
jobInstance: any;
keyMap: Record<string, ExtendedKeyMapOptions>;
normalizedKeyMap: Record<string, string>;
canvasIsReady: boolean;
}

interface DispatchToProps {
Expand All @@ -58,6 +59,9 @@ function mapStateToProps(state: CombinedState): StateToProps {
instance: jobInstance,
labels,
},
canvas: {
ready: canvasIsReady,
},
},
shortcuts: {
keyMap,
Expand All @@ -73,6 +77,7 @@ function mapStateToProps(state: CombinedState): StateToProps {
states,
keyMap,
normalizedKeyMap,
canvasIsReady,
};
}

Expand All @@ -98,6 +103,7 @@ function AttributeAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.
activateObject,
keyMap,
normalizedKeyMap,
canvasIsReady,
} = props;

const [labelAttrMap, setLabelAttrMap] = useState(
Expand All @@ -117,14 +123,16 @@ function AttributeAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.
? labelAttrMap[activeObjectState.label.id]
: null;

if (activeObjectState) {
const attribute = labelAttrMap[activeObjectState.label.id];
if (attribute && attribute.id !== activatedAttributeID) {
activateObject(activatedStateID, attribute ? attribute.id : null);
if (canvasIsReady) {
if (activeObjectState) {
const attribute = labelAttrMap[activeObjectState.label.id];
if (attribute && attribute.id !== activatedAttributeID) {
activateObject(activatedStateID, attribute ? attribute.id : null);
}
} else if (states.length) {
const attribute = labelAttrMap[states[0].label.id];
activateObject(states[0].clientID, attribute ? attribute.id : null);
}
} else if (states.length) {
const attribute = labelAttrMap[states[0].label.id];
activateObject(states[0].clientID, attribute ? attribute.id : null);
}

const nextObject = (step: number): void => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,12 @@ export default class CanvasWrapperComponent extends React.PureComponent<Props> {
const {
annotations,
frameData,
frameAngle,
canvasInstance,
} = this.props;

if (frameData !== null) {
canvasInstance.setup(frameData, annotations
.filter((e) => e.objectType !== ObjectType.TAG));
canvasInstance.rotate(frameAngle);
}
}

Expand Down

0 comments on commit 4065bb3

Please sign in to comment.