Fix for WebKit bad CTM when zoom != 1 #766

Closed
wants to merge 1 commit into
from

Conversation

3 participants
@vogievetsky

Fixes these:
#668

https://groups.google.com/d/topic/d3-js/tqJ_V7cV7Eg/discussion

A good place to test to see the diff is the mouse example.
Also I ran make so it changed d3.v2.js and the min... not sure what the pull request equate is for those files.
All the 'real' changes are in core/mouse.js

I refactored your code a little bit so that there is a d3_mouse_getScreenCTM function that just returns the 'fixed' CTM.

I added some extra code to set the html and body position to 'static' before doing the bug test. This is so that the test is more robust - an insane person might have body or html not be at (0,0) and have position not static.

Example:

d3.select('body')
  .style('position', 'absolute')
  .style('left', 0)
  .style('top', '10px');

window.scrollTo(0, 10);

Add this to your code and it would trick the regular d3.mouse function to think that bug44083 exists when it might not.

@frogcherry

This comment has been minimized.

Show comment Hide comment
@frogcherry

frogcherry Aug 14, 2012

oh~ that's great! i'll try it

oh~ that's great! i'll try it

@vogievetsky

This comment has been minimized.

Show comment Hide comment
@vogievetsky

vogievetsky Aug 14, 2012

Also if you want to try out this but you can not be bothered to get my forked d3 then simply import https://github.com/vogievetsky/KoalasToTheMax/blob/master/d3.mouse.patch.js into your project it is the same code and it will override the regular d3.mouse function with the fixed one. Note that that file might disappear if this pull request goes into d3 (So don't hotlink).

Also if you want to try out this but you can not be bothered to get my forked d3 then simply import https://github.com/vogievetsky/KoalasToTheMax/blob/master/d3.mouse.patch.js into your project it is the same code and it will override the regular d3.mouse function with the fixed one. Note that that file might disappear if this pull request goes into d3 (So don't hotlink).

@mbostock

This comment has been minimized.

Show comment Hide comment
@mbostock

mbostock Apr 26, 2016

Owner

As far as I can tell, this has been fixed in current browsers. However, it is related to d3/d3-selection#67.

Owner

mbostock commented Apr 26, 2016

As far as I can tell, this has been fixed in current browsers. However, it is related to d3/d3-selection#67.

@mbostock mbostock closed this Apr 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment