Skip to content

Commit 60861fb

Browse files
committed
after CR
1 parent db60edb commit 60861fb

File tree

3 files changed

+43
-16
lines changed

3 files changed

+43
-16
lines changed

src/logic/actions/LabelActions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export class LabelActions {
103103
}
104104
}
105105

106-
public static labelExistInLabelNames(label: string): boolean {
106+
public static labelExistsInLabelNames(label: string): boolean {
107107
const labelNames: LabelName[] = LabelsSelector.getLabelNames();
108108
return labelNames
109109
.map((label: LabelName) => label.name)

src/views/EditorView/EditorTopNavigationBar/EditorTopNavigationBar.tsx

+41-14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import {LabelsSelector} from "../../../store/selectors/LabelsSelector";
1313
import {LabelType} from "../../../data/enums/LabelType";
1414
import {AISelector} from "../../../store/selectors/AISelector";
1515
import {AIActions} from "../../../logic/actions/AIActions";
16+
import Fade from "@material-ui/core/Fade";
17+
import withStyles from "@material-ui/core/styles/withStyles";
18+
import {Tooltip} from "@material-ui/core";
1619

1720
interface IProps {
1821
activeContext: ContextType;
@@ -41,63 +44,87 @@ const EditorTopNavigationBar: React.FC<IProps> = ({activeContext, updateImageDra
4144
}
4245
};
4346

47+
const DarkTooltip = withStyles(theme => ({
48+
tooltip: {
49+
backgroundColor: "#171717",
50+
color: "#ffffff",
51+
boxShadow: theme.shadows[1],
52+
fontSize: 11,
53+
maxWidth: 120
54+
},
55+
}))(Tooltip);
56+
57+
const attachTooltip = (element: JSX.Element, message: string): JSX.Element => {
58+
return <DarkTooltip
59+
disableFocusListener
60+
title={message}
61+
TransitionComponent={Fade}
62+
TransitionProps={{ timeout: 500 }}
63+
placement="bottom"
64+
>
65+
<div>
66+
{element}
67+
</div>
68+
</DarkTooltip>
69+
};
70+
4471
return (
4572
<div className={getClassName()}>
4673
<div className="ButtonWrapper">
47-
<ImageButton
74+
{attachTooltip(<ImageButton
4875
image={"ico/zoom-in.png"}
4976
imageAlt={"zoom-in"}
5077
buttonSize={{width: 30, height: 30}}
5178
padding={10}
5279
onClick={() => ViewPortActions.zoomIn()}
53-
/>
54-
<ImageButton
80+
/>, "Zoom in")}
81+
{attachTooltip(<ImageButton
5582
image={"ico/zoom-out.png"}
5683
imageAlt={"zoom-out"}
5784
buttonSize={{width: 30, height: 30}}
5885
padding={10}
5986
onClick={() => ViewPortActions.zoomOut()}
60-
/>
61-
<ImageButton
87+
/>, "Zoom out")}
88+
{attachTooltip(<ImageButton
6289
image={"ico/zoom-fit.png"}
6390
imageAlt={"zoom-fit"}
6491
buttonSize={{width: 30, height: 30}}
6592
padding={10}
6693
onClick={() => ViewPortActions.setDefaultZoom()}
67-
/>
68-
<ImageButton
94+
/>, "Fit image")}
95+
{attachTooltip(<ImageButton
6996
image={"ico/zoom-max.png"}
7097
imageAlt={"zoom-max"}
7198
buttonSize={{width: 30, height: 30}}
7299
padding={10}
73100
onClick={() => ViewPortActions.setOneForOneZoom()}
74-
/>
101+
/>, "Max zoom")}
75102
</div>
76103
<div className="ButtonWrapper">
77-
<ImageButton
104+
{attachTooltip(<ImageButton
78105
image={"ico/hand.png"}
79106
imageAlt={"hand"}
80107
buttonSize={{width: 30, height: 30}}
81108
padding={10}
82109
onClick={imageDragOnClick}
83110
isActive={imageDragMode}
84-
/>
111+
/>, "Drag image")}
85112
</div>
86113
{activeLabelType === LabelType.RECTANGLE && AISelector.isAIModelLoaded() && <div className="ButtonWrapper">
87-
<ImageButton
114+
{attachTooltip(<ImageButton
88115
image={"ico/accept-all.png"}
89116
imageAlt={"accept-all"}
90117
buttonSize={{width: 30, height: 30}}
91118
padding={10}
92119
onClick={() => AIActions.acceptAllSuggestedRectLabels(LabelsSelector.getActiveImageData())}
93-
/>
94-
<ImageButton
120+
/>, "Accept all suggested labels")}
121+
{attachTooltip(<ImageButton
95122
image={"ico/reject-all.png"}
96123
imageAlt={"reject-all"}
97124
buttonSize={{width: 30, height: 30}}
98125
padding={10}
99126
onClick={() => AIActions.rejectAllSuggestedRectLabels(LabelsSelector.getActiveImageData())}
100-
/>
127+
/>, "Reject all suggested labels")}
101128
</div>}
102129
</div>
103130
)

src/views/EditorView/LabelControlPanel/LabelControlPanel.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const LabelControlPanel: React.FC<IProps> = ({position, updatePreventCustomCurso
9595
padding={15}
9696
onClick={onReject}
9797
/>
98-
{labelData.suggestedLabel && LabelActions.labelExistInLabelNames(labelData.suggestedLabel) ?
98+
{labelData.suggestedLabel && LabelActions.labelExistsInLabelNames(labelData.suggestedLabel) ?
9999
<div className="SuggestedLabel">
100100
{labelData.suggestedLabel}
101101
</div> :

0 commit comments

Comments
 (0)