-
Notifications
You must be signed in to change notification settings - Fork 30
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-less transform #251
b-less transform #251
Conversation
Bam! fantastic – will give it a test drive tomorrow. |
Awesome, thanks!
Interesting. I opened a new issue about this here with a suggestion of how to implement this. Let's continue the push-pop discussion in this issue. |
Added two commits, now |
Loops w/
I think |
Thanks for testing!
Hm, my reason to do it this way was, because we have position and size which I considered nouns, but now that I think about it, they are verbs as well. :) So, I would make the verbs the default behaviour in the docs, but I would like to leave scaling, rotation etc. working n the background. Ok for you?
At first I was against that, because I thought the outcome of the script will be unpredictable, but now I think we do the same with the units and the user's page size. So, yes I agree, I will change that.
I really would leave this at CENTER. If the user made it that far to start using |
Sure - no problem for me if it has additional ways of saying it. Re: transform using set referencePoint() – I think this is a different case than units..? Nevertheless, it would be very helpful if we disabled as many style/settings presets on our side that override a typical InDesign user. Especially when someone is adding code to an existing project that has many specific settings.. for a different thread, but I'd propose we try to use as many user settings for things like units, colormode, stroke, fill, .... – and have a re: CENTER, perhaps we just have an extra CONST for CENTER_CENTER, aliases CENTER? Similar user-friendly logic as verb names above? It's not necessary, but could be helpful. |
As I said I would consider the ref point that was set by the user. Other things as colormode, stroke, fill I would prefer to leave it as it is now. I think that worked well and is in the spirit of Processing and p5 that do the same. If someone uses basil on a existing project, he has to make sure to set stroke and fill to whatever he needs. No need to make everyone else use defaults() all the time just to get consistent behavior. (Also, the existence of a defaults() function would be a bit paradoxical: Why do I need a function to set defaults, if they are defaults? ;) ) |
@ffd8 Maybe we could have a quick Skype talk? (see my email) |
I guess using html is the way to go for jsdoc It should be something like this: /**
* <ul>
* <li> <code>"translation"</code>: Translates the page item by the given <code>[x, y]</code> values. Returns the coordinates of the page item's anchor point as an array.</li>
* <li> <code>"rotation"</code>: Rotates the page item to the given degree value. Returns the page item's rotation value in degrees.</li>
* </ul>
*/ I take a look tomorrow. |
b-less canvasModes() fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted the inline comment so this shows in the conversation history
The list in the docs is working there is just one <li>
element missing.
Good spot. Thanks, fixed. |
Ok, as discussed via Skype recently, I made the matrix functionalities private and kept only the ones that are needed for the basil methods. This passes all tests. This branch is good to go, I will merge it. |
❗️ This merges against the b-less branch ❗
Ok, so finally here's the result of basil.js Coding Sprint day 1 and 2. This branch includes the changes to basil.js' transform behavior as we discussed in our Skype calls. The changes are:
Processing style translate(), rotate() and scale()
All credits for this go to @bohnacker, I retrieved them from his pull request. Using these three functions basil.js behaves like Processing and p5.js now. I gave this quite a bit of testing, it just seems to work.
transform()
A new
transform()
function was added to allow for matrix independent transforms of page items, as discussed here.Example of transforms with all possible anchor points:
There was a test script added to easily generate these: test/visual/transform.jsx. Make sure to use this, to familiarize yourself with the transform function and quickly see results.
To take a shortcut, here's a copy-paste of the function's documentation:
Examples:
The function acknowledges the user's units as well as the current canvas mode.
referencePoint()
A function was added to allow
transform()
to work around a specific reference point (aka anchor point), as we discussed here.Constants were added to go along with this function (
TOP_LEFT
,TOP_CENTER
etc.). Alternatively the function can take InDesign anchor point enumerators or digits from1
to9
as arranged on a numpad (which refers to InDesign's infamous reference point keyboard shortcut and is a huge time saver during testing).Removal of legacy functions
All "item functions" (
itemX(),
itemWidth()etc.) as well as the
transformImage()function were removed, as they are replaced by the new
transform()` function.Other stuff
The test suit script was updated to work with
transform()
,changelog.txt
was updated. The changes don't break any tests of the testing suite.@basiljs Could you all give me feedback if this goes along with our plans of how the functions are suppose to work. Preferably asap, so I can make good use of the sprint. Thanks! 😎
@ffd8 In the context of our coding sprint, could you maybe checkout the branch and give this some testing? As I mentioned, there is is the script test/visual/transform.jsx to create pages like the ones you see above. You could just test, if the
transform()
function works as intended. Also, you could do some testing, if the Processing styletranslate()
,rotate()
andscale()
really do work like in Processing.@fabianmoronzirfas Could you give me a quick feedback on how I should format a list in jsdocs? As you can see, I added a list here. Is there a more appropriate way of doing this?