picturae / openseadragonselection

An OpenSeadragon selection plugin for the tiled viewer.
Apache License 2.0
50 stars 24 forks source link

Changing ToggleButton.tooltip programmatically #33

Closed bdrichards closed 6 years ago

bdrichards commented 6 years ago

Is it possible to change the Toggle Button's tooltip with something like the following? Seems like it should work, but setting the tooltip does not seem to override the source definition of the tooltip:

selectshun =viewer.selection({ keyboardShortcut: 'q', onSelection: function(rect) {....}, }); selectshun.toggleButton.tooltip = "Toggle Selection: keybd = q";

bdrichards commented 6 years ago

As a follow-up, The following seems to function as expected: selectshun.toggleButton.element.attributes.title.value = 'Toggle selection: keybd = q';

MindFreeze commented 6 years ago

This plugin uses the standard Openseadragon way of dealing with strings and translations but I can't remember how it works. I do know that you have to define 'Tooltips.SelectionToggle': 'Toggle Selection: keybd = q' somewhere (probably in the main OSD object instead of the plugin). There may be more info in the OSD docs.

ruisilva450 commented 6 years ago

From the example code, there you go: https://github.com/picturae/openseadragonselection/blob/2afe50e7c252b8990ea012c942781e17a1625861/javascripts/main.js#L4