Fixed some display issues

This commit is contained in:
Trevor Parscal 2011-11-30 00:48:46 +00:00
parent 68c5487c61
commit d926cc7165
3 changed files with 33 additions and 15 deletions

View file

@ -85,6 +85,22 @@
padding: 0.33em 0;
}
.es-contextView-position-above .es-contextView-menu {
bottom: 7px;
}
.es-contextView-position-below .es-contextView-menu {
top: 8px;
}
.es-contextView-position-left .es-contextView-menu {
left: 0;
}
.es-contextView-position-right .es-contextView-menu {
right: 0;
}
.es-contextView-menuItem {
padding: 0.33em 1em;
cursor: pointer;
@ -137,14 +153,6 @@
background-color: #b3d6f6;
}
.es-contextView-position-above .es-contextView-menu {
bottom: 7px;
}
.es-contextView-position-below .es-contextView-menu {
top: 8px;
}
.es-contentView {
position: relative;
z-index: 1;

View file

@ -246,12 +246,14 @@ es.ContentView.prototype.drawSelection = function( range ) {
'width': contentWidth - fromPosition.left,
'height': fromPosition.bottom - fromPosition.top
} ).show();
this.$rangeEnd.css( {
'top': toPosition.top,
'left': 0,
'width': toPosition.left,
'height': toPosition.bottom - toPosition.top
} ).show();
if ( toPosition.left ) {
this.$rangeEnd.css( {
'top': toPosition.top,
'left': 0,
'width': toPosition.left,
'height': toPosition.bottom - toPosition.top
} ).show();
}
if ( fromLineIndex + 1 < toLineIndex ) {
this.$rangeFill.css( {
'top': fromPosition.bottom,

View file

@ -37,7 +37,10 @@ es.ContextView = function( surfaceView, $overlay ) {
/* Methods */
es.ContextView.prototype.set = function() {
this.$.removeClass( 'es-contextView-position-below es-contextView-position-above' );
this.$.removeClass(
'es-contextView-position-below es-contextView-position-above ' +
'es-contextView-position-left es-contextView-position-right'
);
var selection = this.surfaceView.getModel().getSelection(),
position,
offset,
@ -60,6 +63,11 @@ es.ContextView.prototype.set = function() {
}
}
if ( position ) {
if ( position.left + this.$menu.width() < $( 'body' ).width() ) {
this.$.addClass( 'es-contextView-position-left' );
} else {
this.$.addClass( 'es-contextView-position-right' );
}
this.$.css( { 'left': position.left, 'top': position.top } );
this.$icon.fadeIn( 'fast' );
}