Fix icon pannel selection.

This commit is contained in:
Paulo Veiga 2011-10-10 01:23:22 -03:00
parent c2670d5140
commit 2f9b53b045

View File

@ -25,6 +25,9 @@ mindplot.widget.IconPanel = new Class({
buildPanel: function() { buildPanel: function() {
var content = new Element('div', {'class':'toolbarPanel','id':'IconsPanel'}); var content = new Element('div', {'class':'toolbarPanel','id':'IconsPanel'});
content.setStyles({width:253,height:200,padding:5}); content.setStyles({width:253,height:200,padding:5});
content.addEvent("click", function(event) {
event.stopPropagation()
});
var count = 0; var count = 0;
for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i = i + 1) { for (var i = 0; i < mindplot.ImageIcon.prototype.ICON_FAMILIES.length; i = i + 1) {
@ -43,9 +46,11 @@ mindplot.widget.IconPanel = new Class({
}); });
img.setStyles({width:16,height:16,padding:"0px 2px"}).inject(familyContent); img.setStyles({width:16,height:16,padding:"0px 2px"}).inject(familyContent);
var panel = this;
var model = this.getModel(); var model = this.getModel();
img.addEvent('click', function() { img.addEvent('click', function(event) {
model.setValue(this.id); model.setValue(this.id);
panel.hide();
}.bind(img)); }.bind(img));
count = count + 1; count = count + 1;