@searpent/react-image-annotate 2.0.26 → 2.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -844,6 +844,8 @@ export default (function (state, action) {
|
|
|
844
844
|
switch (state.mode.mode) {
|
|
845
845
|
case "RESIZE_BOX":
|
|
846
846
|
{
|
|
847
|
+
state = setIn(state, ["selectedTool"], 'select');
|
|
848
|
+
|
|
847
849
|
if (state.mode.isNew) {
|
|
848
850
|
if (Math.abs(state.mode.original.x - _x2) < 0.002 || Math.abs(state.mode.original.y - _y2) < 0.002) {
|
|
849
851
|
return setIn(modifyRegion(state.mode.regionId, null), ["mode"], null);
|
|
@@ -964,6 +966,7 @@ export default (function (state, action) {
|
|
|
964
966
|
var _regionIndex18 = getRegionIndex(action.region);
|
|
965
967
|
|
|
966
968
|
if (_regionIndex18 === null) return state;
|
|
969
|
+
state = saveToHistory(state, "Delete region");
|
|
967
970
|
return setIn(state, [].concat(_toConsumableArray(pathToActiveImage), ["regions"]), (activeImage.regions || []).filter(function (r) {
|
|
968
971
|
return r.id !== action.region.id;
|
|
969
972
|
}));
|
|
@@ -973,6 +976,7 @@ export default (function (state, action) {
|
|
|
973
976
|
{
|
|
974
977
|
var _groupId = action.groupId;
|
|
975
978
|
if (_groupId === null || _groupId === undefined) return state;
|
|
979
|
+
state = saveToHistory(state, "Delete group");
|
|
976
980
|
return setIn(state, [].concat(_toConsumableArray(pathToActiveImage), ["regions"]), (activeImage.regions || []).filter(function (r) {
|
|
977
981
|
return r.groupId !== _groupId;
|
|
978
982
|
}));
|
|
@@ -980,6 +984,7 @@ export default (function (state, action) {
|
|
|
980
984
|
|
|
981
985
|
case "DELETE_SELECTED_REGION":
|
|
982
986
|
{
|
|
987
|
+
state = saveToHistory(state, "Delete selected region");
|
|
983
988
|
return setIn(state, [].concat(_toConsumableArray(pathToActiveImage), ["regions"]), (activeImage.regions || []).filter(function (r) {
|
|
984
989
|
return !r.highlighted;
|
|
985
990
|
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
function RightSidebarItemsWrapper(_ref) {
|
|
4
|
+
var children = _ref.children;
|
|
5
|
+
var elementRef = useRef();
|
|
6
|
+
useEffect(function () {
|
|
7
|
+
if (elementRef) {
|
|
8
|
+
var divElement = elementRef.current;
|
|
9
|
+
var parentEl = divElement.parentElement;
|
|
10
|
+
parentEl.style.overflowY = "scroll";
|
|
11
|
+
}
|
|
12
|
+
}, []);
|
|
13
|
+
return React.createElement("div", {
|
|
14
|
+
ref: elementRef
|
|
15
|
+
}, children);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export default RightSidebarItemsWrapper;
|
package/MainLayout/index.js
CHANGED
|
@@ -35,7 +35,8 @@ import { withHotKeys } from "react-hotkeys";
|
|
|
35
35
|
import Editor from "../Editor";
|
|
36
36
|
import regionsToBlocks from '../utils/regions-to-blocks';
|
|
37
37
|
import PageSelector from "../PageSelector";
|
|
38
|
-
import regionsGroups from '../utils/regions-groups';
|
|
38
|
+
import regionsGroups from '../utils/regions-groups';
|
|
39
|
+
import RightSidebarItemsWrapper from './RightSidebarItemsWrapper'; // import Fullscreen from "../Fullscreen"
|
|
39
40
|
|
|
40
41
|
var emptyArr = [];
|
|
41
42
|
var theme = createTheme();
|
|
@@ -422,7 +423,7 @@ export var MainLayout = function MainLayout(_ref5) {
|
|
|
422
423
|
}].filter(Boolean).filter(function (a) {
|
|
423
424
|
return a.alwaysShowing || state.enabledTools.includes(a.name);
|
|
424
425
|
}),
|
|
425
|
-
rightSidebarItems: [debugModeOn && React.createElement(DebugBox, {
|
|
426
|
+
rightSidebarItems: [React.createElement(RightSidebarItemsWrapper, null, [debugModeOn && React.createElement(DebugBox, {
|
|
426
427
|
state: debugModeOn,
|
|
427
428
|
lastAction: state.lastAction,
|
|
428
429
|
key: "debug-box"
|
|
@@ -484,7 +485,7 @@ export var MainLayout = function MainLayout(_ref5) {
|
|
|
484
485
|
groups: allowedGroups,
|
|
485
486
|
onAddGroup: onAddGroup,
|
|
486
487
|
key: "groups-editor"
|
|
487
|
-
})].filter(Boolean)
|
|
488
|
+
})].filter(Boolean))]
|
|
488
489
|
}, canvas)), showEditor && React.createElement(EditorWrapper, {
|
|
489
490
|
id: "editor-wrapper"
|
|
490
491
|
}, React.createElement(Editor, {
|