Closed Bug 803012 Opened 13 years ago Closed 13 years ago

Transforming page coordinates into svg coordinates in viewbox doesn't report correct coordinates

Categories

(Core :: SVG, defect)

16 Branch
x86_64
Windows 7
defect
Not set
critical

Tracking

()

RESOLVED INVALID

People

(Reporter: stoffeastrom, Unassigned)

Details

Sample is found here: http://jsfiddle.net/stoffeastrom/EtpXK/ Click on the yellow rectangle. Notice the x, y in console. Press right arrow to pan the viewbox. Click the red rectangle. Notice that the x, y reported are the same as before which is wrong
My guess is that getScreenCTM.inverse() doesn't consider the viewbox
I can reproduce it in Nighty 19.0a1 (2012-10-17). Actually the title of the bugg is wrong, the example is about transforming FROM SVG coordinates TO page coordinates.
viewBox applies to children of svg elements, not the parent svg element itself.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Component: General → SVG
Product: Firefox → Core
So if yo don't have any children yet and want to add a child where the user clicks you can't do that? You first need to add the child and then get the correct x, y and then update the child's position? Seems a bit odd to me. I agree that the viewBox applies to children but you still need to be able to use the svg element to get the correct coordinate since the svg establishes a new viewport.
Yes. If you wanted move the <svg> element itself that would be rather harder to do if we applied the viewBox transform to it when you queried where it was.
If you want to add an element where the user clicks, you can add it, get the TM from it, then use the TM to set its position. You were going to add it anyway. :)
You need to log in before you can comment on or make changes to this bug.