Resize icons on scale.

This commit is contained in:
Paulo Veiga
2011-09-02 20:05:51 -03:00
parent 001ff2e371
commit b1b0ee0de8
4 changed files with 41 additions and 6 deletions

View File

@@ -31,9 +31,8 @@ web2d.Text = new Class({
this._peer.setText(text);
},
setTextAlignment : function(align)
{
$assert(align,"align can not be null");
setTextAlignment : function(align) {
$assert(align, "align can not be null");
this._peer.setTextAlignment(align);
},
@@ -87,5 +86,10 @@ web2d.Text = new Class({
getHeight : function() {
return parseInt(this._peer.getHeight());
},
getFontHeight : function() {
var lines = this._peer.getText().split('\n').length;
return Math.round(this.getHeight() / lines);
}
});

View File

@@ -32,6 +32,10 @@ web2d.peer.svg.GroupPeer = new Class({
var change = this._coordSize.width != width || this._coordSize.height != height;
this._coordSize.width = width;
this._coordSize.height = height;
console.log("coordSize.width:" + width);
console.log("coordSize.height:" + height);
if (change)
this.updateTransform();
web2d.peer.utils.EventUtils.broadcastChangeEvent(this, "strokeStyle");
@@ -69,6 +73,21 @@ web2d.peer.svg.GroupPeer = new Class({
var cx = this._position.x - this._coordOrigin.x * sx;
var cy = this._position.y - this._coordOrigin.y * sy;
console.log("------------------");
console.log("this._coordSize.width:" + this._coordSize.width);
console.log("this._coordSize.height:" + this._coordSize.height);
console.log("cx:" + cx);
console.log("cy:" + cy);
console.log("this._size.width:" + this._size.width);
console.log("this._size.height:" + this._size.height);
console.log("sx:" + sx);
console.log("sy:" + sy);
console.log("------------------");
this._native.setAttribute("transform", "translate(" + cx + "," + cy + ") scale(" + sx + "," + sy + ")");
},