changing default shapes to be all lines, and fixing text centering bug

This commit is contained in:
Pablo Luna
2011-04-15 16:18:59 +01:00
parent 0f496bb4b3
commit d97121ce87
8 changed files with 39 additions and 58 deletions

View File

@@ -19,7 +19,7 @@
web2d.Line = function(attributes)
{
var peer = web2d.peer.Toolkit.createLine();
var defaultAttributes = {strokeColor:'#495879',strokeWidth:1};
var defaultAttributes = {strokeColor:'#495879',strokeWidth:1, strokeOpacity:1};
for (var key in attributes)
{
defaultAttributes[key] = attributes[key];

View File

@@ -62,8 +62,11 @@ web2d.peer.svg.TextPeer.prototype.getText = function()
web2d.peer.svg.TextPeer.prototype.setPosition = function(x, y)
{
this._position = {x:x, y:y};
var size = parseInt(this._font.getSize());
this._native.setAttribute('y', y + size);
var height = this._font.getSize();
if(this._parent && this._native.getBBox)
height = this.getHeight();
var size = parseInt(height);
this._native.setAttribute('y', y+size*3/4);
//y+size/2
this._native.setAttribute('x', x);
};