Compare commits

...

4 Commits

Author SHA1 Message Date
Ian Gilman
624609d800 Changelog for #2306 2023-03-06 14:25:38 -08:00
Ian Gilman
afae0ec5ec
Merge pull request #2306 from MohitBansal321/addButton
add custom button for this viewer
2023-03-06 14:22:34 -08:00
Mohit Bansal
8a201c12b4 add given button function to buttongroup 2023-02-28 01:05:22 +05:30
Mohit Bansal
f393547d9e add custom button 2023-02-27 23:52:29 +05:30
3 changed files with 22 additions and 0 deletions

View File

@ -8,6 +8,7 @@ OPENSEADRAGON CHANGELOG
* Added tileRetryMax and tileRetryDelay options, so the viewer can retry loading failed tiles (#2238 @Ughuuu, @paaddyy) * Added tileRetryMax and tileRetryDelay options, so the viewer can retry loading failed tiles (#2238 @Ughuuu, @paaddyy)
* All of the viewers keyboard handling is now in response to keydown events (it used to be split between keydown and keypress) (#2291 @MohitBansal321) * All of the viewers keyboard handling is now in response to keydown events (it used to be split between keydown and keypress) (#2291 @MohitBansal321)
* Added canvas-focus and canvas-blur events to Viewer (#2301 @MohitBansal321) * Added canvas-focus and canvas-blur events to Viewer (#2301 @MohitBansal321)
* You can now more easily add custom buttons to the viewer (#2306 @MohitBansal321)
* Improved documentation (#2297 @KevinBritten) * Improved documentation (#2297 @KevinBritten)
* Fixed: The tile-loaded event's completionCallback could be called more than once in some circumstances (#2282 @Aiosa, @pearcetm) * Fixed: The tile-loaded event's completionCallback could be called more than once in some circumstances (#2282 @Aiosa, @pearcetm)
* Fixed: Navigator display rectangle was off if the page had box-sizing: border-box (#2276 @ambujsahu81) * Fixed: Navigator display rectangle was off if the page had box-sizing: border-box (#2276 @ambujsahu81)

View File

@ -112,6 +112,17 @@ $.ButtonGroup = function( options ) {
/** @lends OpenSeadragon.ButtonGroup.prototype */ /** @lends OpenSeadragon.ButtonGroup.prototype */
$.ButtonGroup.prototype = { $.ButtonGroup.prototype = {
/**
* Adds the given button to this button group.
*
* @functions
* @param {OpenSeadragon.Button} button
*/
addButton: function( button ){
this.buttons.push(button);
this.element.appendChild(button.element);
},
/** /**
* TODO: Figure out why this is used on the public API and if a more useful * TODO: Figure out why this is used on the public API and if a more useful
* api can be created. * api can be created.

View File

@ -978,6 +978,16 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
this.forceRedraw(); this.forceRedraw();
}, },
/**
* Adds the given button to this viewer.
*
* @functions
* @param {OpenSeadragon.Button} button
*/
addButton: function( button ){
this.buttonGroup.addButton(button);
},
/** /**
* @function * @function
* @returns {Boolean} * @returns {Boolean}