diff options
author | wout <wout@impinc.co.uk> | 2013-01-30 16:00:03 +0100 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2013-01-30 16:00:03 +0100 |
commit | 4a7588695a1b385f41acd6cbbfaf76b38b2a1439 (patch) | |
tree | 18cf5704748de3fde71281753809034886377dcf /dist/svg.js | |
parent | 610e40c62cfbd704db39c1516320de5cf61e36bd (diff) | |
download | svg.js-4a7588695a1b385f41acd6cbbfaf76b38b2a1439.tar.gz svg.js-4a7588695a1b385f41acd6cbbfaf76b38b2a1439.zip |
Added visible() and opacity() methods0.4
Diffstat (limited to 'dist/svg.js')
-rw-r--r-- | dist/svg.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/dist/svg.js b/dist/svg.js index 096638b..67da181 100644 --- a/dist/svg.js +++ b/dist/svg.js @@ -1,4 +1,4 @@ -/* svg.js v0.3-1-g293ef89 - svg container element fx event group arrange defs mask pattern gradient doc shape wrap rect ellipse poly path image text nested sugar - svgjs.com/license */ +/* svg.js v0.3-2-g610e40c - svg container element fx event group arrange defs mask pattern gradient doc shape wrap rect ellipse poly path image text nested sugar - svgjs.com/license */ (function() { this.svg = function(element) { @@ -176,6 +176,9 @@ 'fill-opacity': 1, 'stroke-opacity': 1, 'stroke-width': 0, + fill: '#000', + stroke: '#000', + opacity: 1, x: 0, y: 0, cx: 0, @@ -422,6 +425,10 @@ return this; }, + // Is element visible? + visible: function() { + return this.node.style.display != 'none'; + }, // Private: find svg parent by instance _parent: function(parent) { var element = this; @@ -691,6 +698,8 @@ 'mouseover', 'mouseout', 'mousemove', + 'mouseenter', + 'mouseleave', 'touchstart', 'touchend', 'touchmove', @@ -1406,6 +1415,15 @@ scaleX: x, scaleY: y == null ? x : y }); + }, + // Opacity + opacity: function(value) { + if (['rect', 'ellipse', 'polygon', 'path', 'polyline', 'line', 'text'].indexOf(this.type) > -1) + this.attr({ 'fill-opacity': value, 'stroke-opacity': value }); + else + this.attr('opacity', value); + + return this; } }); |