fixing bugs

This commit is contained in:
Pablo Luna
2011-04-16 21:41:06 +01:00
parent 60ab4c7f5d
commit f73737ed0b
49 changed files with 214 additions and 186 deletions

View File

@@ -36,7 +36,7 @@ web2d.peer.svg.ElementPeer.prototype.setChildren = function(children)
web2d.peer.svg.ElementPeer.prototype.getChildren = function()
{
var result = this._children;
if (!result)
if (!core.Utils.isDefined(result))
{
result = [];
this._children = result;
@@ -270,7 +270,7 @@ web2d.peer.svg.ElementPeer.prototype.updateStrokeStyle = function()
web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type, listener)
{
var listeners = this.getChangeEventListeners(type);
if (!listener)
if (!core.Utils.isDefined(listener))
{
throw "Listener can not be null";
}
@@ -280,7 +280,7 @@ web2d.peer.svg.ElementPeer.prototype.attachChangeEventListener = function(type,
web2d.peer.svg.ElementPeer.prototype.getChangeEventListeners = function(type)
{
var listeners = this._changeListeners[type];
if (!listeners)
if (!core.Utils.isDefined(listeners))
{
listeners = [];
this._changeListeners[type] = listeners;

View File

@@ -53,7 +53,7 @@ web2d.peer.svg.RectPeer.prototype.setSize = function(width, height)
web2d.peer.svg.RectPeer.superClass.setSize.call(this, width, height);
var min = width < height?width:height;
if (this._arc)
if (core.Utils.isDefined(this._arc))
{
// Transform percentages to SVG format.
var arc = (min / 2) * this._arc;

View File

@@ -45,7 +45,7 @@ web2d.peer.svg.TextPeer.prototype.setText = function(text)
{
text = core.Utils.escapeInvalidTags(text);
var child = this._native.firstChild;
if (child)
if (core.Utils.isDefined(child))
{
this._native.removeChild(child);
}
@@ -63,7 +63,7 @@ web2d.peer.svg.TextPeer.prototype.setPosition = function(x, y)
{
this._position = {x:x, y:y};
var height = this._font.getSize();
if(this._parent && this._native.getBBox)
if(core.Utils.isDefined(this._parent) && core.Utils.isDefined(this._native.getBBox))
height = this.getHeight();
var size = parseInt(height);
this._native.setAttribute('y', y+size*3/4);

View File

@@ -21,7 +21,7 @@ web2d.peer.utils.EventUtils =
broadcastChangeEvent:function (elementPeer, type)
{
var listeners = elementPeer.getChangeEventListeners(type);
if (listeners)
if (core.Utils.isDefined(listeners))
{
for (var i = 0; i < listeners.length; i++)
{