Mapbox-gl-js: Move towards the reverse direction after drag a long distance

Created on 20 Nov 2019  路  1Comment  路  Source: mapbox/mapbox-gl-js

mapbox-gl-js version: 1.4.1 (I guess almost every version has this issue)

browser: Chrome 78
platform: Windows 10

Steps to Trigger Behavior

  1. Drag fast from bottom to top at some angle (It won`t happen when you just drag a short distance or at no angle)

    Link to Demonstration

bug

Expected Behavior

move towards the right direction

Actual Behavior

move towards the right direction at the first moment
and then move towards reverse direction till stop moving

bug

Most helpful comment

I've noticed the same bug while working on the LOD support #8975. I don't have a production ready fix for this but the cause is well known.

We're applying inertia to the mouse cursor and with fast enough mouse movement this can fling the cursor way above the screen. When this behavior is combined with bigger pitch angles the flinged position might end up being above the horizon (ie. ray cast towards this point will never hit the ground when travelling forward). This will result in intersections being reported somewhere "behind" they ray (t < 0) causing the inverse movement direction.

>All comments

I've noticed the same bug while working on the LOD support #8975. I don't have a production ready fix for this but the cause is well known.

We're applying inertia to the mouse cursor and with fast enough mouse movement this can fling the cursor way above the screen. When this behavior is combined with bigger pitch angles the flinged position might end up being above the horizon (ie. ray cast towards this point will never hit the ground when travelling forward). This will result in intersections being reported somewhere "behind" they ray (t < 0) causing the inverse movement direction.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PBrockmann picture PBrockmann  路  3Comments

iamdenny picture iamdenny  路  3Comments

aderaaij picture aderaaij  路  3Comments

samanpwbb picture samanpwbb  路  3Comments

BernhardRode picture BernhardRode  路  3Comments