new tap event. touchmove no longer incorrectly fires onmousemove event. dbltap now correctly bubbles. cleaned up some other event handling logic.

This commit is contained in:
Eric Rowell
2012-06-01 00:44:38 -07:00
parent 84e400e0f0
commit ba796f4cc3
5 changed files with 151 additions and 116 deletions

View File

@@ -487,7 +487,7 @@ Test.prototype.tests = {
layer.add(redBox);
stage.add(layer);
},
'EVENTS - mousedown mouseup mouseover mouseout click dblclick / touchstart touchend dbltap': function(containerId) {
'EVENTS - mousedown mouseup mouseover mouseout mousemove click dblclick / touchstart touchend touchmove tap dbltap': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,
@@ -500,8 +500,7 @@ Test.prototype.tests = {
radius: 70,
fill: 'red',
stroke: 'black',
strokeWidth: 4,
draggable: true
strokeWidth: 4
});
circle.on('mousedown', function() {
@@ -512,14 +511,6 @@ Test.prototype.tests = {
log('mouseup');
});
circle.on('touchstart', function() {
log('touchstart');
});
circle.on('touchend', function() {
log('touchend');
});
circle.on('mouseover', function() {
log('mouseover');
});
@@ -528,6 +519,10 @@ Test.prototype.tests = {
log('mouseout');
});
circle.on('mousemove', function() {
log('mousemove');
});
circle.on('click', function() {
log('click');
});
@@ -535,13 +530,31 @@ Test.prototype.tests = {
circle.on('dblclick', function() {
log('dblclick');
});
/*
* mobile
*/
circle.on('touchstart', function() {
log('touchstart');
});
circle.on('touchend', function() {
log('touchend');
});
circle.on('touchmove', function() {
log('touchmove');
});
circle.on('tap', function(evt) {
log('tap');
});
circle.on('dbltap', function() {
log('dbltap');
});
layer.add(circle);
stage.add(layer);
stage.add(layer);
},
'EVENTS - modify fill stroke and stroke width on hover with circle': function(containerId) {
var stage = new Kinetic.Stage({
@@ -1234,7 +1247,7 @@ Test.prototype.tests = {
if(trans) {
trans.stop();
}
star.setAttrs({
shadow: {
offset: {
@@ -1369,18 +1382,18 @@ Test.prototype.tests = {
draggable: true,
dragConstraint: 'horizontal',
/*
dragBounds: {
left: 100
}
*/
dragBounds: {
left: 100
}
*/
});
var layer = new Kinetic.Layer({
/*
draggable: true,
dragBounds: {
left: 100
}
*/
/*
draggable: true,
dragBounds: {
left: 100
}
*/
});
var circle = new Kinetic.Circle({
x: stage.getWidth() / 2,
@@ -1391,23 +1404,23 @@ Test.prototype.tests = {
strokeWidth: 4,
//draggable: true,
/*
dragBounds: {
left: 100
}
*/
dragBounds: {
left: 100
}
*/
});
//stage.draggable(false);
//layer.draggable(false);
stage.on('dragstart', function() {
console.log('dragstart');
console.log('dragstart');
});
stage.on('dragmove', function() {
//console.log('dragmove');
//console.log('dragmove');
});
stage.on('dragend', function() {
console.log('dragend');
console.log('dragend');
});
layer.add(circle);