kennygit / jcrop

Automatically exported from code.google.com/p/jcrop
0 stars 0 forks source link

position:fixed jcrop #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. use jcrop in a div with position:fixed on a page long enough to scroll
2. scroll down
3. try to select

What is the expected output? What do you see instead?
the selection is at the wrong place.

Please provide any additional information below.

changing the function mouseAbs (line 686 in jquery.Jcrop.js) to the code 
below will fix the problem for ff3, ie7, chrome, opera (,..), if the option 
positionFixed is set to true. if Jcrop isn't in an position:fixed element, 
positionFixed has to be false (i added false to the option default values).

function mouseAbs(e)
    {
        if(options.positionFixed) {
            var top = document.documentElement.scrollTop || 
document.body.scrollTop;
            var left = document.documentElement.scrollLeft || 
document.body.scrollLeft;
            }
        else {
            var top = 0;
            var left = 0;
            }
        return [ (e.pageX - docOffset[0] - left), (e.pageY - 
docOffset[1] - top) ];
    };

Original issue reported on code.google.com by mixer2 on 13 Sep 2008 at 11:40

GoogleCodeExporter commented 8 years ago
you can test the parents for the css attribute position:fixed, instead of the 
option, 
for an automatic detection. don't know what's the best way.

Original comment by mixer2 on 14 Sep 2008 at 8:54

GoogleCodeExporter commented 8 years ago
maybe the jquery offset() method should be used to get the correct position
http://docs.jquery.com/CSS/offset
anything like (e.pageX-$(this).offset().left)+' '+(e.pageY-$(this).offset().top)

Original comment by mixer2 on 15 Sep 2008 at 9:39

GoogleCodeExporter commented 8 years ago
Another unexpected positioning error. I will evaluate the proper fix and 
incorporate
it into the version following 0.9.2 which is being released today.

Original comment by khall...@gmail.com on 19 Sep 2008 at 7:51

GoogleCodeExporter commented 8 years ago
A new version has been released, 0.9.5, which may fix this problem. The new 
version
uses jQuery's built-in methods for determining the position now. I have not yet
tested whether this specific issue is remedied by this change so I'm leaving 
this
open until I have verification.

Original comment by khall...@gmail.com on 14 Oct 2008 at 8:23