mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-25 23:44:54 +01:00
updating icons position when changeing font size
This commit is contained in:
parent
df0a9a4496
commit
98c1c9428d
@ -18,23 +18,16 @@
|
|||||||
|
|
||||||
mindplot.IconGroup = function(topic) {
|
mindplot.IconGroup = function(topic) {
|
||||||
var offset = topic.getOffset();
|
var offset = topic.getOffset();
|
||||||
var text = topic.getTextShape();
|
|
||||||
var yOffset = text.getPosition().y;
|
|
||||||
var shape = topic.getShapeType();
|
|
||||||
if(shape==mindplot.NodeModel.SHAPE_TYPE_ELIPSE){
|
|
||||||
yOffset +=2;
|
|
||||||
} else if( shape == mindplot.NodeModel.SHAPE_TYPE_LINE){
|
|
||||||
yOffset -=2;
|
|
||||||
}
|
|
||||||
this.options = {
|
this.options = {
|
||||||
width:0,
|
width:0,
|
||||||
height:0,
|
height:0,
|
||||||
x:offset / 2,
|
x:offset.x / 2,
|
||||||
y:yOffset,
|
y:offset.y,
|
||||||
icons:[],
|
icons:[],
|
||||||
topic:topic,
|
topic:topic,
|
||||||
nativeElem:new web2d.Group({width: 2, height:2,x: offset / 2, y:yOffset, coordSizeWidth:1,coordSizeHeight:1})
|
nativeElem:new web2d.Group({width: 2, height:2,x: offset, y:offset, coordSizeWidth:1,coordSizeHeight:1})
|
||||||
};
|
};
|
||||||
|
this.updateIconGroupPosition();
|
||||||
this.registerListeners();
|
this.registerListeners();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -188,3 +181,18 @@ mindplot.IconGroup.prototype.registerListeners = function() {
|
|||||||
mindplot.IconGroup.prototype.getTopic = function() {
|
mindplot.IconGroup.prototype.getTopic = function() {
|
||||||
return this.options.topic;
|
return this.options.topic;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mindplot.IconGroup.prototype.updateIconGroupPosition = function() {
|
||||||
|
var offsets = this._calculateOffsets();
|
||||||
|
this.setPosition(offsets.x, offsets.y);
|
||||||
|
};
|
||||||
|
|
||||||
|
mindplot.IconGroup.prototype._calculateOffsets = function() {
|
||||||
|
var offset = this.options.topic.getOffset();
|
||||||
|
var text = this.options.topic.getTextShape();
|
||||||
|
var sizeHeight = text.getHtmlFontSize();
|
||||||
|
var yOffset = offset;
|
||||||
|
var shape = this.options.topic.getShapeType();
|
||||||
|
yOffset = text.getPosition().y + (sizeHeight - 18)/2;
|
||||||
|
return {x:offset, y:yOffset};
|
||||||
|
};
|
@ -1313,5 +1313,8 @@ mindplot.Topic.prototype.updateNode = function()
|
|||||||
// Positionate node ...
|
// Positionate node ...
|
||||||
textShape.setPosition(iconOffset+this._offset, pos);
|
textShape.setPosition(iconOffset+this._offset, pos);
|
||||||
textShape.setTextSize(sizeWidth, sizeHeight);
|
textShape.setTextSize(sizeWidth, sizeHeight);
|
||||||
|
var iconGroup = this.getIconGroup();
|
||||||
|
if(core.Utils.isDefined(iconGroup))
|
||||||
|
iconGroup.updateIconGroupPosition();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user