mirror of
https://github.com/konvajs/konva.git
synced 2025-04-05 20:48:28 +08:00
prevent default now occurs in the stage addEvent method
This commit is contained in:
parent
324d841ed4
commit
244273eb4c
@ -38,13 +38,6 @@
|
|||||||
this.element.style.background = 'transparent';
|
this.element.style.background = 'transparent';
|
||||||
this.context = this.element.getContext(contextType);
|
this.context = this.element.getContext(contextType);
|
||||||
this.setSize(width, height);
|
this.setSize(width, height);
|
||||||
|
|
||||||
this.element.addEventListener('mousedown', function(evt) {
|
|
||||||
evt.preventDefault();
|
|
||||||
});
|
|
||||||
this.element.addEventListener('touchstart', function(evt) {
|
|
||||||
evt.preventDefault();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* get canvas element
|
* get canvas element
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
INLINE_BLOCK = 'inline-block',
|
INLINE_BLOCK = 'inline-block',
|
||||||
KINETICJS_CONTENT = 'kineticjs-content',
|
KINETICJS_CONTENT = 'kineticjs-content',
|
||||||
SPACE = ' ',
|
SPACE = ' ',
|
||||||
|
UNDERSCORE = '_',
|
||||||
CONTAINER = 'container',
|
CONTAINER = 'container',
|
||||||
EVENTS = [MOUSEDOWN, MOUSEMOVE, MOUSEUP, MOUSEOUT, TOUCHSTART, TOUCHMOVE, TOUCHEND],
|
EVENTS = [MOUSEDOWN, MOUSEMOVE, MOUSEUP, MOUSEOUT, TOUCHSTART, TOUCHMOVE, TOUCHEND],
|
||||||
|
|
||||||
@ -31,7 +32,8 @@
|
|||||||
|
|
||||||
function addEvent(ctx, eventName) {
|
function addEvent(ctx, eventName) {
|
||||||
ctx.content.addEventListener(eventName, function(evt) {
|
ctx.content.addEventListener(eventName, function(evt) {
|
||||||
ctx['_' + eventName](evt);
|
evt.preventDefault();
|
||||||
|
ctx[UNDERSCORE + eventName](evt);
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,8 +453,6 @@
|
|||||||
obj = this.getIntersection(this.getPointerPosition()),
|
obj = this.getIntersection(this.getPointerPosition()),
|
||||||
shape;
|
shape;
|
||||||
|
|
||||||
evt.preventDefault();
|
|
||||||
|
|
||||||
if(obj && obj.shape) {
|
if(obj && obj.shape) {
|
||||||
shape = obj.shape;
|
shape = obj.shape;
|
||||||
this.tapStart = true;
|
this.tapStart = true;
|
||||||
@ -504,8 +504,6 @@
|
|||||||
obj = this.getIntersection(this.getPointerPosition()),
|
obj = this.getIntersection(this.getPointerPosition()),
|
||||||
shape;
|
shape;
|
||||||
|
|
||||||
evt.preventDefault();
|
|
||||||
|
|
||||||
if(obj && obj.shape) {
|
if(obj && obj.shape) {
|
||||||
shape = obj.shape;
|
shape = obj.shape;
|
||||||
shape._fireAndBubble(TOUCHMOVE, evt);
|
shape._fireAndBubble(TOUCHMOVE, evt);
|
||||||
|
@ -16,5 +16,5 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body onmousedown="return false;"></body>
|
<body></body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user