mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Fix exceptions in ProxyContext when drawing bitmaps.
This commit is contained in:
parent
e1ed7f3294
commit
f56efd6471
1 changed files with 11 additions and 2 deletions
|
@ -59,6 +59,15 @@ var ProxyContext = new function() {
|
|||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
function stringify(value) {
|
||||
try {
|
||||
return JSON.stringify(value);
|
||||
} catch (e) {
|
||||
return value + '';
|
||||
}
|
||||
}
|
||||
|
||||
Base.each(descriptions, function(description) {
|
||||
var match = description.match(/^([^(]+)(\()*/),
|
||||
name = match[1],
|
||||
|
@ -69,7 +78,7 @@ var ProxyContext = new function() {
|
|||
this._indents--;
|
||||
console.log(this.getIndentation() + 'ctx.' + name + '('
|
||||
+ Array.prototype.slice.call(arguments, 0)
|
||||
.map(JSON.stringify).join(', ')
|
||||
.map(stringify).join(', ')
|
||||
+ ');');
|
||||
if (name === 'save')
|
||||
this._indents++;
|
||||
|
@ -83,7 +92,7 @@ var ProxyContext = new function() {
|
|||
|
||||
set: function(value) {
|
||||
console.log(this.getIndentation() + 'ctx.' + name + ' = '
|
||||
+ JSON.stringify(value) + ';');
|
||||
+ stringify(value) + ';');
|
||||
return this._ctx[name] = value;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue