Minor changes

This commit is contained in:
Inez Korczynski 2011-11-04 00:21:29 +00:00
parent fd7b7e7223
commit c30698b7ae

View file

@ -28,7 +28,6 @@ es.SurfaceView = function( $container, model ) {
this.cursor = {
$: $( '<div class="es-surfaceView-cursor"></div>' ).appendTo( this.$ ),
interval: null,
offset: null,
initialLeft: null,
initialBias: false
};
@ -108,6 +107,8 @@ es.SurfaceView = function( $container, model ) {
this.$window.scroll( function() {
surfaceView.dimensions.scrollTop = surfaceView.$window.scrollTop();
} );
this.documentView.on('update', function() {alert(1);});
};
es.SurfaceView.prototype.onMouseDown = function( e ) {
@ -116,14 +117,14 @@ es.SurfaceView.prototype.onMouseDown = function( e ) {
this.selection.to = this.documentView.getOffsetFromEvent( e );
if ( this.keyboard.keys.shift ) {
this.drawSelection();
this.documentView.drawSelection( this.selection );
this.hideCursor();
} else {
this.documentView.clearSelection();
this.selection.from = this.selection.to;
var position = es.Position.newFromEventPagePosition( e ),
nodeView = this.documentView.getNodeFromOffset( this.selection.to, false );
this.showCursor( this.selection.to, position.left > nodeView.$.offset().left );
this.showCursor( position.left > nodeView.$.offset().left );
}
}
if ( !this.$input.is( ':focus' ) ) {
@ -295,10 +296,8 @@ es.SurfaceView.prototype.moveCursor = function( instruction ) {
* @method
* @param offset {Integer} Position to show the cursor at
*/
es.SurfaceView.prototype.showCursor = function( offset, leftBias ) {
if ( typeof offset !== 'undefined' ) {
es.SurfaceView.prototype.showCursor = function( leftBias ) {
this.cursor.initialBias = leftBias ? true : false;
this.selection.to = offset;
var position = this.documentView.getRenderedPositionFromOffset(
this.selection.to, leftBias
);
@ -306,14 +305,11 @@ es.SurfaceView.prototype.showCursor = function( offset, leftBias ) {
'left': position.left,
'top': position.top,
'height': position.bottom - position.top
} );
} ).show();
this.$input.css({
'top': position.top,
'height': position.bottom - position.top
});
}
this.cursor.$.show();
// cursor blinking
if ( this.cursor.interval ) {