-
Notifications
You must be signed in to change notification settings - Fork 21
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
Adjust scale changing values #322
Comments
It took hours for me and @shayanealcantara to understand where the problem was. We explored all the files with the word 'scale' in them. In the end, it was a simple mistake in the 'xproportion' and 'yproportion' methods of the Object class. Isn't the world of programming wonderful? xD Anyway, we left comments explaining related methods in the code, and we will use this issue to explain (what we understand from) the operation of scales in Jandig. |
When the user uploads an Object, the aspect ratio of that Object is calculated and stored as a string in the format "[width ratio] [height ratio]", so that the largest value between them appears as 1, and the another appears as a fraction of it. It may seem confusing, but try to see it as a scale in format 1:[something]. Let's use Patrick's GIF as an example. It is 500 pixels wide and 300 pixels high. Therefore, its proportion is calculated by dividing 300 (lowest value) by 500 (highest value). The result is a 1:0.6 scale (stored as "1 0.6"). |
When the user inputs a value in the "Scale" form (either when uploading or editing the Object), that value is multiplied by both the width and height ratios. Returning to the example, if the user enters the value 2, the new scale is "2 1.2". The 'xscale' and 'yscale' methods simply obtain these height and width ratios from the scale attribute. The 'xproportion' and 'yproportion' methods obtain these values and reduce them back to scale 1:[something], so that when the user enters a new value in the "Scale" field, the multiplication is done by the original proportion and not by the modified proportion. |
O.o Thank you very much!!! |
@vjpixel We're glad you liked it! The issue was resolved and the code was merged, so you may close it already ^^ |
Done! |
When I change the Adjust Scale value of an Artwork it's changing to another value.
I just saved 0.95:
Just after saving, I opened and the value changed to 0.7737809375:
The text was updated successfully, but these errors were encountered: