mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
A fix for #713
This commit is contained in:
10
src/Stage.ts
10
src/Stage.ts
@@ -244,12 +244,13 @@ export class Stage extends Container<BaseLayer> {
|
||||
* get pointer position which can be a touch position or mouse position
|
||||
* @method
|
||||
* @name Konva.Stage#getPointerPosition
|
||||
* @returns {Object}
|
||||
* @returns {Vector2d|null}
|
||||
*/
|
||||
getPointerPosition() {
|
||||
getPointerPosition(): Vector2d | null {
|
||||
const pos = this._pointerPositions[0];
|
||||
if (!pos) {
|
||||
Util.warn(NO_POINTERS_MESSAGE);
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
x: pos.x,
|
||||
@@ -316,7 +317,10 @@ export class Stage extends Container<BaseLayer> {
|
||||
* // or if you interested in shape parent:
|
||||
* var group = stage.getIntersection({x: 50, y: 50}, 'Group');
|
||||
*/
|
||||
getIntersection(pos: Vector2d, selector?: string): Shape | null {
|
||||
getIntersection(pos: Vector2d | null, selector?: string): Shape | null {
|
||||
if (!pos) {
|
||||
return null;
|
||||
}
|
||||
var layers = this.children,
|
||||
len = layers.length,
|
||||
end = len - 1,
|
||||
|
Reference in New Issue
Block a user