Don't call ScrollTo for display of messages/errors if the error/message is fully visible within the window.
This commit is contained in:
parent
7c51c02928
commit
db101b2c2f
3
NEWS
3
NEWS
|
@ -1,3 +1,6 @@
|
|||
1.2.10: March 11, 2008
|
||||
* More intelligent scrolling when displaying messages and errors.
|
||||
|
||||
1.2.9: March 10, 2008
|
||||
* Show list of all notes on startup if there are no startup notes and the
|
||||
notebook isn't empty.
|
||||
|
|
|
@ -1540,7 +1540,7 @@ Wiki.prototype.display_message = function ( text, nodes, position_after ) {
|
|||
else
|
||||
appendChildNodes( "notes", div );
|
||||
|
||||
new ScrollTo( div );
|
||||
this.scroll_to( div );
|
||||
|
||||
return div;
|
||||
}
|
||||
|
@ -1580,11 +1580,19 @@ Wiki.prototype.display_error = function ( text, nodes, position_after ) {
|
|||
else
|
||||
appendChildNodes( "notes", div );
|
||||
|
||||
new ScrollTo( div );
|
||||
this.scroll_to( div );
|
||||
|
||||
return div;
|
||||
}
|
||||
|
||||
Wiki.prototype.scroll_to = function ( node ) {
|
||||
// if the message is already completely on-screen, then there's no need to scroll
|
||||
var viewport_position = getViewportPosition();
|
||||
if ( getElementPosition( node ).y < viewport_position.y ||
|
||||
getElementPosition( node ).y + getElementDimensions( node ).h > viewport_position.y + getViewportDimensions().h )
|
||||
new ScrollTo( node );
|
||||
}
|
||||
|
||||
Wiki.prototype.clear_messages = function () {
|
||||
var results = getElementsByTagAndClassName( "div", "message" );
|
||||
|
||||
|
|
Reference in New Issue