@@ -13,6 +13,9 @@ import {LabelsSelector} from "../../../store/selectors/LabelsSelector";
13
13
import { LabelType } from "../../../data/enums/LabelType" ;
14
14
import { AISelector } from "../../../store/selectors/AISelector" ;
15
15
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" ;
16
19
17
20
interface IProps {
18
21
activeContext : ContextType ;
@@ -41,63 +44,87 @@ const EditorTopNavigationBar: React.FC<IProps> = ({activeContext, updateImageDra
41
44
}
42
45
} ;
43
46
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
+
44
71
return (
45
72
< div className = { getClassName ( ) } >
46
73
< div className = "ButtonWrapper" >
47
- < ImageButton
74
+ { attachTooltip ( < ImageButton
48
75
image = { "ico/zoom-in.png" }
49
76
imageAlt = { "zoom-in" }
50
77
buttonSize = { { width : 30 , height : 30 } }
51
78
padding = { 10 }
52
79
onClick = { ( ) => ViewPortActions . zoomIn ( ) }
53
- />
54
- < ImageButton
80
+ /> , "Zoom in" ) }
81
+ { attachTooltip ( < ImageButton
55
82
image = { "ico/zoom-out.png" }
56
83
imageAlt = { "zoom-out" }
57
84
buttonSize = { { width : 30 , height : 30 } }
58
85
padding = { 10 }
59
86
onClick = { ( ) => ViewPortActions . zoomOut ( ) }
60
- />
61
- < ImageButton
87
+ /> , "Zoom out" ) }
88
+ { attachTooltip ( < ImageButton
62
89
image = { "ico/zoom-fit.png" }
63
90
imageAlt = { "zoom-fit" }
64
91
buttonSize = { { width : 30 , height : 30 } }
65
92
padding = { 10 }
66
93
onClick = { ( ) => ViewPortActions . setDefaultZoom ( ) }
67
- />
68
- < ImageButton
94
+ /> , "Fit image" ) }
95
+ { attachTooltip ( < ImageButton
69
96
image = { "ico/zoom-max.png" }
70
97
imageAlt = { "zoom-max" }
71
98
buttonSize = { { width : 30 , height : 30 } }
72
99
padding = { 10 }
73
100
onClick = { ( ) => ViewPortActions . setOneForOneZoom ( ) }
74
- />
101
+ /> , "Max zoom" ) }
75
102
</ div >
76
103
< div className = "ButtonWrapper" >
77
- < ImageButton
104
+ { attachTooltip ( < ImageButton
78
105
image = { "ico/hand.png" }
79
106
imageAlt = { "hand" }
80
107
buttonSize = { { width : 30 , height : 30 } }
81
108
padding = { 10 }
82
109
onClick = { imageDragOnClick }
83
110
isActive = { imageDragMode }
84
- />
111
+ /> , "Drag image" ) }
85
112
</ div >
86
113
{ activeLabelType === LabelType . RECTANGLE && AISelector . isAIModelLoaded ( ) && < div className = "ButtonWrapper" >
87
- < ImageButton
114
+ { attachTooltip ( < ImageButton
88
115
image = { "ico/accept-all.png" }
89
116
imageAlt = { "accept-all" }
90
117
buttonSize = { { width : 30 , height : 30 } }
91
118
padding = { 10 }
92
119
onClick = { ( ) => AIActions . acceptAllSuggestedRectLabels ( LabelsSelector . getActiveImageData ( ) ) }
93
- />
94
- < ImageButton
120
+ /> , "Accept all suggested labels" ) }
121
+ { attachTooltip ( < ImageButton
95
122
image = { "ico/reject-all.png" }
96
123
imageAlt = { "reject-all" }
97
124
buttonSize = { { width : 30 , height : 30 } }
98
125
padding = { 10 }
99
126
onClick = { ( ) => AIActions . rejectAllSuggestedRectLabels ( LabelsSelector . getActiveImageData ( ) ) }
100
- />
127
+ /> , "Reject all suggested labels" ) }
101
128
</ div > }
102
129
</ div >
103
130
)
0 commit comments