Skip to content

Wheel event registered on the canvas even though scrollZoom is disabled #6458

Closed
@zfei

Description

@zfei

I'm plotting a 3d surface graph with scrollZoom disabled.

When scrolling the web page with the mouse on the canvas, the scrolling gets stuck, as the scene element is stilling capturing the wheel event somehow.

After some debugging, it looks like the culprit is we are registering a wheel event on the canvas regardless of whether the scrollZoom flag is true or not.

Can we not add the listener at all if scrollzoom is disabled?

const newData = {};
const dates = new Set();

timeseriesList.map((row) => {
    newData[row.symbol] = row.data;
    Object.keys(row.data).map(d => dates.add(d))
})

const dateArray = Array.from(dates);

var data = [{
    x: dateArray,
    y: symbols,
    z: symbols.map(symbol => dateArray.map(date => newData[symbol][date])),
    type: 'surface',
    colorscale: 'Portland',
}];
var layout = {
    title: title,
    autosize: true,
    height: 500,
    margin: {
        l: 65,
        r: 50,
        b: 65,
        t: 90,
    },
    scene: {
        xaxis: {
            calendar: 'chinese',
            autorange: 'reversed',
        },
        yaxis: {
            autorange: 'reversed',
        },
        aspectratio: { x: 4, y: 1, z: 1.5 },
        camera: {
            eye: { x: 0, y: 2, z: 0 },
            projection: {type: 'orthographic'},
        },
    },
};
Plotly.newPlot(
    container,
    data,
    layout,
    {
        // TODO: Need to unregister scroll event. Currently page scroll doesn't work.
        scrollZoom: false,
    },
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions