KeyboardShortcutTooltip reimplemented

This commit is contained in:
Ezequiel Bergamaschi 2014-04-12 16:24:15 -03:00
parent 12a90cc820
commit 6a786a46e0

View File

@ -24,49 +24,49 @@ mindplot.widget.KeyboardShortcutTooltip = new Class({
$assert(text, "text can not be null");
this._text = text;
console.error("mindplot.widget.KeyboardShortcutTooltip must be implemented ...");
// var children = buttonElem.children();
// var tipElemId = buttonElem.id + "Tip";
// var tipDiv = new Element('div', {id:tipElemId});
// children[0].inject(tipDiv);
// tipDiv.inject(buttonElem);
//
// this.parent(tipDiv, {
// // Content can also be a function of the target element!
// content: this._buildContent.pass(buttonElem, this),
// html: true,
// position: 'bottom',
// arrowOffset : 10,
// center: true,
// arrowSize: 3,
// offset : {x:0,y:-2},
// className: 'keyboardShortcutTip',
// preventHideOnOver : false,
// motionOnShow:false,
// motionOnHide:false,
// fx: { 'duration': '100' }
// });
//
// tipDiv.addEvent('click', function(e) {
// tipDiv.fireEvent('mouseleave', e);
// });
var children = buttonElem.children().first();
var tipElemId = buttonElem.id + "Tip";
var tipDiv = $('<div></div>').attr('id', tipElemId);
tipDiv.append(children);
buttonElem.append(tipDiv);
this.parent(tipDiv, {
//Content can also be a function of the target element!
content: this._buildContent.pass(buttonElem, this),
html: true,
position: 'bottom',
arrowOffset : 10,
center: true,
arrowSize: 3,
offset : {x:0,y:-2},
className: 'keyboardShortcutTip',
preventHideOnOver : false,
//FIXME: this options are not useful anymore
motionOnShow:false,
motionOnHide:false,
fx: { 'duration': '100' }
});
tipDiv.on('click', function(e) {
tipDiv.trigger('mouseleave', e);
});
},
_buildContent : function() {
var result = new Element('div');
result.setStyles({
var result = $('<div></div>');
result.css({
padding:'3px 0px',
width:'100%'
});
var textContainer = new Element('div', {text:this._text});
textContainer.setStyles({
var textContainer = $('<div></div>').text(this._text);
textContainer.css({
width: '100%',
textAlign: 'center',
'font-weight':'bold'
});
textContainer.inject(result);
result.append(textContainer);
return result;
}
});