GUI -- SvgUtil- added scale, skewX and rotate functions.
Change-Id: If7c3af6bba81905b3bbb887edcf9bf5acbb927e1
diff --git a/web/gui/src/main/webapp/app/fw/svg/svgUtil.js b/web/gui/src/main/webapp/app/fw/svg/svgUtil.js
index f4b9248..53d957f 100644
--- a/web/gui/src/main/webapp/app/fw/svg/svgUtil.js
+++ b/web/gui/src/main/webapp/app/fw/svg/svgUtil.js
@@ -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) {
diff --git a/web/gui/src/main/webapp/tests/app/fw/svg/svgUtil-spec.js b/web/gui/src/main/webapp/tests/app/fw/svg/svgUtil-spec.js
index e2b4868..4164492 100644
--- a/web/gui/src/main/webapp/tests/app/fw/svg/svgUtil-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/svg/svgUtil-spec.js
@@ -41,7 +41,7 @@
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 @@
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 @@
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()