Simon Hunt

GUI -- SvgUtil- added scale, skewX and rotate functions.

Change-Id: If7c3af6bba81905b3bbb887edcf9bf5acbb927e1
......@@ -258,6 +258,18 @@
return 'translate(' + x + ',' + y + ')';
}
function scale(x, y) {
return 'scale(' + x + ',' + y + ')';
}
function skewX(x) {
return 'skewX(' + x + ')';
}
function rotate(deg) {
return 'rotate(' + deg + ')';
}
function stripPx(s) {
return s.replace(/px$/,'');
}
......@@ -279,6 +291,9 @@
loadGlowDefs: loadGlowDefs,
cat7: cat7,
translate: translate,
scale: scale,
skewX: skewX,
rotate: rotate,
stripPx: stripPx,
safeId: safeId,
visible: function (el, x) {
......
......@@ -41,7 +41,7 @@ describe('factory: fw/svg/svgUtil.js', function() {
it('should define api functions', function () {
expect(fs.areFunctions(sus, [
'createDragBehavior', 'loadGlowDefs', 'cat7',
'translate',
'translate', 'scale', 'skewX', 'rotate',
'stripPx', 'safeId', 'visible'
])).toBeTruthy();
});
......@@ -94,7 +94,7 @@ describe('factory: fw/svg/svgUtil.js', function() {
expect(sus.cat7().getColor('zoo', false, 'light')).toEqual('#8A2979');
});
// === translate()
// === translate(), scale(), skewX(), rotate()
it('should translate from two args', function () {
expect(sus.translate(1,2)).toEqual('translate(1,2)');
......@@ -104,6 +104,18 @@ describe('factory: fw/svg/svgUtil.js', function() {
expect(sus.translate([3,4])).toEqual('translate(3,4)');
});
it('should scale', function () {
expect(sus.scale(1.5,2.5)).toEqual('scale(1.5,2.5)');
});
it('should skewX', function () {
expect(sus.skewX(3.14)).toEqual('skewX(3.14)');
});
it('should rotate', function () {
expect(sus.rotate(45)).toEqual('rotate(45)');
});
// === stripPx()
......