Kaydet (Commit) a3f768eb authored tarafından Rohan Kumar's avatar Rohan Kumar Kaydeden (comit) Thorsten Behrens

Fix flip issue in Snake animation subtype

Fix flipOnYAxis function, alongwith minor tweaks.

Change-Id: If8958de9eb651a15f86963f2e40eb364011ce41f
Reviewed-on: https://gerrit.libreoffice.org/33918Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 74b54e33
...@@ -4574,7 +4574,7 @@ SVGPathElement.prototype.appendPath = function( aPath ) ...@@ -4574,7 +4574,7 @@ SVGPathElement.prototype.appendPath = function( aPath )
function flipOnYAxis( aPath ) function flipOnYAxis( aPath )
{ {
var aMatrix = SVGIdentityMatrix.scaleNonUniform(-1, 1).translate(1, 0); var aMatrix = SVGIdentityMatrix.flipY().scaleNonUniform(-1, 1);
aPath.matrixTransform(aMatrix); aPath.matrixTransform(aMatrix);
return aPath; return aPath;
} }
...@@ -9859,24 +9859,18 @@ function SnakeWipePath(nElements, bDiagonal, bflipOnYAxis) ...@@ -9859,24 +9859,18 @@ function SnakeWipePath(nElements, bDiagonal, bflipOnYAxis)
SnakeWipePath.prototype.calcSnake = function(t) SnakeWipePath.prototype.calcSnake = function(t)
{ {
var aPolyPath = createEmptyPath(); var aPolyPath = createEmptyPath();
var res = this.aBasePath.cloneNode(true); const area = (t * this.sqrtElements * this.sqrtElements);
var area = (t * this.sqrtElements * this.sqrtElements); const line_ = Math.floor(area) / this.sqrtElements;
var line_ = Math.floor(area / this.sqrtElements); const line = pruneScaleValue(line_ / this.sqrtElements);
var line = pruneScaleValue(line_ / this.sqrtElements); const col = pruneScaleValue((area - (line_ * this.sqrtElements)) / this.sqrtElements);
var col = pruneScaleValue((area - (line_ * this.sqrtElements)) / this.sqrtElements);
var aTransform;
if(line != 0) { if(line != 0) {
var aPoint = document.documentElement.createSVGPoint(); let aPath = 'M '+ 0.0 + ' ' + 0.0 + ' ';
var aPath = 'M '+ aPoint.x + ' ' + aPoint.y + ' '; aPath += 'L ' + 0.0 + ' ' + line + ' ';
aPoint.y = line; aPath += 'L ' + 1.0 + ' ' + line + ' ';
aPath += 'L ' + aPoint.x + ' ' + aPoint.y + ' '; aPath += 'L ' + 1.0 + ' ' + 0.0 + ' ';
aPoint.x = 1.0;
aPath += 'L ' + aPoint.x + ' ' + aPoint.y + ' ';
aPoint.y = 0.0;
aPath += 'L ' + aPoint.x + ' ' + aPoint.y + ' ';
aPath += 'L 0 0 '; aPath += 'L 0 0 ';
var poly = document.createElementNS( NSS['svg'], 'path'); let poly = document.createElementNS( NSS['svg'], 'path');
poly.setAttribute('d', aPath); poly.setAttribute('d', aPath);
aPolyPath.appendPath(poly); aPolyPath.appendPath(poly);
} }
...@@ -9886,19 +9880,12 @@ SnakeWipePath.prototype.calcSnake = function(t) ...@@ -9886,19 +9880,12 @@ SnakeWipePath.prototype.calcSnake = function(t)
// odd line: => right to left // odd line: => right to left
offset = (1.0 - col); offset = (1.0 - col);
} }
var aPoint = document.documentElement.createSVGPoint(); let aPath = 'M ' + offset + ' ' + line + ' ';
aPoint.x = offset; aPath += 'L '+ offset + ' ' + (line + this.elementEdge) + ' ';
aPoint.y = line; aPath += 'L ' + (offset+col) + ' ' + (line + this.elementEdge) + ' ';
var aPath = 'M ' + aPoint.x + ' ' + aPoint.y + ' '; aPath += 'L ' + (offset+col) + ' ' + line + ' ';
aPoint.y += this.elementEdge; aPath += 'L ' + offset + ' ' + line + ' ';
aPath += 'L '+ aPoint.x + ' ' + aPoint.y + ' '; let poly = document.createElementNS( NSS['svg'], 'path');
aPoint.x = offset + col;
aPath += 'L ' + aPoint.x + ' ' + aPoint.y + ' ';
aPoint.y = line;
aPath += 'L ' + aPoint.x + ' ' + aPoint.y + ' ';
aPoint.x = offset;
aPath += 'L ' + aPoint.x + ' ' + aPoint.y + ' ';
var poly = document.createElementNS( NSS['svg'], 'path');
poly.setAttribute('d', aPath); poly.setAttribute('d', aPath);
aPolyPath.appendPath(poly); aPolyPath.appendPath(poly);
} }
......
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