Skip to content

Commit

Permalink
reverted check on change frame
Browse files Browse the repository at this point in the history
  • Loading branch information
klakhov committed Nov 28, 2023
1 parent 6358dc6 commit bbc09d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion cvat-ui/src/reducers/settings-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ export default (state = defaultState, action: AnyAction): SettingsState => {
};
}
case AnnotationActionTypes.UPLOAD_JOB_ANNOTATIONS_SUCCESS:
case AnnotationActionTypes.CREATE_ANNOTATIONS_SUCCESS: {
case AnnotationActionTypes.CREATE_ANNOTATIONS_SUCCESS:
case AnnotationActionTypes.CHANGE_FRAME_SUCCESS: {
const { states } = action.payload;
const { shapes } = state;
const [clampedOpacity, clampedSelectedOpacity] = clampOpacity(states, shapes);
Expand Down
20 changes: 15 additions & 5 deletions cvat-ui/src/utils/clamp-opacity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@ export function clampOpacity(
const ENHANCED_DEFAULT_OPACITY = 30;
const ENHANCED_DEFAULT_SELECTED_OPACITY = 60;

if (shapes.opacity >= ENHANCED_DEFAULT_OPACITY && shapes.selectedOpacity >= ENHANCED_DEFAULT_SELECTED_OPACITY) {
return [shapes.opacity, shapes.selectedOpacity];
}

const opacity = Math.max(shapes.opacity, ENHANCED_DEFAULT_OPACITY);
const selectedOpacity = Math.max(shapes.selectedOpacity, ENHANCED_DEFAULT_SELECTED_OPACITY);

if (job?.dimension === DimensionType.DIMENSION_3D) {
return [opacity, selectedOpacity];
}

const withMasks = states
.some((_state: ObjectState): boolean => _state.shapeType === ShapeType.MASK);
const opacity = withMasks || job?.dimension === DimensionType.DIMENSION_3D ?
Math.max(shapes.opacity, ENHANCED_DEFAULT_OPACITY) : shapes.opacity;
const selectedOpacity = withMasks || job?.dimension === DimensionType.DIMENSION_3D ?
Math.max(shapes.selectedOpacity, ENHANCED_DEFAULT_SELECTED_OPACITY) : shapes.selectedOpacity;
if (withMasks) {
return [opacity, selectedOpacity];
}

return [opacity, selectedOpacity];
return [shapes.opacity, shapes.selectedOpacity];
}

0 comments on commit bbc09d4

Please sign in to comment.