mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-04-21 14:34:43 +00:00
Fix path regExp for compressed path commands
Fix regExp for e^x numbers Add unit test for e^x numbers
This commit is contained in:
parent
0fc31d09c5
commit
61f65bc206
2 changed files with 14 additions and 1 deletions
|
|
@ -558,7 +558,7 @@
|
|||
coords = [ ],
|
||||
currentPath,
|
||||
parsed,
|
||||
re = /([-+]?\d+(?:\.\d+)?(?:e[-+]?\d+)?)/g,
|
||||
re = /([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/ig,
|
||||
match,
|
||||
coordsStr;
|
||||
|
||||
|
|
|
|||
|
|
@ -204,4 +204,17 @@
|
|||
start();
|
||||
});
|
||||
});
|
||||
|
||||
asyncTest('compressed path commands with e^x', function() {
|
||||
var el = getPathElement('M56.224e2 84.12E-2c-.047.132-.138.221-.322.215.046-.131.137-.221.322-.215m-.050 -20.100z');
|
||||
fabric.Path.fromElement(el, function(obj) {
|
||||
|
||||
deepEqual(obj.path[0], ['M', 5622.4, 0.8412]);
|
||||
deepEqual(obj.path[1], ['c', -0.047, 0.132, -0.138, 0.221, -0.322, 0.215]);
|
||||
deepEqual(obj.path[2], ['c', 0.046, -0.131, 0.137, -0.221, 0.322, -0.215]);
|
||||
deepEqual(obj.path[3], ['m', -0.05, -20.100]);
|
||||
deepEqual(obj.path[4], ['z']);
|
||||
start();
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
|
|
|||
Loading…
Reference in a new issue