Skip to content

Commit d35c761

Browse files
Merge remote-tracking branch 'origin/feature/broken-history'
2 parents 4f4cffe + 0f66300 commit d35c761

File tree

4 files changed

+10
-16
lines changed

4 files changed

+10
-16
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@idapgroup/react-image-annotate",
3-
"version": "2.0.16",
3+
"version": "2.1.0",
44
"type": "module",
55
"main": "dist/react-image-annotate.js",
66
"types": "dist/lib.d.ts",

src/Annotator/reducers/general-reducer.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ export default <T extends ImmutableObject<MainLayoutState>>(
130130
) as ImmutableObject<MainLayoutState>
131131
).setIn(["selectedImageFrameTime"], frameTime);
132132
};
133-
134133
switch (action.type) {
135134
case "@@INIT": {
136135
return state;
@@ -272,7 +271,6 @@ export default <T extends ImmutableObject<MainLayoutState>>(
272271
}
273272
case "MOUSE_MOVE": {
274273
const { x, y } = action;
275-
276274
if (!state.mode) return state;
277275
if (!activeImage) return state;
278276
switch (state.mode.mode) {
@@ -381,7 +379,6 @@ export default <T extends ImmutableObject<MainLayoutState>>(
381379
const regionIndex = getRegionIndex(regionId);
382380
if (regionIndex === null || !activeImage.regions) return state;
383381
const box = activeImage.regions[regionIndex];
384-
385382
return Immutable(state).setIn(
386383
[...pathToActiveImage, "regions", regionIndex.toString()],
387384
{
@@ -822,7 +819,7 @@ export default <T extends ImmutableObject<MainLayoutState>>(
822819
mode: null,
823820
} as T;
824821
}
825-
break;
822+
return { ...state, mode: null };
826823
}
827824
case "MOVE_REGION":
828825
case "RESIZE_KEYPOINTS":
@@ -880,7 +877,6 @@ export default <T extends ImmutableObject<MainLayoutState>>(
880877
default:
881878
return state;
882879
}
883-
break;
884880
}
885881
case "OPEN_REGION_EDITOR": {
886882
const regionIndex = getRegionIndex(action.region);

src/Annotator/reducers/history-handler.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,13 @@ export default (
4747
prevState !== nextState &&
4848
Object.keys(typesToSaveWithHistory).includes(action.type)
4949
) {
50-
const historyItem = [
51-
{
52-
time: moment().toDate(),
53-
state: (
54-
Immutable(prevState) as ImmutableObject<MainLayoutState>
55-
).without("history"),
56-
name: typesToSaveWithHistory[action.type] || action.type,
57-
},
58-
];
50+
const historyItem = {
51+
time: moment().toDate(),
52+
state: (
53+
Immutable(prevState) as ImmutableObject<MainLayoutState>
54+
).without("history"),
55+
name: typesToSaveWithHistory[action.type] || action.type,
56+
};
5957
const prevItems = nextState.history || [];
6058
const newValue = [historyItem, ...prevItems].slice(0, 9);
6159
const immutableNextState = Immutable(

src/workspace/SidebarBox/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const HeaderDiv = styled("div")(() => ({
3535
},
3636
}));
3737
const ContentDiv = styled("div")(() => ({
38-
maxHeight: 300,
38+
maxHeight: 200,
3939
overflowY: "auto",
4040
"&.noScroll": {
4141
overflowY: "visible",

0 commit comments

Comments
 (0)