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)
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
| Reporter | ||
Comment 1•13 years ago
|
||
My guess is that getScreenCTM.inverse() doesn't consider the viewbox
Comment 2•13 years ago
|
||
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.
Comment 3•13 years ago
|
||
viewBox applies to children of svg elements, not the parent svg element itself.
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Updated•13 years ago
|
Component: General → SVG
Product: Firefox → Core
| Reporter | ||
Comment 4•13 years ago
|
||
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.
Comment 5•13 years ago
|
||
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.
Comment 6•13 years ago
|
||
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.
Description
•