From 411c8b446a700a9876f7ebf864086812954c6ae0 Mon Sep 17 00:00:00 2001 From: Andrea Bogazzi Date: Tue, 8 Dec 2015 12:20:45 +0100 Subject: [PATCH] Update shadow.class.js --- src/shadow.class.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/shadow.class.js b/src/shadow.class.js index 9195c247..78ecc1e7 100644 --- a/src/shadow.class.js +++ b/src/shadow.class.js @@ -3,8 +3,7 @@ 'use strict'; var fabric = global.fabric || (global.fabric = { }), - toFixed = fabric.util.toFixed, - NUM_FRACTION_DIGIT = fabric.Object.NUM_FRACTION_DIGITS; + toFixed = fabric.util.toFixed; if (fabric.Shadow) { fabric.warn('fabric.Shadow is already defined.'); @@ -112,24 +111,24 @@ * @return {String} SVG representation of a shadow */ toSVG: function(object) { - var fBoxX = 40, fBoxY = 40, + var fBoxX = 40, fBoxY = 40, NUM_FRACTION_DIGITS = fabric.Object.NUM_FRACTION_DIGITS, offset = fabric.util.rotateVector({x: this.offsetX, y: this.offsetY}, fabric.util.degreesToRadians(-object.angle)); if (object.width && object.height) { //http://www.w3.org/TR/SVG/filters.html#FilterEffectsRegion // we add some extra space to filter box to contain the blur ( 20 ) - fBoxX = toFixed((Math.abs(offset.x) + this.blur) / object.width, NUM_FRACTION_DIGIT) * 100 + 20; - fBoxY = toFixed((Math.abs(offset.y) + this.blur) / object.height, NUM_FRACTION_DIGIT) * 100 + 20; + fBoxX = toFixed((Math.abs(offset.x) + this.blur) / object.width, NUM_FRACTION_DIGITS) * 100 + 20; + fBoxY = toFixed((Math.abs(offset.y) + this.blur) / object.height, NUM_FRACTION_DIGITS) * 100 + 20; } return ( '\n' + '\t\n' + - '\t\n' + + toFixed(this.blur ? this.blur / 2 : 0, NUM_FRACTION_DIGITS) + '">\n' + + '\t\n' + '\t\n' + '\t\n' + '\t\n' +