mirror of
https://github.com/konvajs/konva.git
synced 2026-01-09 11:34:38 +08:00
remove some content events usage
This commit is contained in:
21
konva.js
21
konva.js
@@ -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
|
||||
|
||||
19
src/Node.ts
19
src/Node.ts
@@ -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>;
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user