Commit 9458e3e7 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

сравнение градиентных заливок

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52143 954022d7-b5bf-4e40-9824-e11837661b57
parent b34ce289
...@@ -1975,6 +1975,7 @@ function CGs() ...@@ -1975,6 +1975,7 @@ function CGs()
CGs.prototype = CGs.prototype =
{ {
Get_Id: function() Get_Id: function()
{ {
return this.Id; return this.Id;
...@@ -2063,6 +2064,19 @@ CGs.prototype = ...@@ -2063,6 +2064,19 @@ CGs.prototype =
duplicate.pos = this.pos; duplicate.pos = this.pos;
duplicate.color = this.color.createDuplicate(); duplicate.color = this.color.createDuplicate();
return duplicate; return duplicate;
},
compare: function(gs)
{
var compare_unicolor = this.color.compare(gs.color);
if(!isRealObject(compare_unicolor))
{
return null;
}
var ret = new CGs();
ret.color = compare_unicolor;
ret.pos = gs.pos === this.pos ? this.pos : 0;
return ret;
} }
} }
...@@ -2499,6 +2513,35 @@ CGradFill.prototype = ...@@ -2499,6 +2513,35 @@ CGradFill.prototype =
return null; return null;
} }
var _ret = new CGradFill(); var _ret = new CGradFill();
if(this.lin == null || fill.lin == null)
_ret.lin = null;
else
{
_ret.lin = new GradLin();
_ret.lin.angle = this.lin && this.lin.angle === fill.lin.angle ? fill.lin.angle : 5400000;
_ret.lin.scale = this.lin && this.lin.scale === fill.lin.scale ? fill.lin.scale : true;
}
if(this.path == null || fill.path == null)
{
_ret.path = null;
}
else
{
_ret.path = new GradPath();
}
if(this.colors.length === fill.colors.length )
{
for(var i = 0; i < this.colors.length; ++i )
{
var compare_unicolor = this.colors[i].compare(fill.colors[i]);
if(!isRealObject(compare_unicolor))
{
break;
}
_ret.colors[i] = compare_unicolor;
}
}
return _ret; return _ret;
} }
}; };
......
...@@ -1533,8 +1533,8 @@ CGradFill.prototype = ...@@ -1533,8 +1533,8 @@ CGradFill.prototype =
else else
{ {
_ret.lin = new GradLin(); _ret.lin = new GradLin();
_ret.lin.angle = this.angle === fill.lin.angle ? fill.lin.angle : 5400000; _ret.lin.angle = this.lin && this.lin.angle === fill.lin.angle ? fill.lin.angle : 5400000;
_ret.lin.scale = this.scale === fill.lin.scale ? fill.lin.scale : true; _ret.lin.scale = this.lin && this.lin.scale === fill.lin.scale ? fill.lin.scale : true;
} }
if(this.path == null || fill.path == null) if(this.path == null || fill.path == null)
{ {
......
...@@ -1382,6 +1382,19 @@ CGs.prototype = ...@@ -1382,6 +1382,19 @@ CGs.prototype =
duplicate.pos = this.pos; duplicate.pos = this.pos;
duplicate.color = this.color.createDuplicate(); duplicate.color = this.color.createDuplicate();
return duplicate; return duplicate;
},
compare: function(gs)
{
var compare_unicolor = this.color.compare(gs.color);
if(!isRealObject(compare_unicolor))
{
return null;
}
var ret = new CGs();
ret.color = compare_unicolor;
ret.pos = gs.pos === this.pos ? this.pos : 0;
return ret;
} }
}; };
...@@ -1584,19 +1597,37 @@ CGradFill.prototype = ...@@ -1584,19 +1597,37 @@ CGradFill.prototype =
{ {
return null; return null;
} }
/* if(this.lin != fill.lin) var _ret = new CGradFill();
return _ret; if(this.lin == null || fill.lin == null)
_ret.lin = this.lin; _ret.lin = null;
if(this.path != fill.path) else
return _ret; {
_ret.path = this.path; _ret.lin = new GradLin();
if(this.colors.length != fill.colors.length) _ret.lin.angle = this.lin && this.lin.angle === fill.lin.angle ? fill.lin.angle : 5400000;
return _ret; */ _ret.lin.scale = this.lin && this.lin.scale === fill.lin.scale ? fill.lin.scale : true;
}
if(!this.IsIdentical(fill)) if(this.path == null || fill.path == null)
return _ret = new CGradFill() {
_ret.path = null;
}
else
{
_ret.path = new GradPath();
}
return this.createDuplicate(); if(this.colors.length === fill.colors.length )
{
for(var i = 0; i < this.colors.length; ++i )
{
var compare_unicolor = this.colors[i].compare(fill.colors[i]);
if(!isRealObject(compare_unicolor))
{
break;
}
_ret.colors[i] = compare_unicolor;
}
}
return _ret;
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment