Fix bug when exponent notation (e.g. "q 10.47e-3") would trip up path parsing mechanism.

This commit is contained in:
kangax 2012-07-26 00:16:30 +02:00
parent d9a64e4529
commit 02a13062ee
4 changed files with 11 additions and 11 deletions

10
dist/all.js vendored
View file

@ -10071,13 +10071,13 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
this.path = fromArray
? path
: path.match && path.match(/[a-zA-Z][^a-zA-Z]*/g);
// one of commands (m,M,l,L,q,Q,c,C,etc.) followed by non-command characters (i.e. command values)
: path.match && path.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);
if (!this.path) return;
// TODO (kangax): rewrite this idiocracy
if (!fromArray) {
this._initializeFromArray(options);
this._initializeFromString(options);
}
if (options.sourcePath) {
@ -10087,9 +10087,9 @@ fabric.util.object.extend(fabric.StaticCanvas.prototype, {
/**
* @private
* @method _initializeFromArray
* @method _initializeFromString
*/
_initializeFromArray: function(options) {
_initializeFromString: function(options) {
var isWidthSet = 'width' in options,
isHeightSet = 'height' in options;

2
dist/all.min.js vendored

File diff suppressed because one or more lines are too long

BIN
dist/all.min.js.gz vendored

Binary file not shown.

View file

@ -186,13 +186,13 @@
this.path = fromArray
? path
: path.match && path.match(/[a-zA-Z][^a-zA-Z]*/g);
// one of commands (m,M,l,L,q,Q,c,C,etc.) followed by non-command characters (i.e. command values)
: path.match && path.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);
if (!this.path) return;
// TODO (kangax): rewrite this idiocracy
if (!fromArray) {
this._initializeFromArray(options);
this._initializeFromString(options);
}
if (options.sourcePath) {
@ -202,9 +202,9 @@
/**
* @private
* @method _initializeFromArray
* @method _initializeFromString
*/
_initializeFromArray: function(options) {
_initializeFromString: function(options) {
var isWidthSet = 'width' in options,
isHeightSet = 'height' in options;