added isListening and isDraggable aliases for consistency

This commit is contained in:
ericdrowell
2012-09-23 16:06:44 -07:00
parent bda7f9f082
commit 24e3aa2c03
4 changed files with 34 additions and 2 deletions

14
dist/kinetic-core.js vendored
View File

@@ -2305,6 +2305,20 @@ Kinetic.Node._addGetter = function(constructor, attr) {
Kinetic.Node.addGettersSetters(Kinetic.Node, ['x', 'y', 'scale', 'rotation', 'opacity', 'name', 'id', 'offset', 'draggable', 'dragConstraint', 'dragBounds', 'listening']);
Kinetic.Node.addSetters(Kinetic.Node, ['rotationDeg']);
// mappings
/**
* determine if listening to events or not. Alias of getListening()
* @name isListening
* @methodOf Kinetic.Node.prototype
*/
Kinetic.Node.prototype.isListening = Kinetic.Node.prototype.getListening;
/**
* get draggable. Alias of getDraggable()
* @name isDraggable
* @methodOf Kinetic.Node.prototype
*/
Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
/**
* set node x position
* @name setX

File diff suppressed because one or more lines are too long

View File

@@ -1106,6 +1106,20 @@ Kinetic.Node._addGetter = function(constructor, attr) {
Kinetic.Node.addGettersSetters(Kinetic.Node, ['x', 'y', 'scale', 'rotation', 'opacity', 'name', 'id', 'offset', 'draggable', 'dragConstraint', 'dragBounds', 'listening']);
Kinetic.Node.addSetters(Kinetic.Node, ['rotationDeg']);
// mappings
/**
* determine if listening to events or not. Alias of getListening()
* @name isListening
* @methodOf Kinetic.Node.prototype
*/
Kinetic.Node.prototype.isListening = Kinetic.Node.prototype.getListening;
/**
* get draggable. Alias of getDraggable()
* @name isDraggable
* @methodOf Kinetic.Node.prototype
*/
Kinetic.Node.prototype.isDraggable = Kinetic.Node.prototype.getDraggable;
/**
* set node x position
* @name setX

View File

@@ -2984,6 +2984,8 @@ Test.prototype.tests = {
stage.add(layer);
test(rect.getListening() === true, 'rect should be listening');
// test alias
test(rect.isListening() === true, 'rect should be listening');
rect.setListening(false);
test(rect.getListening() === false, 'rect should not be listening');
@@ -3164,6 +3166,8 @@ Test.prototype.tests = {
test(clone.getX() === 300, 'clone x should be 300');
test(clone.getY() === 0, 'clone y should be 50');
test(clone.getDraggable() === true, 'clone should be draggable');
// test alias
test(clone.isDraggable() === true, 'clone should be draggable');
test(clone.getName() === 'groupClone', 'clone name should be groupClone');
test(group.getChildren().length === 2, 'group should have two children');