main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 2 weeks ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
637 bytes
|
Line | |
---|
1 | import { CommonGestureState } from '../types'
|
---|
2 |
|
---|
3 | // _movement rolls back to when it passed the bounds.
|
---|
4 | /**
|
---|
5 | * @note code is currently used in WheelEngine and PinchEngine.
|
---|
6 | */
|
---|
7 | export function clampStateInternalMovementToBounds(state: CommonGestureState) {
|
---|
8 | const [ox, oy] = state.overflow
|
---|
9 | const [dx, dy] = state._delta
|
---|
10 | const [dirx, diry] = state._direction
|
---|
11 |
|
---|
12 | if ((ox < 0 && dx > 0 && dirx < 0) || (ox > 0 && dx < 0 && dirx > 0)) {
|
---|
13 | state._movement[0] = state._movementBound[0] as number
|
---|
14 | }
|
---|
15 |
|
---|
16 | if ((oy < 0 && dy > 0 && diry < 0) || (oy > 0 && dy < 0 && diry > 0)) {
|
---|
17 | state._movement[1] = state._movementBound[1] as number
|
---|
18 | }
|
---|
19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.