mirror of
https://github.com/konvajs/konva.git
synced 2025-12-04 10:58:22 +08:00
getIntersections no longer returns visible shapes in the result set, and can also be called from any container
This commit is contained in:
36
dist/kinetic-core.js
vendored
36
dist/kinetic-core.js
vendored
@@ -1558,6 +1558,24 @@ Kinetic.Container = Kinetic.Node.extend({
|
||||
|
||||
return false;
|
||||
},
|
||||
/**
|
||||
* get shapes that intersect a point
|
||||
* @param {Object} point
|
||||
*/
|
||||
getIntersections: function() {
|
||||
var pos = Kinetic.Type._getXY(Array.prototype.slice.call(arguments));
|
||||
var arr = [];
|
||||
var shapes = this.get('Shape');
|
||||
|
||||
for(var n = 0; n < shapes.length; n++) {
|
||||
var shape = shapes[n];
|
||||
if(shape.isVisible() && shape.intersects(pos)) {
|
||||
arr.push(shape);
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
},
|
||||
/**
|
||||
* get all shapes inside container
|
||||
*/
|
||||
@@ -1909,24 +1927,6 @@ Kinetic.Stage = Kinetic.Container.extend({
|
||||
getStage: function() {
|
||||
return this;
|
||||
},
|
||||
/**
|
||||
* get shapes that intersect a point
|
||||
* @param {Object} point
|
||||
*/
|
||||
getIntersections: function() {
|
||||
var pos = Kinetic.Type._getXY(Array.prototype.slice.call(arguments));
|
||||
var arr = [];
|
||||
var shapes = this.get('Shape');
|
||||
|
||||
for(var n = 0; n < shapes.length; n++) {
|
||||
var shape = shapes[n];
|
||||
if(shape.intersects(pos)) {
|
||||
arr.push(shape);
|
||||
}
|
||||
}
|
||||
|
||||
return arr;
|
||||
},
|
||||
/**
|
||||
* get stage DOM node, which is a div element
|
||||
* with the class name "kineticjs-content"
|
||||
|
||||
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
Reference in New Issue
Block a user