Fix drag position handling. close #739

This commit is contained in:
Anton Lavrenov
2019-09-10 12:08:36 -05:00
parent e23c288156
commit f16434d6d8
6 changed files with 1379 additions and 56 deletions

View File

@@ -91,12 +91,14 @@ export const DD = {
// dragBefore and dragAfter allows us to set correct order of events
// setup all in dragbefore, and stop dragging only after pointerup triggered.
_endDragBefore(evt) {
_endDragBefore(evt?) {
DD._dragElements.forEach((elem, key) => {
const { node } = elem;
// we need to find pointer relative to that node
const stage = node.getStage();
stage.setPointersPositions(evt);
if (evt) {
stage.setPointersPositions(evt);
}
const pos = stage._changedPointerPositions.find(
pos => pos.id === elem.pointerId

View File

@@ -2311,8 +2311,7 @@ export abstract class Node<Config extends NodeConfig = NodeConfig> {
* @method
* @name Konva.Node#stopDrag
*/
stopDrag() {
var evt = {};
stopDrag(evt?) {
const elem = DD._dragElements.get(this._id);
if (elem) {
elem.dragStatus = 'stopped';