mirror of
https://github.com/konvajs/konva.git
synced 2025-11-08 10:34:46 +08:00
added isListening and isDraggable aliases for consistency
This commit is contained in:
14
dist/kinetic-core.js
vendored
14
dist/kinetic-core.js
vendored
@@ -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
|
||||
|
||||
4
dist/kinetic-core.min.js
vendored
4
dist/kinetic-core.min.js
vendored
File diff suppressed because one or more lines are too long
14
src/Node.js
14
src/Node.js
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user