Allow to change number precision in sag transform values. Thanks Will McNeilly.

This commit is contained in:
kangax 2012-10-24 22:05:19 +02:00
parent fd621c9844
commit 17fe1a2929
4 changed files with 15 additions and 11 deletions

8
dist/all.js vendored
View file

@ -8073,10 +8073,12 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
*/
getSvgTransform: function() {
var angle = this.getAngle();
var NUM_FRACTION_DIGITS = fabric.Object.NUM_FRACTION_DIGITS;
return [
"translate(", toFixed(this.left, 2), " ", toFixed(this.top, 2), ")",
angle !== 0 ? (" rotate(" + toFixed(angle, 2) + ")") : '',
(this.scaleX === 1 && this.scaleY === 1) ? '' : (" scale(" + toFixed(this.scaleX, 2) + " " + toFixed(this.scaleY, 2) + ")")
"translate(", toFixed(this.left, NUM_FRACTION_DIGITS), " ", toFixed(this.top, NUM_FRACTION_DIGITS), ")",
angle !== 0 ? (" rotate(" + toFixed(angle, NUM_FRACTION_DIGITS) + ")") : '',
(this.scaleX === 1 && this.scaleY === 1) ? '' : (" scale(" + toFixed(this.scaleX, NUM_FRACTION_DIGITS) +
" " + toFixed(this.scaleY, NUM_FRACTION_DIGITS) + ")")
].join('');
},

10
dist/all.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/all.min.js.gz vendored

Binary file not shown.

View file

@ -363,10 +363,12 @@
*/
getSvgTransform: function() {
var angle = this.getAngle();
var NUM_FRACTION_DIGITS = fabric.Object.NUM_FRACTION_DIGITS;
return [
"translate(", toFixed(this.left, 2), " ", toFixed(this.top, 2), ")",
angle !== 0 ? (" rotate(" + toFixed(angle, 2) + ")") : '',
(this.scaleX === 1 && this.scaleY === 1) ? '' : (" scale(" + toFixed(this.scaleX, 2) + " " + toFixed(this.scaleY, 2) + ")")
"translate(", toFixed(this.left, NUM_FRACTION_DIGITS), " ", toFixed(this.top, NUM_FRACTION_DIGITS), ")",
angle !== 0 ? (" rotate(" + toFixed(angle, NUM_FRACTION_DIGITS) + ")") : '',
(this.scaleX === 1 && this.scaleY === 1) ? '' : (" scale(" + toFixed(this.scaleX, NUM_FRACTION_DIGITS) +
" " + toFixed(this.scaleY, NUM_FRACTION_DIGITS) + ")")
].join('');
},