Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feature/broken-history'
Browse files Browse the repository at this point in the history
  • Loading branch information
yasenytskyoleh committed May 2, 2024
2 parents 4f4cffe + 0f66300 commit d35c761
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@idapgroup/react-image-annotate",
"version": "2.0.16",
"version": "2.1.0",
"type": "module",
"main": "dist/react-image-annotate.js",
"types": "dist/lib.d.ts",
Expand Down
6 changes: 1 addition & 5 deletions src/Annotator/reducers/general-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export default <T extends ImmutableObject<MainLayoutState>>(
) as ImmutableObject<MainLayoutState>
).setIn(["selectedImageFrameTime"], frameTime);
};

switch (action.type) {
case "@@INIT": {
return state;
Expand Down Expand Up @@ -272,7 +271,6 @@ export default <T extends ImmutableObject<MainLayoutState>>(
}
case "MOUSE_MOVE": {
const { x, y } = action;

if (!state.mode) return state;
if (!activeImage) return state;
switch (state.mode.mode) {
Expand Down Expand Up @@ -381,7 +379,6 @@ export default <T extends ImmutableObject<MainLayoutState>>(
const regionIndex = getRegionIndex(regionId);
if (regionIndex === null || !activeImage.regions) return state;
const box = activeImage.regions[regionIndex];

return Immutable(state).setIn(
[...pathToActiveImage, "regions", regionIndex.toString()],
{
Expand Down Expand Up @@ -822,7 +819,7 @@ export default <T extends ImmutableObject<MainLayoutState>>(
mode: null,
} as T;
}
break;
return { ...state, mode: null };
}
case "MOVE_REGION":
case "RESIZE_KEYPOINTS":
Expand Down Expand Up @@ -880,7 +877,6 @@ export default <T extends ImmutableObject<MainLayoutState>>(
default:
return state;
}
break;
}
case "OPEN_REGION_EDITOR": {
const regionIndex = getRegionIndex(action.region);
Expand Down
16 changes: 7 additions & 9 deletions src/Annotator/reducers/history-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ export default (
prevState !== nextState &&
Object.keys(typesToSaveWithHistory).includes(action.type)
) {
const historyItem = [
{
time: moment().toDate(),
state: (
Immutable(prevState) as ImmutableObject<MainLayoutState>
).without("history"),
name: typesToSaveWithHistory[action.type] || action.type,
},
];
const historyItem = {
time: moment().toDate(),
state: (
Immutable(prevState) as ImmutableObject<MainLayoutState>
).without("history"),
name: typesToSaveWithHistory[action.type] || action.type,
};
const prevItems = nextState.history || [];
const newValue = [historyItem, ...prevItems].slice(0, 9);
const immutableNextState = Immutable(
Expand Down
2 changes: 1 addition & 1 deletion src/workspace/SidebarBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const HeaderDiv = styled("div")(() => ({
},
}));
const ContentDiv = styled("div")(() => ({
maxHeight: 300,
maxHeight: 200,
overflowY: "auto",
"&.noScroll": {
overflowY: "visible",
Expand Down

0 comments on commit d35c761

Please sign in to comment.