mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 13:26:07 +08:00
A fix for #713
This commit is contained in:
12
konva.js
12
konva.js
@@ -8,7 +8,7 @@
|
||||
* Konva JavaScript Framework v4.0.5
|
||||
* http://konvajs.org/
|
||||
* Licensed under the MIT
|
||||
* Date: Sat Aug 17 2019
|
||||
* Date: Thu Aug 22 2019
|
||||
*
|
||||
* Original work Copyright (C) 2011 - 2013 by Eric Rowell (KineticJS)
|
||||
* Modified work Copyright (C) 2014 - present by Anton Lavrenov (Konva)
|
||||
@@ -5819,12 +5819,13 @@
|
||||
* get pointer position which can be a touch position or mouse position
|
||||
* @method
|
||||
* @name Konva.Stage#getPointerPosition
|
||||
* @returns {Object}
|
||||
* @returns {Vector2d|null}
|
||||
*/
|
||||
Stage.prototype.getPointerPosition = function () {
|
||||
var pos = this._pointerPositions[0];
|
||||
if (!pos) {
|
||||
Util.warn(NO_POINTERS_MESSAGE);
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
x: pos.x,
|
||||
@@ -5878,6 +5879,9 @@
|
||||
* var group = stage.getIntersection({x: 50, y: 50}, 'Group');
|
||||
*/
|
||||
Stage.prototype.getIntersection = function (pos, selector) {
|
||||
if (!pos) {
|
||||
return null;
|
||||
}
|
||||
var layers = this.children, len = layers.length, end = len - 1, n, shape;
|
||||
for (n = end; n >= 0; n--) {
|
||||
shape = layers[n].getIntersection(pos, selector);
|
||||
@@ -5939,7 +5943,7 @@
|
||||
setPointerCapture(pointerId, this);
|
||||
};
|
||||
Stage.prototype.releaseCapture = function (pointerId) {
|
||||
releaseCapture(pointerId, this);
|
||||
releaseCapture(pointerId);
|
||||
};
|
||||
/**
|
||||
* returns a {@link Konva.Collection} of layers
|
||||
@@ -7426,7 +7430,7 @@
|
||||
setPointerCapture(pointerId, this);
|
||||
};
|
||||
Shape.prototype.releaseCapture = function (pointerId) {
|
||||
releaseCapture(pointerId, this);
|
||||
releaseCapture(pointerId);
|
||||
};
|
||||
return Shape;
|
||||
}(Node));
|
||||
|
||||
4
konva.min.js
vendored
4
konva.min.js
vendored
File diff suppressed because one or more lines are too long
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