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