Sigurd, > My question is if the currentTranslate should be performed after or before > the currentScale, that is: > > should the image be scaled, and then translated or should the image be > translated, and then scaled (the scaling would also affect the translation) The short answer is the latter. <svg onload="init(evt)"> <script type="text/ecmascript"> function init(evt) { if ( window.svgDocument == null ) svgDocument = evt.target.ownerDocument; var svgRoot = svgDocument.rootElement; svgRoot.currentScale = 2; svgRoot.currentTranslate.x = 10; svgRoot.currentTranslate.y = 10; } </script> <rect width="10" height="10" fill="blue"/> </svg> should look the same as: <svg> <rect width="10" height="10" fill="blue" transform="translate(10,10) scale(2)"/> </svg> the rect's new dimensions could be calculated in a manner similar to this pseudo-code: var scale = 2; var translate = new Point(10,10); rect.x = rect.x * scale + translate.x; rect.y = rect.y * scale + translate.y; rect.width *= scale; rect.height *= scale; Kevin KevLinDev - http://www.kevlindev.comReceived on Saturday, 30 November 2002 21:26:58 GMT
This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 4 September 2006 18:11:20 GMT