Hi Alex, "Alex Chew" <[EMAIL PROTECTED]> wrote on 11/24/2006 04:31:54 AM:
> For sake of simplification, I set svg attribute, > viewBox = "103.75 -30.5 0.5 0.2" > height = "600" > width = "800" > then, I changed viewBox to realize zoom and pan. This can be an expensive way to do zoom and pan. It would be better to adjust a transform on a 'g'. > I tried to convert screen points to world coordinate, but i could not make it be > accurate. It is problematic to try and reproduce the SVG renderer's calculations of coordinate system mapping. I would strongly suggest using the SVG method, "getScreenCTM", to get the mapping from the local coordinate system of an element in the document to screen pixels (such as returned by getClientX/Y). > It seems number formate in javascript make such error. code fragment, > pointx = parseFloat(evt.getClientX()); > pointy = parseFloat(evt.getClientY()); > px = pointx/this.currentScale/this.ratioX;//translate screen point to world one > py = pointy/this.currentScale/this.ratioY;//translate screen point to world one > worldx = this.viewBoxX; > worldy = this.viewBoxY; > markx = worldx+px; > marky = worldy+py; > What intrest me is when I look insight I found that markx is accurate while marky not. > Would you please show me a hand? > Any advice are appreciated. > Thanks again > Alex --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
