mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-22 13:16:10 +03:00
Viewer: make viewport messages private, repeatable
* Marked _showMessage/_hideMessage as private * Fix DOM manipulation bug: call standard removeNode() method rather than proprietary WebKit .remove() * Change messageDiv to be the outer wrapper to simplify removing the entire message container
This commit is contained in:
parent
b912896158
commit
1ab6094420
@ -174,7 +174,7 @@ $.Viewer = function( options ) {
|
|||||||
|
|
||||||
this.addHandler( 'open-failed', function (source, args) {
|
this.addHandler( 'open-failed', function (source, args) {
|
||||||
var msg = $.getString( "Errors.Open-Failed", args.source, args.message);
|
var msg = $.getString( "Errors.Open-Failed", args.source, args.message);
|
||||||
_this.showMessage( msg );
|
_this._showMessage( msg );
|
||||||
});
|
});
|
||||||
|
|
||||||
$.ControlDock.call( this, options );
|
$.ControlDock.call( this, options );
|
||||||
@ -423,7 +423,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
$TileSource,
|
$TileSource,
|
||||||
options;
|
options;
|
||||||
|
|
||||||
_this.hideMessage();
|
_this._hideMessage();
|
||||||
|
|
||||||
//allow plain xml strings or json strings to be parsed here
|
//allow plain xml strings or json strings to be parsed here
|
||||||
if( $.type( tileSource ) == 'string' ){
|
if( $.type( tileSource ) == 'string' ){
|
||||||
@ -1077,25 +1077,29 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype,
|
|||||||
/**
|
/**
|
||||||
* Display a message in the viewport
|
* Display a message in the viewport
|
||||||
* @function
|
* @function
|
||||||
|
* @private
|
||||||
* @param {String} text message
|
* @param {String} text message
|
||||||
*/
|
*/
|
||||||
showMessage: function ( message ) {
|
_showMessage: function ( message ) {
|
||||||
this.hideMessage();
|
this._hideMessage();
|
||||||
|
|
||||||
var div = this.messageDiv = $.makeNeutralElement( "div" );
|
var div = $.makeNeutralElement( "div" );
|
||||||
div.appendChild( document.createTextNode( message ) );
|
div.appendChild( document.createTextNode( message ) );
|
||||||
|
|
||||||
this.container.appendChild( $.makeCenteredNode( div ) );
|
this.messageDiv = $.makeCenteredNode( div );
|
||||||
|
|
||||||
|
this.container.appendChild( this.messageDiv );
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide any currently displayed viewport message
|
* Hide any currently displayed viewport message
|
||||||
* @function
|
* @function
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
hideMessage: function () {
|
_hideMessage: function () {
|
||||||
var div = this.messageDiv;
|
var div = this.messageDiv;
|
||||||
if (div) {
|
if (div) {
|
||||||
div.parentNode.remove(div);
|
div.parentNode.removeChild(div);
|
||||||
delete this.messageDiv;
|
delete this.messageDiv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user