mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
SvgImporter: Shorten percentage code.
This commit is contained in:
parent
b04f852667
commit
1376d75e61
1 changed files with 2 additions and 3 deletions
|
@ -424,9 +424,8 @@ new function() {
|
||||||
break;
|
break;
|
||||||
// http://www.w3.org/TR/SVG/pservers.html#StopElementOffsetAttribute
|
// http://www.w3.org/TR/SVG/pservers.html#StopElementOffsetAttribute
|
||||||
case 'offset':
|
case 'offset':
|
||||||
var isPercentage = value[value.length - 1] == '%';
|
var percentage = value.match(/(.*)%$/);
|
||||||
value = parseFloat(isPercentage ? value.slice(0, -1) : value, 10);
|
item.setRampPoint(percentage ? percentage[1] / 100 : value);
|
||||||
item.setRampPoint(isPercentage ? value / 100 : value);
|
|
||||||
break;
|
break;
|
||||||
case 'xlink:href':
|
case 'xlink:href':
|
||||||
var definition = definitions[value.substr(1)];
|
var definition = definitions[value.substr(1)];
|
||||||
|
|
Loading…
Reference in a new issue