Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Polyfill SVG path support for iOS
- */
- SVGCircleElement.prototype.getTotalLength = function() {
- // Get the parent node width
- // (trying to get the current node width returns 0)
- let width = this.parentNode.clientWidth;
- // Get the radius by dividing by 2
- let radius = width / 2;
- // Get the circumference from 2πr
- let length = 2 * Math.PI * radius;
- // Return the calculated value
- return length;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement