remove some content events usage

This commit is contained in:
Anton Lavrenov
2019-02-05 21:32:07 -05:00
parent 9aed313ef2
commit 0f4681e9be
3 changed files with 28 additions and 62 deletions

View File

@@ -2771,10 +2771,8 @@
/**
* bind events to the node. KonvaJS supports mouseover, mousemove,
* mouseout, mouseenter, mouseleave, mousedown, mouseup, wheel, contextmenu, click, dblclick, touchstart, touchmove,
* touchend, tap, dbltap, dragstart, dragmove, and dragend events. The Konva Stage supports
* contentMouseover, contentMousemove, contentMouseout, contentMousedown, contentMouseup, contentWheel, contentContextmenu
* contentClick, contentDblclick, contentTouchstart, contentTouchmove, contentTouchend, contentTap,
* and contentDblTap. Pass in a string of events delimited by a space to bind multiple events at once
* touchend, tap, dbltap, dragstart, dragmove, and dragend events.
* Pass in a string of events delimited by a space to bind multiple events at once
* such as 'mousedown mouseup mousemove'. Include a namespace to bind an
* event by name such as 'click.foobar'.
* @method
@@ -4252,14 +4250,6 @@
Node.prototype._listenDrag = function () {
var that = this;
this._dragCleanup();
if (this.getClassName() === 'Stage') {
this.on('contentMousedown.konva contentTouchstart.konva', function (evt) {
if (!DD.node) {
that.startDrag();
}
});
}
else {
this.on('mousedown.konva touchstart.konva', function (evt) {
// ignore right and middle buttons
// TODO: should we add a global config for buttons?
@@ -4270,7 +4260,6 @@
that.startDrag();
}
});
}
};
Node.prototype._dragChange = function () {
if (this.attrs.draggable) {
@@ -4292,14 +4281,8 @@
}
};
Node.prototype._dragCleanup = function () {
if (this.getClassName() === 'Stage') {
this.off('contentMousedown.konva');
this.off('contentTouchstart.konva');
}
else {
this.off('mousedown.konva');
this.off('touchstart.konva');
}
};
/**
* create node with JSON string or an Object. De-serializtion does not generate custom

View File

@@ -514,10 +514,8 @@ export abstract class Node {
/**
* bind events to the node. KonvaJS supports mouseover, mousemove,
* mouseout, mouseenter, mouseleave, mousedown, mouseup, wheel, contextmenu, click, dblclick, touchstart, touchmove,
* touchend, tap, dbltap, dragstart, dragmove, and dragend events. The Konva Stage supports
* contentMouseover, contentMousemove, contentMouseout, contentMousedown, contentMouseup, contentWheel, contentContextmenu
* contentClick, contentDblclick, contentTouchstart, contentTouchmove, contentTouchend, contentTap,
* and contentDblTap. Pass in a string of events delimited by a space to bind multiple events at once
* touchend, tap, dbltap, dragstart, dragmove, and dragend events.
* Pass in a string of events delimited by a space to bind multiple events at once
* such as 'mousedown mouseup mousemove'. Include a namespace to bind an
* event by name such as 'click.foobar'.
* @method
@@ -2159,13 +2157,6 @@ export abstract class Node {
this._dragCleanup();
if (this.getClassName() === 'Stage') {
this.on('contentMousedown.konva contentTouchstart.konva', function(evt) {
if (!DD.node) {
that.startDrag();
}
});
} else {
this.on('mousedown.konva touchstart.konva', function(evt) {
// ignore right and middle buttons
// TODO: should we add a global config for buttons?
@@ -2177,7 +2168,6 @@ export abstract class Node {
}
});
}
}
_dragChange() {
if (this.attrs.draggable) {
@@ -2200,14 +2190,9 @@ export abstract class Node {
}
_dragCleanup() {
if (this.getClassName() === 'Stage') {
this.off('contentMousedown.konva');
this.off('contentTouchstart.konva');
} else {
this.off('mousedown.konva');
this.off('touchstart.konva');
}
}
preventDefault: GetSet<boolean, this>;

View File

@@ -7,8 +7,6 @@ import { GetSet, Vector2d } from './types';
import { Shape } from './Shape';
import { BaseLayer } from './BaseLayer';
// TODO: remove "content" events from docs
// CONSTANTS
var STAGE = 'Stage',
STRING = 'string',