added radius type checking in setAttrs method

This commit is contained in:
Eric Rowell
2012-08-26 00:11:46 -07:00
parent 6eda6d2607
commit f08701e347
3 changed files with 24 additions and 4 deletions

12
dist/kinetic-core.js vendored
View File

@@ -3,7 +3,7 @@
* http://www.kineticjs.com/ * http://www.kineticjs.com/
* Copyright 2012, Eric Rowell * Copyright 2012, Eric Rowell
* Licensed under the MIT or GPL Version 2 licenses. * Licensed under the MIT or GPL Version 2 licenses.
* Date: Aug 25 2012 * Date: Aug 26 2012
* *
* Copyright (C) 2011 - 2012 by Eric Rowell * Copyright (C) 2011 - 2012 by Eric Rowell
* *
@@ -1413,6 +1413,16 @@ Kinetic.Node.prototype = {
else { else {
// handle special keys // handle special keys
switch (key) { switch (key) {
case 'radius':
if(Kinetic.Type._isNumber(val)) {
that._setAttr(obj, key, val);
}
else {
var xy = type._getXY(val);
that._setAttr(obj[key], 'x', xy.x);
that._setAttr(obj[key], 'y', xy.y);
}
break;
case 'rotationDeg': case 'rotationDeg':
that._setAttr(obj, 'rotation', c[key] * Math.PI / 180); that._setAttr(obj, 'rotation', c[key] * Math.PI / 180);
// override key for change event // override key for change event

File diff suppressed because one or more lines are too long

View File

@@ -248,6 +248,16 @@ Kinetic.Node.prototype = {
else { else {
// handle special keys // handle special keys
switch (key) { switch (key) {
case 'radius':
if(Kinetic.Type._isNumber(val)) {
that._setAttr(obj, key, val);
}
else {
var xy = type._getXY(val);
that._setAttr(obj[key], 'x', xy.x);
that._setAttr(obj[key], 'y', xy.y);
}
break;
case 'rotationDeg': case 'rotationDeg':
that._setAttr(obj, 'rotation', c[key] * Math.PI / 180); that._setAttr(obj, 'rotation', c[key] * Math.PI / 180);
// override key for change event // override key for change event