plotly / react-plotly.js

A plotly.js React component from Plotly 📈
MIT License
1.01k stars 135 forks source link

onDoubleClick does not work in 3D mesh #324

Closed ReinderVosDeWael closed 1 year ago

ReinderVosDeWael commented 1 year ago

Given the code below, I would expect a double click on both the mesh3d as well as the line plot to trigger the console.log(ondoubleclick). However, double clicks on mesh3d do not trigger the double click callback. Is this a bug? How would I make double click work in the 3d mesh?

import Plot from "react-plotly.js";

export const App = () => {
  var intensity = [
    0,
    0.14285714285714285,
    0.2857142857142857,
    0.42857142857142855,
    0.5714285714285714,
    0.7142857142857143,
    0.8571428571428571,
    1
  ];
  const dataMesh = [
    {
      type: "mesh3d",
      x: [0, 0, 1, 1, 0, 0, 1, 1],
      y: [0, 1, 1, 0, 0, 1, 1, 0],
      z: [0, 0, 0, 0, 1, 1, 1, 1],
      i: [7, 0, 0, 0, 4, 4, 6, 6, 4, 0, 3, 2],
      j: [3, 4, 1, 2, 5, 6, 5, 2, 0, 1, 6, 3],
      k: [0, 7, 2, 3, 6, 7, 1, 1, 5, 5, 7, 6],
      intensity: intensity
    }
  ];
  const dataLine = [
    {
      x: [1, 2, 3, 4, 5],
      y: [1, 2, 4, 8, 16]
    }
  ];
  return (
    <>
      <Plot
        data={dataMesh}
        onClick={() => {
          console.log("onclick");
        }}
        onDoubleClick={() => {
          console.log("ondoubleclick");
        }}
      />
      <Plot
        data={dataLine}
        onClick={() => {
          console.log("onclick");
        }}
        onDoubleClick={() => {
          console.log("ondoubleclick");
        }}
      />
    </>
  );
};
ReinderVosDeWael commented 1 year ago

Moved issue to https://github.com/plotly/plotly.js/issues/6658