Skip to content

Commit 094803f

Browse files
mgermeriegchoqueux
authored andcommitted
feature(widgets): Navigation tooltips can be parametrized
1 parent b65c081 commit 094803f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Utils/gui/Navigation.js

+8
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class Navigation extends Widget {
148148
this.compass = this.addButton(
149149
'compass',
150150
'',
151+
'Rotate the camera to face North',
151152
this.onClick.compass,
152153
'widgets',
153154
);
@@ -163,6 +164,7 @@ class Navigation extends Widget {
163164
this.switch3dButton = this.addButton(
164165
'3d-button',
165166
'3D',
167+
'Tilt the camera',
166168
this.onClick.toggle3D,
167169
);
168170

@@ -177,6 +179,7 @@ class Navigation extends Widget {
177179
this.zoomInButton = this.addButton(
178180
'zoom-in-button',
179181
'<span class="widget-zoom-button-logo"></span>',
182+
'Zoom in',
180183
this.onClick.zoomIn,
181184
'zoom-button-bar',
182185
);
@@ -187,6 +190,7 @@ class Navigation extends Widget {
187190
this.zoomOutButton = this.addButton(
188191
'zoom-out-button',
189192
'<span id="zoom-out-logo" class="widget-zoom-button-logo"></span>',
193+
'Zoom out',
190194
this.onClick.zoomOut,
191195
'zoom-button-bar',
192196
);
@@ -197,6 +201,8 @@ class Navigation extends Widget {
197201
*
198202
* @param {string} id The unique id the created button should be given.
199203
* @param {string} [content=''] An HTML string defining the content of the button.
204+
* @param {string} [info=''] An HTML string defining information on the button. This string will be
205+
* displayed in a tooltip when hovering the button.
200206
* @param {function} [actionOnClick] The method that should be executed when the button is clicked on.
201207
* @param {string} [parentId] The unique id of a button bar in which the created button should be added.
202208
* A button bar is a group which contains one or several buttons. All
@@ -210,6 +216,7 @@ class Navigation extends Widget {
210216
addButton(
211217
id,
212218
content = '',
219+
info = '',
213220
actionOnClick = () => {},
214221
parentId,
215222
) {
@@ -222,6 +229,7 @@ class Navigation extends Widget {
222229
button.className = 'widget-button';
223230
button.id = id;
224231
button.innerHTML = content;
232+
button.title = info;
225233

226234
buttonBar.appendChild(button);
227235

0 commit comments

Comments
 (0)