Resize icons on scale.
This commit is contained in:
@@ -48,11 +48,12 @@ mindplot.IconGroup = new Class({
|
||||
|
||||
seIconSize : function(width, height) {
|
||||
this._iconSize = {width:width,height:height};
|
||||
this._group.setCoordSize(width / mindplot.Icon.HEIGHT, height / mindplot.Icon.HEIGHT);
|
||||
this._resize(this._icons.length);
|
||||
},
|
||||
|
||||
addIcon : function(icon) {
|
||||
$defined(icon, "icon is not defined");
|
||||
icon.getImage().setVisibility(false);
|
||||
|
||||
icon.setGroup(this);
|
||||
this._icons.push(icon);
|
||||
@@ -66,6 +67,8 @@ mindplot.IconGroup = new Class({
|
||||
|
||||
// Register event for the group ..
|
||||
this._removeTip.decorate(this._topicId, icon);
|
||||
|
||||
icon.getImage().setVisibility(true);
|
||||
},
|
||||
|
||||
_findIconFromUrl : function(url) {
|
||||
|
@@ -254,7 +254,7 @@ mindplot.Topic = new Class({
|
||||
},
|
||||
|
||||
_buildIconGroup : function() {
|
||||
var textHeight = this.getTextShape().getHeight();
|
||||
var textHeight = this.getTextShape().getFontHeight();
|
||||
var result = new mindplot.IconGroup(this.getId(), textHeight);
|
||||
var padding = this._getInnerPadding();
|
||||
result.setPosition(padding, padding);
|
||||
@@ -426,8 +426,10 @@ mindplot.Topic = new Class({
|
||||
},
|
||||
|
||||
setFontSize : function(value, updateModel) {
|
||||
|
||||
var textShape = this.getTextShape();
|
||||
textShape.setSize(value);
|
||||
|
||||
if ($defined(updateModel) && updateModel) {
|
||||
var model = this.getModel();
|
||||
model.setFontSize(value);
|
||||
@@ -1142,10 +1144,17 @@ mindplot.Topic = new Class({
|
||||
var textHeight = textShape.getHeight();
|
||||
var topicPadding = this._getInnerPadding();
|
||||
|
||||
// Adjust the icon size to the size of the text ...
|
||||
var iconGroup = this.getOrBuildIconGroup();
|
||||
var fontHeight = this.getTextShape().getFontHeight();
|
||||
iconGroup.setPosition(topicPadding, topicPadding);
|
||||
iconGroup.seIconSize(fontHeight, fontHeight);
|
||||
|
||||
|
||||
// Add a extra padding between the text and the icons
|
||||
var iconsWidth = iconGroup.getSize().width;
|
||||
if (iconsWidth != 0) {
|
||||
// Add a extra padding between the text and the icons
|
||||
|
||||
iconsWidth = iconsWidth + (textHeight / 4);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user