mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -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;
|
||||
// http://www.w3.org/TR/SVG/pservers.html#StopElementOffsetAttribute
|
||||
case 'offset':
|
||||
var isPercentage = value[value.length - 1] == '%';
|
||||
value = parseFloat(isPercentage ? value.slice(0, -1) : value, 10);
|
||||
item.setRampPoint(isPercentage ? value / 100 : value);
|
||||
var percentage = value.match(/(.*)%$/);
|
||||
item.setRampPoint(percentage ? percentage[1] / 100 : value);
|
||||
break;
|
||||
case 'xlink:href':
|
||||
var definition = definitions[value.substr(1)];
|
||||
|
|
Loading…
Reference in a new issue