fix #96 setting text to integer data types no longer fails

This commit is contained in:
ericdrowell 2012-09-23 18:41:05 -07:00
parent 9fde3036f7
commit a349fa488c
4 changed files with 14 additions and 2 deletions

View File

@ -1489,6 +1489,10 @@ Kinetic.Node.prototype = {
that._setAttr(obj[key], 'width', size.width); that._setAttr(obj[key], 'width', size.width);
that._setAttr(obj[key], 'height', size.height); that._setAttr(obj[key], 'height', size.height);
break; break;
case 'text':
var str = Kinetic.Type._isString(val) ? val : val.toString();
that._setAttr(obj, key, str);
break;
default: default:
that._setAttr(obj, key, val); that._setAttr(obj, key, val);
break; break;

File diff suppressed because one or more lines are too long

View File

@ -290,6 +290,10 @@ Kinetic.Node.prototype = {
that._setAttr(obj[key], 'width', size.width); that._setAttr(obj[key], 'width', size.width);
that._setAttr(obj[key], 'height', size.height); that._setAttr(obj[key], 'height', size.height);
break; break;
case 'text':
var str = Kinetic.Type._isString(val) ? val : val.toString();
that._setAttr(obj, key, str);
break;
default: default:
that._setAttr(obj, key, val); that._setAttr(obj, key, val);
break; break;

View File

@ -2775,6 +2775,9 @@ Test.prototype.tests = {
test(text.getCornerRadius() === 20, 'text box corner radius should be 20'); test(text.getCornerRadius() === 20, 'text box corner radius should be 20');
test(text.getDraggable() === false, 'text draggable should be false'); test(text.getDraggable() === false, 'text draggable should be false');
// test set text to integer
text.setText(5);
//document.body.appendChild(layer.bufferCanvas.element) //document.body.appendChild(layer.bufferCanvas.element)
//layer.setListening(false); //layer.setListening(false);