diff options
author | Rohan Kumar <rohankanojia420@gmail.com> | 2017-02-05 01:33:43 +0530 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-03-06 15:00:54 +0000 |
commit | a3f768eb74bd439b656bd6df639b50133b09a5f2 (patch) | |
tree | e528af6e3239cec8dc244b5e5b700ac7976bf40a /filter/source/svg/presentation_engine.js | |
parent | 74b54e33135bb99513142e671369e4f3f6370d55 (diff) |
Fix flip issue in Snake animation subtype
Fix flipOnYAxis function, alongwith minor tweaks.
Change-Id: If8958de9eb651a15f86963f2e40eb364011ce41f
Reviewed-on: https://gerrit.libreoffice.org/33918
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'filter/source/svg/presentation_engine.js')
-rw-r--r-- | filter/source/svg/presentation_engine.js | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js index 801da824dbeb..872232763489 100644 --- a/filter/source/svg/presentation_engine.js +++ b/filter/source/svg/presentation_engine.js @@ -4574,7 +4574,7 @@ SVGPathElement.prototype.appendPath = function( aPath ) function flipOnYAxis( aPath ) { - var aMatrix = SVGIdentityMatrix.scaleNonUniform(-1, 1).translate(1, 0); + var aMatrix = SVGIdentityMatrix.flipY().scaleNonUniform(-1, 1); aPath.matrixTransform(aMatrix); return aPath; } @@ -9859,24 +9859,18 @@ function SnakeWipePath(nElements, bDiagonal, bflipOnYAxis) SnakeWipePath.prototype.calcSnake = function(t) { var aPolyPath = createEmptyPath(); - var res = this.aBasePath.cloneNode(true); - var area = (t * this.sqrtElements * this.sqrtElements); - var line_ = Math.floor(area / this.sqrtElements); - var line = pruneScaleValue(line_ / this.sqrtElements); - var col = pruneScaleValue((area - (line_ * this.sqrtElements)) / this.sqrtElements); - var aTransform; + const area = (t * this.sqrtElements * this.sqrtElements); + const line_ = Math.floor(area) / this.sqrtElements; + const line = pruneScaleValue(line_ / this.sqrtElements); + const col = pruneScaleValue((area - (line_ * this.sqrtElements)) / this.sqrtElements); if(line != 0) { - var aPoint = document.documentElement.createSVGPoint(); - var aPath = 'M '+ aPoint.x + ' ' + aPoint.y + ' '; - aPoint.y = line; - aPath += 'L ' + aPoint.x + ' ' + aPoint.y + ' '; - aPoint.x = 1.0; - aPath += 'L ' + aPoint.x + ' ' + aPoint.y + ' '; - aPoint.y = 0.0; - aPath += 'L ' + aPoint.x + ' ' + aPoint.y + ' '; + let aPath = 'M '+ 0.0 + ' ' + 0.0 + ' '; + aPath += 'L ' + 0.0 + ' ' + line + ' '; + aPath += 'L ' + 1.0 + ' ' + line + ' '; + aPath += 'L ' + 1.0 + ' ' + 0.0 + ' '; aPath += 'L 0 0 '; - var poly = document.createElementNS( NSS['svg'], 'path'); + let poly = document.createElementNS( NSS['svg'], 'path'); poly.setAttribute('d', aPath); aPolyPath.appendPath(poly); } @@ -9886,19 +9880,12 @@ SnakeWipePath.prototype.calcSnake = function(t) // odd line: => right to left offset = (1.0 - col); } - var aPoint = document.documentElement.createSVGPoint(); - aPoint.x = offset; - aPoint.y = line; - var aPath = 'M ' + aPoint.x + ' ' + aPoint.y + ' '; - aPoint.y += this.elementEdge; - aPath += 'L '+ aPoint.x + ' ' + aPoint.y + ' '; - 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'); + let aPath = 'M ' + offset + ' ' + line + ' '; + aPath += 'L '+ offset + ' ' + (line + this.elementEdge) + ' '; + aPath += 'L ' + (offset+col) + ' ' + (line + this.elementEdge) + ' '; + aPath += 'L ' + (offset+col) + ' ' + line + ' '; + aPath += 'L ' + offset + ' ' + line + ' '; + let poly = document.createElementNS( NSS['svg'], 'path'); poly.setAttribute('d', aPath); aPolyPath.appendPath(poly); } |