2011-11-30 07:10:15 +00:00
|
|
|
es.Tool = function( toolbar ) {
|
2011-11-30 08:07:22 +00:00
|
|
|
this.$ = $( '<div>' );
|
2011-11-30 07:35:59 +00:00
|
|
|
if ( !toolbar ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var _this = this;
|
2011-11-30 07:10:15 +00:00
|
|
|
this.toolbar = toolbar;
|
2011-11-30 07:35:59 +00:00
|
|
|
this.toolbar.on( 'update', function( param ) {
|
|
|
|
var selection = _this.toolbar.surfaceView.currentSelection;
|
|
|
|
var annotations;
|
|
|
|
|
|
|
|
if( selection.from === selection.to ) {
|
|
|
|
annotations = _this.toolbar.surfaceView.documentView.model.getAnnotationsFromOffset(
|
|
|
|
selection.to
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
annotations = _this.toolbar.surfaceView.documentView.model.getAnnotationsFromRange(
|
|
|
|
selection
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
_this.updateState( selection, annotations );
|
|
|
|
} );
|
|
|
|
};
|
|
|
|
|
2011-11-30 07:42:10 +00:00
|
|
|
es.Tool.prototype.updateState = function() {
|
2011-11-30 07:35:59 +00:00
|
|
|
};
|