diff options
author | Rohan Kumar <rohankanojia420@gmail.com> | 2017-02-05 01:33:43 +0530 |
---|---|---|
committer | Marco Cecchetti <marco.cecchetti@collabora.com> | 2017-04-07 17:03:24 +0200 |
commit | 7a0669e8b104a3b4ab22a582ff58742a5bae5892 (patch) | |
tree | 9325d92b18ff1a2966c07a053aca311535e8fad2 /filter | |
parent | ca5cca4fbee80f5056291e6e8d7517ea26c0fa8e (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')
-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 2bd2de006e9d..3d5731eed950 100644 --- a/filter/source/svg/presentation_engine.js +++ b/filter/source/svg/presentation_engine.js @@ -4560,7 +4560,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; } @@ -9860,24 +9860,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); } @@ -9887,19 +9881,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); } |