Replace core.Utils.isDefined for $defined.
This commit is contained in:
@@ -51,7 +51,7 @@ web2d.peer.svg.ArrowPeer.prototype.setStrokeWidth = function(width)
|
||||
};
|
||||
|
||||
web2d.peer.svg.ArrowPeer.prototype.setDashed = function(isDashed, length, spacing){
|
||||
if(core.Utils.isDefined(isDashed) && isDashed && core.Utils.isDefined(length) && core.Utils.isDefined(spacing)){
|
||||
if($defined(isDashed) && isDashed && $defined(length) && $defined(spacing)){
|
||||
this._native.setAttribute("stroke-dasharray",length+","+spacing);
|
||||
} else {
|
||||
this._native.setAttribute("stroke-dasharray","");
|
||||
|
@@ -34,7 +34,7 @@ objects.extend(web2d.peer.svg.CurvedLinePeer, web2d.peer.svg.ElementPeer);
|
||||
web2d.peer.svg.CurvedLinePeer.prototype.setSrcControlPoint = function(control){
|
||||
this._customControlPoint_1 = true;
|
||||
var change = this._control1.x!=control.x || this._control1.y!=control.y;
|
||||
if(core.Utils.isDefined(control.x)){
|
||||
if($defined(control.x)){
|
||||
this._control1 = control;
|
||||
this._control1.x = parseInt(this._control1.x);
|
||||
this._control1.y = parseInt(this._control1.y)
|
||||
@@ -46,7 +46,7 @@ web2d.peer.svg.CurvedLinePeer.prototype.setSrcControlPoint = function(control){
|
||||
web2d.peer.svg.CurvedLinePeer.prototype.setDestControlPoint = function(control){
|
||||
this._customControlPoint_2 = true;
|
||||
var change = this._control2.x!=control.x || this._control2.y!=control.y;
|
||||
if(core.Utils.isDefined(control.x)){
|
||||
if($defined(control.x)){
|
||||
this._control2 = control;
|
||||
this._control2.x = parseInt(this._control2.x);
|
||||
this._control2.y = parseInt(this._control2.y)
|
||||
@@ -160,7 +160,7 @@ web2d.peer.svg.CurvedLinePeer.prototype.isShowStartArrow = function(){
|
||||
|
||||
web2d.peer.svg.CurvedLinePeer.prototype._updatePath = function(avoidControlPointFix)
|
||||
{
|
||||
if(core.Utils.isDefined(this._x1) && core.Utils.isDefined(this._y1) && core.Utils.isDefined(this._x2) && core.Utils.isDefined(this._y2))
|
||||
if($defined(this._x1) && $defined(this._y1) && $defined(this._x2) && $defined(this._y2))
|
||||
{
|
||||
this._calculateAutoControlPoints(avoidControlPointFix);
|
||||
var path = "M"+this._x1+","+this._y1
|
||||
@@ -189,18 +189,18 @@ web2d.peer.svg.CurvedLinePeer.prototype._updateStyle = function()
|
||||
web2d.peer.svg.CurvedLinePeer.prototype._calculateAutoControlPoints = function(avoidControlPointFix){
|
||||
//Both points available, calculate real points
|
||||
var defaultpoints = core.Utils.calculateDefaultControlPoints(new core.Point(this._x1, this._y1),new core.Point(this._x2,this._y2));
|
||||
if(!this._customControlPoint_1 && !(core.Utils.isDefined(avoidControlPointFix) && avoidControlPointFix==0)){
|
||||
if(!this._customControlPoint_1 && !($defined(avoidControlPointFix) && avoidControlPointFix==0)){
|
||||
this._control1.x = defaultpoints[0].x;
|
||||
this._control1.y = defaultpoints[0].y;
|
||||
}
|
||||
if(!this._customControlPoint_2 && !(core.Utils.isDefined(avoidControlPointFix) && avoidControlPointFix==1)){
|
||||
if(!this._customControlPoint_2 && !($defined(avoidControlPointFix) && avoidControlPointFix==1)){
|
||||
this._control2.x = defaultpoints[1].x;
|
||||
this._control2.y = defaultpoints[1].y;
|
||||
}
|
||||
};
|
||||
|
||||
web2d.peer.svg.CurvedLinePeer.prototype.setDashed = function(length,spacing){
|
||||
if(core.Utils.isDefined(length) && core.Utils.isDefined(spacing)){
|
||||
if($defined(length) && $defined(spacing)){
|
||||
this._native.setAttribute("stroke-dasharray",length+","+spacing);
|
||||
} else {
|
||||
this._native.setAttribute("stroke-dasharray","");
|
||||
|
@@ -36,7 +36,7 @@ web2d.peer.svg.ElementPeer.prototype.setChildren = function(children)
|
||||
web2d.peer.svg.ElementPeer.prototype.getChildren = function()
|
||||
{
|
||||
var result = this._children;
|
||||
if (!core.Utils.isDefined(result))
|
||||
if (!$defined(result))
|
||||
{
|
||||
result = [];
|
||||
this._children = result;
|
||||
@@ -152,13 +152,13 @@ web2d.peer.svg.ElementPeer.prototype.removeEventListener = function(type, listen
|
||||
|
||||
web2d.peer.svg.ElementPeer.prototype.setSize = function(width, height)
|
||||
{
|
||||
if (core.Utils.isDefined(width) && this._size.width != parseInt(width))
|
||||
if ($defined(width) && this._size.width != parseInt(width))
|
||||
{
|
||||
this._size.width = parseInt(width);
|
||||
this._native.setAttribute('width', parseInt(width));
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(height) && this._size.height != parseInt(height))
|
||||
if ($defined(height) && this._size.height != parseInt(height))
|
||||
{
|
||||
this._size.height = parseInt(height);
|
||||
this._native.setAttribute('height', parseInt(height));
|
||||
@@ -174,11 +174,11 @@ web2d.peer.svg.ElementPeer.prototype.getSize = function()
|
||||
|
||||
web2d.peer.svg.ElementPeer.prototype.setFill = function(color, opacity)
|
||||
{
|
||||
if (core.Utils.isDefined(color))
|
||||
if ($defined(color))
|
||||
{
|
||||
this._native.setAttribute('fill', color);
|
||||
}
|
||||
if (core.Utils.isDefined(opacity))
|
||||
if ($defined(opacity))
|
||||
{
|
||||
this._native.setAttribute('fill-opacity', opacity);
|
||||
}
|
||||
@@ -204,15 +204,15 @@ web2d.peer.svg.ElementPeer.prototype.getStroke = function()
|
||||
web2d.peer.svg.ElementPeer.prototype.__stokeStyleToStrokDasharray = {solid:[],dot:[1,3],dash:[4,3],longdash:[10,2],dashdot:[5,3,1,3]};
|
||||
web2d.peer.svg.ElementPeer.prototype.setStroke = function(width, style, color, opacity)
|
||||
{
|
||||
if (core.Utils.isDefined(width))
|
||||
if ($defined(width))
|
||||
{
|
||||
this._native.setAttribute('stroke-width', width + "px");
|
||||
}
|
||||
if (core.Utils.isDefined(color))
|
||||
if ($defined(color))
|
||||
{
|
||||
this._native.setAttribute('stroke', color);
|
||||
}
|
||||
if (core.Utils.isDefined(style))
|
||||
if ($defined(style))
|
||||
{
|
||||
// Scale the dash array in order to be equal to VML. In VML, stroke style doesn't scale.
|
||||
var dashArrayPoints = this.__stokeStyleToStrokDasharray[style];
|
||||
@@ -235,7 +235,7 @@ web2d.peer.svg.ElementPeer.prototype.setStroke = function(width, style, color, o
|
||||
this._stokeStyle = style;
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(opacity))
|
||||
if ($defined(opacity))
|
||||
{
|
||||
this._native.setAttribute('stroke-opacity', opacity);
|
||||
}
|
||||
@@ -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 (!core.Utils.isDefined(listener))
|
||||
if (!$defined(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 (!core.Utils.isDefined(listeners))
|
||||
if (!$defined(listeners))
|
||||
{
|
||||
listeners = [];
|
||||
this._changeListeners[type] = listeners;
|
||||
|
@@ -29,12 +29,12 @@ objects.extend(web2d.peer.svg.ElipsePeer, web2d.peer.svg.ElementPeer);
|
||||
web2d.peer.svg.ElipsePeer.prototype.setSize = function(width, height)
|
||||
{
|
||||
web2d.peer.svg.ElipsePeer.superClass.setSize.call(this, width, height);
|
||||
if (core.Utils.isDefined(width))
|
||||
if ($defined(width))
|
||||
{
|
||||
this._native.setAttribute('rx', width / 2);
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(height))
|
||||
if ($defined(height))
|
||||
{
|
||||
this._native.setAttribute('ry', height / 2);
|
||||
}
|
||||
@@ -48,12 +48,12 @@ web2d.peer.svg.ElipsePeer.prototype.setPosition = function(cx, cy)
|
||||
var size =this.getSize();
|
||||
cx =cx + size.width/2;
|
||||
cy =cy + size.height/2;
|
||||
if (core.Utils.isDefined(cx))
|
||||
if ($defined(cx))
|
||||
{
|
||||
this._native.setAttribute('cx', cx);
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(cy))
|
||||
if ($defined(cy))
|
||||
{
|
||||
this._native.setAttribute('cy', cy);
|
||||
}
|
||||
|
@@ -25,15 +25,15 @@ web2d.peer.svg.Font = function()
|
||||
|
||||
web2d.peer.svg.Font.prototype.init = function(args)
|
||||
{
|
||||
if (core.Utils.isDefined(args.size))
|
||||
if ($defined(args.size))
|
||||
{
|
||||
this._size = parseInt(args.size);
|
||||
}
|
||||
if (core.Utils.isDefined(args.style))
|
||||
if ($defined(args.style))
|
||||
{
|
||||
this._style = args.style;
|
||||
}
|
||||
if (core.Utils.isDefined(args.weight))
|
||||
if ($defined(args.weight))
|
||||
{
|
||||
this._weight = args.weight;
|
||||
}
|
||||
|
@@ -84,12 +84,12 @@ web2d.peer.svg.GroupPeer.prototype.updateTransform = function()
|
||||
web2d.peer.svg.GroupPeer.prototype.setCoordOrigin = function(x, y)
|
||||
{
|
||||
var change = x!=this._coordOrigin.x || y!=this._coordOrigin.y;
|
||||
if (core.Utils.isDefined(x))
|
||||
if ($defined(x))
|
||||
{
|
||||
this._coordOrigin.x = x;
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(y))
|
||||
if ($defined(y))
|
||||
{
|
||||
this._coordOrigin.y = y;
|
||||
}
|
||||
@@ -108,12 +108,12 @@ web2d.peer.svg.GroupPeer.prototype.setSize = function(width, height)
|
||||
web2d.peer.svg.GroupPeer.prototype.setPosition = function(x, y)
|
||||
{
|
||||
var change = x!=this._position.x || y!=this._position.y;
|
||||
if (core.Utils.isDefined(x))
|
||||
if ($defined(x))
|
||||
{
|
||||
this._position.x = parseInt(x);
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(y))
|
||||
if ($defined(y))
|
||||
{
|
||||
this._position.y = parseInt(y);
|
||||
}
|
||||
|
@@ -55,12 +55,12 @@ web2d.peer.svg.LinePeer.prototype.getTo = function(){
|
||||
*/
|
||||
web2d.peer.svg.LinePeer.prototype.setArrowStyle = function(startStyle, endStyle)
|
||||
{
|
||||
if (core.Utils.isDefined(startStyle))
|
||||
if ($defined(startStyle))
|
||||
{
|
||||
// Todo: This must be implemented ...
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(endStyle))
|
||||
if ($defined(endStyle))
|
||||
{
|
||||
// Todo: This must be implemented ...
|
||||
}
|
||||
|
@@ -79,7 +79,7 @@ web2d.peer.svg.PolyLinePeer.prototype._updatePath = function()
|
||||
|
||||
web2d.peer.svg.PolyLinePeer.prototype._updateStraightPath = function()
|
||||
{
|
||||
if (core.Utils.isDefined(this._x1) && core.Utils.isDefined(this._x2) && core.Utils.isDefined(this._y1) && core.Utils.isDefined(this._y2))
|
||||
if ($defined(this._x1) && $defined(this._x2) && $defined(this._y1) && $defined(this._y2))
|
||||
{
|
||||
var path = web2d.PolyLine.buildStraightPath(this.breakDistance, this._x1, this._y1, this._x2, this._y2);
|
||||
this._native.setAttribute('points', path);
|
||||
@@ -92,7 +92,7 @@ web2d.peer.svg.PolyLinePeer.prototype._updateMiddleCurvePath = function()
|
||||
var y1 = this._y1;
|
||||
var x2 = this._x2;
|
||||
var y2 = this._y2;
|
||||
if (core.Utils.isDefined(x1) && core.Utils.isDefined(x2) && core.Utils.isDefined(y1) && core.Utils.isDefined(y2))
|
||||
if ($defined(x1) && $defined(x2) && $defined(y1) && $defined(y2))
|
||||
{
|
||||
var diff = x2 - x1;
|
||||
var middlex = (diff / 2) + x1;
|
||||
@@ -113,7 +113,7 @@ web2d.peer.svg.PolyLinePeer.prototype._updateMiddleCurvePath = function()
|
||||
|
||||
web2d.peer.svg.PolyLinePeer.prototype._updateCurvePath = function()
|
||||
{
|
||||
if (core.Utils.isDefined(this._x1) && core.Utils.isDefined(this._x2) && core.Utils.isDefined(this._y1) && core.Utils.isDefined(this._y2))
|
||||
if ($defined(this._x1) && $defined(this._x2) && $defined(this._y1) && $defined(this._y2))
|
||||
{
|
||||
var path = web2d.PolyLine.buildCurvedPath(this.breakDistance, this._x1, this._y1, this._x2, this._y2);
|
||||
this._native.setAttribute('points', path);
|
||||
|
@@ -31,11 +31,11 @@ objects.extend(web2d.peer.svg.RectPeer, web2d.peer.svg.ElementPeer);
|
||||
|
||||
web2d.peer.svg.RectPeer.prototype.setPosition = function(x, y)
|
||||
{
|
||||
if (core.Utils.isDefined(x))
|
||||
if ($defined(x))
|
||||
{
|
||||
this._native.setAttribute('x', parseInt(x));
|
||||
}
|
||||
if (core.Utils.isDefined(y))
|
||||
if ($defined(y))
|
||||
{
|
||||
this._native.setAttribute('y', parseInt(y));
|
||||
}
|
||||
@@ -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 (core.Utils.isDefined(this._arc))
|
||||
if ($defined(this._arc))
|
||||
{
|
||||
// Transform percentages to SVG format.
|
||||
var arc = (min / 2) * this._arc;
|
||||
|
@@ -45,7 +45,7 @@ web2d.peer.svg.TextPeer.prototype.setText = function(text)
|
||||
{
|
||||
text = core.Utils.escapeInvalidTags(text);
|
||||
var child = this._native.firstChild;
|
||||
if (core.Utils.isDefined(child))
|
||||
if ($defined(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(core.Utils.isDefined(this._parent) && core.Utils.isDefined(this._native.getBBox))
|
||||
if($defined(this._parent) && $defined(this._native.getBBox))
|
||||
height = this.getHeight();
|
||||
var size = parseInt(height);
|
||||
this._native.setAttribute('y', y+size*3/4);
|
||||
@@ -78,19 +78,19 @@ web2d.peer.svg.TextPeer.prototype.getPosition = function()
|
||||
|
||||
web2d.peer.svg.TextPeer.prototype.setFont = function(font, size, style, weight)
|
||||
{
|
||||
if (core.Utils.isDefined(font))
|
||||
if ($defined(font))
|
||||
{
|
||||
this._font = new web2d.Font(font, this);
|
||||
}
|
||||
if (core.Utils.isDefined(style))
|
||||
if ($defined(style))
|
||||
{
|
||||
this._font.setStyle(style);
|
||||
}
|
||||
if (core.Utils.isDefined(weight))
|
||||
if ($defined(weight))
|
||||
{
|
||||
this._font.setWeight(weight);
|
||||
}
|
||||
if (core.Utils.isDefined(size))
|
||||
if ($defined(size))
|
||||
{
|
||||
this._font.setSize(size);
|
||||
}
|
||||
|
@@ -46,12 +46,12 @@ web2d.peer.svg.WorkspacePeer.prototype.setCoordSize = function(width, height)
|
||||
{
|
||||
coords = viewBox.split(/ /);
|
||||
}
|
||||
if (core.Utils.isDefined(width))
|
||||
if ($defined(width))
|
||||
{
|
||||
coords[2] = width;
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(height))
|
||||
if ($defined(height))
|
||||
{
|
||||
coords[3] = height;
|
||||
}
|
||||
@@ -83,12 +83,12 @@ web2d.peer.svg.WorkspacePeer.prototype.setCoordOrigin = function(x, y)
|
||||
coords = viewBox.split(/ /);
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(x))
|
||||
if ($defined(x))
|
||||
{
|
||||
coords[0] = x;
|
||||
}
|
||||
|
||||
if (core.Utils.isDefined(y))
|
||||
if ($defined(y))
|
||||
{
|
||||
coords[1] = y;
|
||||
}
|
||||
|
Reference in New Issue
Block a user