Skip to content

Zoom doesn't work if not enough pixels are selected on X axis #4156

Description

@TheJavaGuy

For some reason, zoom doesn't work if we don't highlight enough pixels over X axis.

Example of unsuccessful zoom:
plotly_zoom_bug_1

Example of successful zoom:
plotly_zoom_bug_2

Code is at https://codepen.io/etpinard/pen/pLOMXR

Activity

  1. etpinard commented on Aug 29, 2019

    @etpinard
    Contributor

    Thanks for reporting!

  2. etpinard commented on Sep 5, 2019

    @etpinard
    Contributor

    The problem is with the block:

    // more strict than dragged, which allows you to come back to where you started
    // and still count as dragged
    if(Math.min(box.h, box.w) < MINDRAG * 2) {
    return removeZoombox(gd);
    }

    which removes the zoombox and skips the relayout call on drag-end when the zoombox width or height is less than 16px (as MINDRAG:=8).

    During drag, there's some logic around MINZOOM (set to 20px), but still, there are ways to have a zoombox passing MINZOOM requirements, but that have Math.min(box.h, box.w) < MINDRAG * 2, as reported in this issue.

    The easiest way to fix this bug, seems to simply move the problematic removeZoombox block from the zoomDone to the zoomMove handler.

    Alternatively, we could simply remove the problematic removeZoombox block, allowing for smaller zoom boxes relayouts. At first try, this doesn't appear to lead to any undesired effects.

  3. self-assigned this
    on Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsomething broken

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions