mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 22:27:55 +01:00
IconPanel reimplemented
This commit is contained in:
parent
6edaf3f30a
commit
c1c022c96b
@ -19,8 +19,7 @@
|
|||||||
mindplot.widget.IconPanel = new Class({
|
mindplot.widget.IconPanel = new Class({
|
||||||
Extends:mindplot.widget.ToolbarPaneItem,
|
Extends:mindplot.widget.ToolbarPaneItem,
|
||||||
initialize:function (buttonId, model) {
|
initialize:function (buttonId, model) {
|
||||||
console.error("mindplot.widget.IconPanel");
|
this.parent(buttonId, model);
|
||||||
// this.parent(buttonId, model);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateSelectedItem:function () {
|
_updateSelectedItem:function () {
|
||||||
@ -29,9 +28,8 @@ mindplot.widget.IconPanel = new Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
buildPanel:function () {
|
buildPanel:function () {
|
||||||
var content = new Element('div', {'class':'toolbarPanel', 'id':'IconsPanel'});
|
var content = $('<div class="toolbarPanel" id="IconsPanel"></div>').css({width: 253, height: 230, padding: 5});
|
||||||
content.setStyles({width:253, height:230, padding:5});
|
content.on('click', function (event) {
|
||||||
content.addEvent("click", function (event) {
|
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -42,23 +40,25 @@ mindplot.widget.IconPanel = new Class({
|
|||||||
// Separate icons by line ...
|
// Separate icons by line ...
|
||||||
var familyContent;
|
var familyContent;
|
||||||
if ((count % 12) == 0) {
|
if ((count % 12) == 0) {
|
||||||
familyContent = new Element('div').inject(content);
|
familyContent = $('<div></div>');
|
||||||
|
content.append(familyContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
var iconId = familyIcons[j];
|
var iconId = familyIcons[j];
|
||||||
var img = new Element('img', {
|
var img = $('<img>')
|
||||||
id:iconId,
|
.attr('id', iconId)
|
||||||
src:mindplot.ImageIcon.prototype._getImageUrl(iconId)
|
.attr('src', mindplot.ImageIcon.prototype._getImageUrl(iconId))
|
||||||
});
|
.css({
|
||||||
img.setStyles({width:16,
|
width:16,
|
||||||
height:16,
|
height:16,
|
||||||
padding:"0px 2px",
|
padding:"0px 2px",
|
||||||
cursor:'pointer'
|
cursor:'pointer'
|
||||||
}).inject(familyContent);
|
});
|
||||||
|
familyContent.append(img);
|
||||||
|
|
||||||
var panel = this;
|
var panel = this;
|
||||||
var model = this.getModel();
|
var model = this.getModel();
|
||||||
img.addEvent('click', function (event) {
|
img.on('click', function (event) {
|
||||||
model.setValue(this.id);
|
model.setValue(this.id);
|
||||||
panel.hide();
|
panel.hide();
|
||||||
}.bind(img));
|
}.bind(img));
|
||||||
|
Loading…
Reference in New Issue
Block a user