| | |
| | | |
| | | |
| | | // ************************************************************************************** |
| | | // SVGTransformList implementation for Webkit |
| | | // SVGTransformList implementation for Webkit |
| | | // These methods do not currently raise any exceptions. |
| | | // These methods also do not check that transforms are being inserted. This is basically |
| | | // implementing as much of SVGTransformList that we need to get the job done. |
| | | // |
| | | // interface SVGEditTransformList { |
| | | // interface SVGEditTransformList { |
| | | // attribute unsigned long numberOfItems; |
| | | // void clear ( ) |
| | | // SVGTransform initialize ( in SVGTransform newItem ) |
| | |
| | | // Transform attribute parser |
| | | var str = this._elem.getAttribute("transform"); |
| | | if(!str) return; |
| | | |
| | | |
| | | // TODO: Add skew support in future |
| | | var re = /\s*((scale|matrix|rotate|translate)\s*\(.*?\))\s*,?\s*/; |
| | | var arr = []; |
| | |
| | | var xform = svgroot.createSVGTransform(); |
| | | var fname = 'set' + name.charAt(0).toUpperCase() + name.slice(1); |
| | | var values = name=='matrix'?[mtx]:val_arr; |
| | | |
| | | |
| | | if (name == 'scale' && values.length == 1) { |
| | | values.push(values[0]); |
| | | } else if (name == 'translate' && values.length == 1) { |
| | |
| | | } |
| | | } |
| | | }; |
| | | |
| | | |
| | | this.numberOfItems = 0; |
| | | this.clear = function() { |
| | | this.clear = function() { |
| | | this.numberOfItems = 0; |
| | | this._xforms = []; |
| | | }; |
| | | |
| | | |
| | | this.initialize = function(newItem) { |
| | | this.numberOfItems = 1; |
| | | this._removeFromOtherLists(newItem); |
| | | this._xforms = [newItem]; |
| | | }; |
| | | |
| | | |
| | | this.getItem = function(index) { |
| | | if (index < this.numberOfItems && index >= 0) { |
| | | return this._xforms[index]; |
| | | } |
| | | throw {code: 1}; // DOMException with code=INDEX_SIZE_ERR |
| | | }; |
| | | |
| | | |
| | | this.insertItemBefore = function(newItem, index) { |
| | | var retValue = null; |
| | | if (index >= 0) { |
| | |
| | | } |
| | | return retValue; |
| | | }; |
| | | |
| | | |
| | | this.replaceItem = function(newItem, index) { |
| | | var retValue = null; |
| | | if (index < this.numberOfItems && index >= 0) { |
| | |
| | | } |
| | | return retValue; |
| | | }; |
| | | |
| | | |
| | | this.removeItem = function(index) { |
| | | if (index < this.numberOfItems && index >= 0) { |
| | | var retValue = this._xforms[index]; |
| | |
| | | throw {code: 1}; // DOMException with code=INDEX_SIZE_ERR |
| | | } |
| | | }; |
| | | |
| | | |
| | | this.appendItem = function(newItem) { |
| | | this._removeFromOtherLists(newItem); |
| | | this._xforms.push(newItem); |
| | |
| | | }; |
| | | |
| | | |
| | | })(); |
| | | })(); |