Skip to content

Commit

Permalink
Captures exponential and linear functions in text-halo migrations, co…
Browse files Browse the repository at this point in the history
…nstants in text-halo-width
  • Loading branch information
Lauren Budorick committed Jul 2, 2014
1 parent 8088f97 commit 3d58837
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions migrations/v3.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ function convertLayer(layer) {
if (classname.indexOf('style') === 0) {
var style = layer[classname];
if (style['text-halo-width']) {
if (typeof(style['text-halo-width']) == 'string' && style['text-halo-width'].indexOf('@') != -1) {
style['text-halo-width'] = vc[style['text-halo-width']];
}
// handle 3 cases: text-size as constant, text-size as #, no text-size but max-text-size
var textSize = (typeof(style['text-size']) == 'string' &&
style['text-size'].indexOf('@') != -1) ?
Expand All @@ -66,7 +69,7 @@ function convertLayer(layer) {
// handle text-size numbers and functions
if (typeof(textSize) == 'number') {
style['text-halo-width'] = convertHalo(style['text-halo-width'], textSize);
} else if (textSize && textSize.stops) {
} else if (textSize && textSize.fn && textSize.fn == 'stops') {
var stops = [];
for (var stop in textSize.stops) {
stops.push(
Expand All @@ -78,14 +81,19 @@ function convertLayer(layer) {
"fn": "stops",
"stops": stops
};
} else if (textSize && textSize.fn && textSize.fn == ('exponential' || 'linear')) {
if (textSize.val) var val = convertHalo(style['text-halo-width'], textSize.val);
if (textSize.max) var max = convertHalo(style['text-halo-width'], textSize.max);
if (textSize.min) var min = convertHalo(style['text-halo-width'], textSize.min);
style['text-halo-width'] = textSize;
style['text-halo-width']['val'] = val;
style['text-halo-width']['max'] = max;
style['text-halo-width']['min'] = min;
}
}
}
}

if (layer.style && layer.style['text-halo-blur']) {
}

delete render['text-path'];
}
if (layer.layers) layer.layers.forEach(convertLayer);
Expand Down

0 comments on commit 3d58837

Please sign in to comment.