-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1843 from Polymer/fix-drag-selection
Allow user prevention of `tap` and `track` gestures from `down`
- Loading branch information
Showing
6 changed files
with
184 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<link rel="import" href="../../polymer.html"> | ||
|
||
<dom-module id="x-gestures"> | ||
<template> | ||
<style> | ||
#inner { | ||
height: 20px; | ||
width: 20px; | ||
background: blue; | ||
} | ||
#prevent { | ||
height: 20px; | ||
width: 20px; | ||
background: red; | ||
} | ||
</style> | ||
<div id="prevent" on-down="preventTap"></div> | ||
<a href="#" on-click="linkclick" on-touchend="removeLink">LINK</a> | ||
<div id="inner" on-tap="divtap"></div> | ||
</template> | ||
</dom-module> | ||
<script> | ||
Polymer({ | ||
is: 'x-gestures', | ||
listeners: { | ||
'tap': 'logger', | ||
'down': 'logger', | ||
'up': 'logger', | ||
'click': 'logger', | ||
'track': 'track' | ||
}, | ||
preventTap: function(e, detail) { | ||
detail.prevent('tap'); | ||
detail.prevent('track'); | ||
e.preventDefault(); | ||
}, | ||
logger: function(e, detail) { | ||
console.log(e.type); | ||
console.log(detail); | ||
}, | ||
track: function(e, detail) { | ||
this.logger(e, detail); | ||
if (detail.state === 'end') { | ||
console.log(detail.hover()); | ||
} | ||
}, | ||
linkclick: function(e) { | ||
console.log('CLICK!'); | ||
}, | ||
removeLink: function(e) { | ||
console.log('REMOVE!'); | ||
e.target.remove(); | ||
}, | ||
divtap: function(e) { | ||
console.log('div tap!'); | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters