Skip to content

Commit e602a3d

Browse files
Add touch-action utilities (#5603)
Co-Authored-By: Mattèo Gauthier <[email protected]> Co-authored-by: Mattèo Gauthier <[email protected]>
1 parent 2959b83 commit e602a3d

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

src/corePlugins.js

+15
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,21 @@ export default {
775775

776776
cursor: createUtilityPlugin('cursor'),
777777

778+
touchAction: ({ addUtilities }) => {
779+
addUtilities({
780+
'.touch-auto': { 'touch-action': 'auto' },
781+
'.touch-none': { 'touch-action': 'none' },
782+
'.touch-pan-x': { 'touch-action': 'pan-x' },
783+
'.touch-pan-left': { 'touch-action': 'pan-left' },
784+
'.touch-pan-right': { 'touch-action': 'pan-right' },
785+
'.touch-pan-y': { 'touch-action': 'pan-y' },
786+
'.touch-pan-up': { 'touch-action': 'pan-up' },
787+
'.touch-pan-down': { 'touch-action': 'pan-down' },
788+
'.touch-pinch-zoom': { 'touch-action': 'pinch-zoom' },
789+
'.touch-manipulation': { 'touch-action': 'manipulation' },
790+
})
791+
},
792+
778793
userSelect: ({ addUtilities }) => {
779794
addUtilities({
780795
'.select-none': { 'user-select': 'none' },

tests/basic-usage.test.css

+6
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@
299299
.cursor-pointer {
300300
cursor: pointer;
301301
}
302+
.touch-pan-y {
303+
touch-action: pan-y;
304+
}
305+
.touch-manipulation {
306+
touch-action: manipulation;
307+
}
302308
.select-none {
303309
user-select: none;
304310
}

tests/basic-usage.test.html

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
<div class="clear-left"></div>
4040
<div class="container"></div>
4141
<div class="cursor-pointer"></div>
42+
<div class="touch-pan-y touch-manipulation"></div>
4243
<div class="hidden inline-grid"></div>
4344
<div class="divide-gray-200"></div>
4445
<div class="divide-opacity-50"></div>

0 commit comments

Comments
 (0)