plotly / plotly/plotly.js

Relayout not provided with event data after mousewheel zoom

Aperta
#6,798 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug P3
Lingua principale
JavaScript
Stelle
18.3k
Fork
2k
Merge medio
2g 12h
PR unite (30g)
28

Descrizione

This may well be related to #5698, but that is a few years old and I'm not entirely sure this is the same behaviour, partly because that issue reports two things.

The mousewheel based zoom fires the plotly_relayout event, but after some interactions the event data is empty. When not empty it seems to lag behind what is being displayed.

Tested using the script below. After rotation with a click drag, the zoom with the mouse wheel scroll hits the "No scene data found" found the first time through, suggesting that the scene has not changed despite it changing visually on screen. The subsequent mouse wheel scrolls report the scene data. A single click, being careful not to drag, then reports a different value, suggesting the data provided by relayout on the mouse wheel scroll zoom is lagging behind the new scene position.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Zoom test</title>
    <script src="https://cdn.plot.ly/plotly-latest.js" charset="utf-8"></script>
</head>
<body>

<div id="3D_figure"></div>

<script>
        var data = [{
            type: "mesh3d",
            x: [0, 1, 2, 0],
            y: [0, 0, 1, 2],
            z: [0, 2, 0, 1],
            i: [0, 0, 0, 1],
            j: [1, 2, 3, 2],
            k: [2, 3, 1, 3],
            intensity: [0, 0.33, 0.66, 1],
            colorscale: [
              [0, 'rgb(255, 0, 0)'],
              [0.5, 'rgb(0, 255, 0)'],
              [1, 'rgb(0, 0, 255)']
            ]
        }];

        Plotly.newPlot('3D_figure', data, {});

        var top_level_div= document.getElementById('3D_figure');

        top_level_div.on('plotly_relayout', (data) => {
             if(( typeof data === 'undefined') || !('scene.camera' in data)){
                console.log("No scene data found");
             }else{
                console.log(data['scene.camera'].eye.x);
             }
        });
</script>
</body>
</html>

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo l’esempio HTML fornito e tracciando l’evento plotly_relayout durante lo zoom 3D con la rotellina del mouse, soprattutto dopo le interazioni di rotazione e clic. Confronta i dati scene.camera emessi con la posizione della fotocamera visualizzata sullo schermo. Il lavoro è completato quando l’evento segnala in modo coerente i dati aggiornati della fotocamera dopo ogni interazione di zoom, invece di valori vuoti o in ritardo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript
Ambito
data-visualization, frontend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.