mirror of
https://github.com/konvajs/konva.git
synced 2026-03-03 16:58:33 +08:00
changed getLevel to getDepth
This commit is contained in:
16
src/Node.js
16
src/Node.js
@@ -585,7 +585,7 @@
|
|||||||
* @returns {Integer}
|
* @returns {Integer}
|
||||||
*/
|
*/
|
||||||
getAbsoluteZIndex: function() {
|
getAbsoluteZIndex: function() {
|
||||||
var level = this.getLevel(),
|
var depth = this.getDepth(),
|
||||||
that = this,
|
that = this,
|
||||||
index = 0,
|
index = 0,
|
||||||
nodes, len, n, child;
|
nodes, len, n, child;
|
||||||
@@ -606,7 +606,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nodes.length > 0 && nodes[0].getLevel() <= level) {
|
if(nodes.length > 0 && nodes[0].getDepth() <= depth) {
|
||||||
addChildren(nodes);
|
addChildren(nodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -617,22 +617,22 @@
|
|||||||
return index;
|
return index;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* get node level in node tree. Returns an integer.<br><br>
|
* get node depth in node tree. Returns an integer.<br><br>
|
||||||
* e.g. Stage level will always be 0. Layers will always be 1. Groups and Shapes will always
|
* e.g. Stage depth will always be 0. Layers will always be 1. Groups and Shapes will always
|
||||||
* be >= 2
|
* be >= 2
|
||||||
* @method
|
* @method
|
||||||
* @memberof Kinetic.Node.prototype
|
* @memberof Kinetic.Node.prototype
|
||||||
* @returns {Integer}
|
* @returns {Integer}
|
||||||
*/
|
*/
|
||||||
getLevel: function() {
|
getDepth: function() {
|
||||||
var level = 0,
|
var depth = 0,
|
||||||
parent = this.parent;
|
parent = this.parent;
|
||||||
|
|
||||||
while(parent) {
|
while(parent) {
|
||||||
level++;
|
depth++;
|
||||||
parent = parent.parent;
|
parent = parent.parent;
|
||||||
}
|
}
|
||||||
return level;
|
return depth;
|
||||||
},
|
},
|
||||||
setPosition: function(pos) {
|
setPosition: function(pos) {
|
||||||
this.setX(pos.x);
|
this.setX(pos.x);
|
||||||
|
|||||||
Reference in New Issue
Block a user