youmoula / jcrop

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

Bad x and h cropping coordinates in 0.9.7 (repros in 0.9.8 and 0.9.9-dev) #18

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Using the attached file and Jcrop 0.9.7, try to select the "sterling
confections" logo in the middle.
2. Note the values for c.x and c.h
3. Now repeat with Jcrop 0.9.6 (both are using jquery 1.3.2)
4. Note the values for c.x and c.h

What is the expected output? What do you see instead?
I would expect the values to be identical between 0.9.6 and 0.9.7.  They
are not, and 0.9.7 does not seem to give the correct value.  c.x and c.h
place the cropping box to the left of the desired selection and shorter
than the desired selection.  If using a standard PHP script to save the
cropped image, it will save an image that is shorter and to the left of the
desired image.

What version of the product are you using? On what operating system?
Comparing version 0.9.6 and 0.9.7 (this also repros in 0.9.8 and
0.9.9-dev).  I have repro'd this on IE8 Windows XP SP2 as well as Firefox
3.x on Ubuntu 9, as well as Firefox 3.x on Mac.

Please provide any additional information below.

Original issue reported on code.google.com by elliot%p...@gtempaccount.com on 29 Aug 2009 at 8:50

Attachments:

GoogleCodeExporter commented 8 years ago
I did some further digging and it looks like the difference from 0.9.7 and 
0.9.6 that
is meaningful is around detecting the image size.

I cannot for the life of me figure out how the image size is getting 
initialized to a
different number.  But in 0.9.6 the "actual" image size is being used rather 
than the
CSS width/height.  In 0.9.7 the img width and height are the CSS values rather 
than
the value of the actual image file.

This becomes particularly meaningful in function presize($obj, w, h).
In 0.9.6, on line 914 and 915, xscale and yscale are set to the actual image 
size /
"nw" | "nh", where as in 0.9.7 xscale and yscale are set to the image's CSS 
width /
"nw" or height / "nh".

I suppose that this is more of a design issue than a bug.  I would argue that 
the
design should use the actual image size, because the server thinks the size of 
the
image is the "actual" size, then CSS width/height is just an artifact of how the
image is being displayed to the user, therefore i would suggest that the 
methodology
of 0.9.6 is the correct one.

thanks for all of the hard work, let me know if i can help,

Elliot

Original comment by elliot%p...@gtempaccount.com on 29 Aug 2009 at 10:21