Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

b.imageMode() is sometimes ignored #118

Open
trych opened this issue Nov 7, 2016 · 6 comments
Open

b.imageMode() is sometimes ignored #118

trych opened this issue Nov 7, 2016 · 6 comments

Comments

@trych
Copy link
Contributor

trych commented Nov 7, 2016

While in class for most people (~80 % maybe) b.imageMode() did not work. Also images were drawn from center by default, which they should not. b.imageMode(b.CORNER) could not fix this behavior, so it had to be manually fixed by using b.transformImage() to the desired position.

This might be connected to the InDesign version, on my CS6 at home it works fine, at the uni's CC2015 it had the issue. Unfortunately I cannot test the CC2015 really well, as I don't have it at home.

Maybe someone could give this a try in a version newer than CS6:

#includepath "~/Documents/;%USERPROFILE%Documents";
#include "basiljs/bundle/basil.js";

function draw() {

  b.image('image-example.jpg', 0, 0);

}

b.go();

This should draw from the top left corner, but in class for most people placed the image's center at the top left corner.

@trych trych added the bug label Nov 7, 2016
@ffd8
Copy link
Member

ffd8 commented Nov 7, 2016

Issue in CC 2014 too – hmm must have always placed images into a drawn shapes.

b.image('image-example.jpg', 0, 0);
Draws center out, ignoring b.imageMode(b.CORNER)

b.image('image-example.jpg', 0, 0, 300, 300);
Draws corner out while filling proportionally
Respects both b.imageMode() changes to b.CENTER / b.CORNER

@trych
Copy link
Contributor Author

trych commented Nov 7, 2016

Ok, so the problem is only happening, if the last two arguments are omitted? Do I understand you correctly?

@ffd8
Copy link
Member

ffd8 commented Nov 7, 2016

Exactly. Seems to only follow the b.imageMode() if those two arguments are present...

@trych
Copy link
Contributor Author

trych commented Nov 7, 2016

Ok, now we only would need someone to check if the first version of this bug to appear is the original (pre-2014) InDesign CC or InDesign CC 2014. My guess would be InDesign CC. Could somebody with a newer InDesign try the same script with the InDesign CC object model?

Should be possible by setting app.scriptPreferences.version = 9; in the script.

Nevermind, if we figure out the bug and fix it, it does not really matter in which version it appeared first. 😃

@ffd8
Copy link
Member

ffd8 commented Nov 7, 2016

I think I found the issue.. has to do with the fitting options of only 3 args:
https://github.com/basiljs/basil.js/blob/master/basil.js#L4760

I did a quick test, building a 1x1 in the 0,0 corner. Placed an image, checked the fitting options from contextual menu.. Only useful option is 'fit frame to content' (what's being using).. and that creates a centered image, regardless of the anchorpoint prefs.

Sooooo.. it seems that another check for 3 args (+/- if b.CORNER) needs to be called further down for transformation back to x, y.

@trych
Copy link
Contributor Author

trych commented Nov 7, 2016

Sooooo.. it seems that another check for 3 args (+/- if b.CORNER) needs to be called further down for transformation back to x, y.

And there we need to make sure it is an absolute transformation, not relative, else it will mess up for CS6.

Unfortunately for me this will be rather difficult to fix, since I only have access to CS6. 😝

@ff6347 ff6347 modified the milestone: Close all those bugs! Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants