Under certain conditions there is a variable image offset to the left when Constrain to Square is used causing a misalignment of image and caption.
This only seems to appear when the horizontal width is significantly reduced in size by the Constrain to Square option compared to the maximum size of a cell.
The following code seems to correct the problem although I have not tested it enough to know if there are any unwanted side-effects. I suspect there is a similar vertical offset but this is likely to be less obvious as the captions and image seem to keep their relative positions.
In the computeBounds function near line 14540:
// Corrects for offset when Image width is forced to be significantly smaller than the Cell size when using Constrained to Square
var XsquareFix = 0
// adjust if constrained to a square
if (csOpts.squareCell) {
if (imageW > imageH) {
imageW = imageH;
} else {
imageH = imageW;
}
XsquareFix = (cellW - imageW - (2 * csOpts.horizontal))/2
}
csOpts.imageBnds[2] = csOpts.imageBnds[0] + imageW + XsquareFix;
csOpts.imageBnds[0] = csOpts.imageBnds[0] + XsquareFix;
csOpts.imageBnds[3] = csOpts.imageBnds[1] + imageH;
To test the effect. generate a contact sheet with the following parameters.
Width 10in, Height 10in, Columns 2, Rows 1, 72 dpi, Captions from filename at 12pt Centred, auto-spacing. Set Constrain to Square The other settings as you like. The captions and images should align. Change the height to 2in and repeat. The captions no longer align, the images are offset to the left. Try again without the Constrain to Square and they should nor align again.
This is a rather extreme example but occasions where it would happen normally.
I am sure you can find a much more elegant solution than this attempt.
Hope this helps
Thanks
MikeL
Logged In: YES
user_id=1032307
Originator: NO
First off, this was an excellent find. Thanks for isolating the bug and coming up with a fix.
This is a known problem that nobody noticed before. It's actually in the Extensions.txt file (my ToDo list) though it's misnamed as 'Vertical Thumbnail Alignment'. CSX already has Vertical Thumbnail Alignment. What it doesn't have is Horizontal Thumbnail Alignment.
The caption is aligned correctly in the Cell (the area allocated for the image and the caption). The image, however, is not, which means it will always be left-justified. In retrospect, this probably wasn't the best decision but the fact that I had added it to Extensions.txt means I knew I would have to get around to fixing it.
I'll be adding a new setting called 'halign' and a dropdown list (Left,Center,Right). The fix will be in the next daily build.
And I'm happy to see that my code was clear enough for someone else to come up with a patch :)
-X
Logged In: YES
user_id=1032307
Originator: NO
I've made the necessary changes. You can find the in this daily build:
http://ps-scripts.sourceforge.net/ContactSheetX/builds/ContactSheetX-1_78.zip
-X
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).