mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 05:14:58 +08:00
Selector parameter in findAncestor(s) is not optional
This commit is contained in:
@@ -1489,7 +1489,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
|||||||
* get all ancestors (parent then parent of the parent, etc) of the node
|
* get all ancestors (parent then parent of the parent, etc) of the node
|
||||||
* @method
|
* @method
|
||||||
* @name Konva.Node#findAncestors
|
* @name Konva.Node#findAncestors
|
||||||
* @param {String} [selector] selector for search
|
* @param {String} selector selector for search
|
||||||
* @param {Boolean} [includeSelf] show we think that node is ancestro itself?
|
* @param {Boolean} [includeSelf] show we think that node is ancestro itself?
|
||||||
* @param {Konva.Node} [stopNode] optional node where we need to stop searching (one of ancestors)
|
* @param {Konva.Node} [stopNode] optional node where we need to stop searching (one of ancestors)
|
||||||
* @returns {Array} [ancestors]
|
* @returns {Array} [ancestors]
|
||||||
@@ -1497,7 +1497,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
|||||||
* // get one of the parent group
|
* // get one of the parent group
|
||||||
* var parentGroups = node.findAncestors('Group');
|
* var parentGroups = node.findAncestors('Group');
|
||||||
*/
|
*/
|
||||||
findAncestors(selector?, includeSelf?, stopNode?) {
|
findAncestors(selector, includeSelf?, stopNode?) {
|
||||||
var res: Array<Node> = [];
|
var res: Array<Node> = [];
|
||||||
|
|
||||||
if (includeSelf && this._isMatch(selector)) {
|
if (includeSelf && this._isMatch(selector)) {
|
||||||
@@ -1522,7 +1522,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
|||||||
* get ancestor (parent or parent of the parent, etc) of the node that match passed selector
|
* get ancestor (parent or parent of the parent, etc) of the node that match passed selector
|
||||||
* @method
|
* @method
|
||||||
* @name Konva.Node#findAncestor
|
* @name Konva.Node#findAncestor
|
||||||
* @param {String} [selector] selector for search
|
* @param {String} selector selector for search
|
||||||
* @param {Boolean} [includeSelf] show we think that node is ancestro itself?
|
* @param {Boolean} [includeSelf] show we think that node is ancestro itself?
|
||||||
* @param {Konva.Node} [stopNode] optional node where we need to stop searching (one of ancestors)
|
* @param {Konva.Node} [stopNode] optional node where we need to stop searching (one of ancestors)
|
||||||
* @returns {Konva.Node} ancestor
|
* @returns {Konva.Node} ancestor
|
||||||
@@ -1530,7 +1530,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
|
|||||||
* // get one of the parent group
|
* // get one of the parent group
|
||||||
* var group = node.findAncestors('.mygroup');
|
* var group = node.findAncestors('.mygroup');
|
||||||
*/
|
*/
|
||||||
findAncestor(selector?, includeSelf?, stopNode?) {
|
findAncestor(selector, includeSelf?, stopNode?) {
|
||||||
return this.findAncestors(selector, includeSelf, stopNode)[0];
|
return this.findAncestors(selector, includeSelf, stopNode)[0];
|
||||||
}
|
}
|
||||||
// is current node match passed selector?
|
// is current node match passed selector?
|
||||||
|
|||||||
Reference in New Issue
Block a user