chore(touch): add isVertical/isHorizontal

This commit is contained in:
chenjiahan
2020-09-14 20:56:28 +08:00
parent 46e158fa01
commit c8d573cbe7
7 changed files with 18 additions and 12 deletions
+3 -3
View File
@@ -57,7 +57,6 @@ export default createComponent({
});
const touch = useTouch();
const { deltaY, direction } = touch;
const getHeadStyle = () => {
if (props.headHeight !== DEFAULT_HEAD_HEIGHT) {
@@ -150,9 +149,10 @@ export default createComponent({
checkPosition(event);
}
const { deltaY } = touch;
touch.move(event);
if (reachTop && deltaY.value >= 0 && direction.value === 'vertical') {
if (reachTop && deltaY.value >= 0 && touch.isVertical()) {
preventDefault(event);
setStatus(ease(deltaY.value));
}
@@ -160,7 +160,7 @@ export default createComponent({
};
const onTouchEnd = () => {
if (reachTop && deltaY.value && isTouchable()) {
if (reachTop && touch.deltaY.value && isTouchable()) {
state.duration = props.animationDuration;
if (state.status === 'loosing') {