modularscale / modularscale-sass

Modular scale calculator built into your Sass
http://www.modularscale.com
MIT License
1.98k stars 134 forks source link

Check ms-list values #69

Closed scottkellum closed 10 years ago

scottkellum commented 10 years ago

Some incorrect values are resulting, looks like the loop is missing some numbers from the secondary base including the base itself.

test case:

ms-list(-2, 5, 10px 16px, $major-third)
scottkellum commented 10 years ago

@canarymason This is a good place to get pretty deep into the new codebase. Basically I generate lists of all the possibilities and then merge-sort them into place (why merge sort? because they are already sorted lists and half the work is done).

This issue seems to be with the bounds of the loops that generate those lists: https://github.com/Team-Sass/modular-scale/blob/2.x/stylesheets/modular-scale/_generate-list.scss

I assume the ms(0) items in the list are getting trimmed off for some reason. Anyway, that is my assumption.

Notes:

rpkoller commented 10 years ago

aside the missing secondary base value another pattern is showing - a shift in negative values. according to the calculator on modularscale.com you would expect 8.192 and 8.000 with your test values:

http://modularscale.com/scale/?px1=10&px2=16&ra1=1.25&ra2=0

but the shown values are shifted. instead of displaying the negative values at position 1 and 2, position 3 and 4 get displayed. things behaves accordingly for an example with a negative starting value of -6:

ms-list(-6, 12, 20px 44px, $golden);

http://modularscale.com/scale/?px1=20&px2=44&ra1=1.618&ra2=0

scottkellum commented 10 years ago

Should be fixed now