fix: prevent nested flicking (direction-based)#222
fix: prevent nested flicking (direction-based)#222gyutato wants to merge 8 commits intonaver:masterfrom
Conversation
packages/axes/src/InputObserver.ts
Outdated
| !this.options.nested || | ||
| !this._isEndofAxis(offset, depaPos, destPos) || | ||
| /* 부모 전파 중단 조건 중, 최초 동작 축(방향)과 동일한 축인지 확인하는 조건 추가 */ | ||
| !isSameAxis |
There was a problem hiding this comment.
isSameAxis 조건이 닿는지, 닿더라도 항상 true인지 확인해보시면 좋을 것 같아요.
자식이 양방향 드래그로 설정되어 있는 경우도 고려하시면 좋을 것 같아요.
There was a problem hiding this comment.
@daybrush 제가 의도했던 '같은 축' 판단 조건은 다음과 같습니다:
- 최초 flicking 방향 (
primary) 이 없으면 무조건false - 최초 방향이
HORIZONTAL인 경우, 현재 input 의input.axes가 가로 단일 축일 때만true - 최초 방향이
VERTICAL인 경우, 현재 input 의input.axes가 세로 단일 축일 때만true
isSameAxis 가 항상 true 일 것이라고는 예상하지 못했는데, 혹시 제가 놓친 지점이 있는 것인지 확인 부탁드립니다!
There was a problem hiding this comment.
connect(["x", y"]) // both
connect(["", "y") // vertical
connect(["x", ""]) // horizontal
아마도 PanInput에서 관련없는 방향의 offset을 0으로 만들어버릴거에요.
그리고 offset이 0이면 위에서 거르는 조건이 있을거에요.
그러다보니까 isSameAxis를 지나가는 거라면 이미 같은 방향이라고 보고 있습니다
| panEvent.preventSystemEvent = prevent; | ||
| /* 부모에게 전달되는 네이티브 이벤트 객체(srcEvent)에 방향 정보 추가 */ | ||
| if (this._primaryDirection !== DIRECTION_NONE && panEvent && panEvent.srcEvent) { | ||
| (panEvent.srcEvent as any).__axesPrimaryDirection = this._primaryDirection; |
There was a problem hiding this comment.
자식에서도 설저할 수 있지만 부모에서도 바로 변경이 될 수 있어서 1번만 설정할 수 있게 하시는게 좋을 것 같아요.
피드백 (d4eae16)기존 구조 설명
수정 제안
Todos
|
packages/axes/src/InputObserver.ts
Outdated
| !this._moveDistance | ||
| !this._moveDistance || | ||
| /* 인터랙션 종료 시점에서도, 축 방향 확인을 위한 가드 추가 */ | ||
| !this._isSameAxisWithPrimary(nativeEvent, input) |
There was a problem hiding this comment.
부모도 일단 시작은 발생했기 때문에 릴리즈가 발생해야될 것 같습니다.
|
@daybrush 리뷰 요청드립니다. Issuehttps://oss.navercorp.com/egjs/work/issues/2127 Details
작업 예정 사항
|
Issue
https://oss.navercorp.com/egjs/work/issues/2127
Details
리뷰 요청 사항
PanInput,InputObserver)InputObserver.change,InputObserver.release)