mirror of
https://github.com/konvajs/konva.git
synced 2026-01-08 18:54:40 +08:00
remove some content events usage
This commit is contained in:
43
src/Node.ts
43
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,24 +2157,16 @@ 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?
|
||||
if (evt.evt.button === 1 || evt.evt.button === 2) {
|
||||
return;
|
||||
}
|
||||
if (!DD.node) {
|
||||
that.startDrag();
|
||||
}
|
||||
});
|
||||
}
|
||||
this.on('mousedown.konva touchstart.konva', function(evt) {
|
||||
// ignore right and middle buttons
|
||||
// TODO: should we add a global config for buttons?
|
||||
if (evt.evt.button === 1 || evt.evt.button === 2) {
|
||||
return;
|
||||
}
|
||||
if (!DD.node) {
|
||||
that.startDrag();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_dragChange() {
|
||||
@@ -2200,13 +2190,8 @@ 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');
|
||||
}
|
||||
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