mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-06 19:19:39 -04:00
Optimise read() functions to only convert if argument is not of desired type already.
This commit is contained in:
parent
d67055b09b
commit
0ac19a8e82
4 changed files with 14 additions and 4 deletions
src/basic
|
@ -278,7 +278,9 @@ Rectangle = Base.extend({
|
|||
|
||||
statics: {
|
||||
read: function(args) {
|
||||
if(args.length) {
|
||||
if (args.length == 1 && args[0] instanceof Rectangle) {
|
||||
return args[0];
|
||||
} else if (args.length) {
|
||||
var rect = new Rectangle();
|
||||
rect.initialize.apply(rect, args);
|
||||
return rect;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue