Git Product home page Git Product logo

Comments (4)

artvichi avatar artvichi commented on June 19, 2024 1

@vidaaudrey thanks for quick response! We have some redux storage which is filled during time (up to one minute) with ROS data. Then we want to allow relocalize a robot with drag&drop + rotate, so user can interact with robot component with mouse multiple times drag&drop + rotation. Looks like it may work for us, will check and let you know!

from webviz.

vidaaudrey avatar vidaaudrey commented on June 19, 2024

Hi @artvichi thank you for filing the issue. The quick way to fix it is to remount Worldview whenever the camaraState changes between controlled and uncontrolled:

 const onCameraStateChange = useCallback(newCamState => {
    setCameraState(newCamState);
  }, []);

  // use key to mount a different Worldview when it changed between controlled and uncontrolled
  const camProps = shouldNotMoveCam
    ? { cameraState, key: 0 }
    : {
        cameraState,
        onCameraStateChange,
        key: 1
      };
  return (<Worldview {...camProps}> </Worldview>);

Codesandbox link.

Currently we are not expecting people to switch between controlled and uncontrolled very often. So the camera set up only happens once during the component life cycle. I'm curious what's your use case and how frequent is the switch? If that's a common case, we might update the Worldview internally to support it.

from webviz.

janpaul123 avatar janpaul123 commented on June 19, 2024

@artvichi did this end up working? Btw, I'm trying to get to know our open source community better, and would love to learn more about what you use Worldview/Webviz for. Could you perhaps shoot me an email at [email protected]?

from webviz.

EnkeyMC avatar EnkeyMC commented on June 19, 2024

I had the same problem, my workaround is using ref for the condition in the handler.

...
const [disableCamera, setDisableCamera] = useState(false);
const disableCameraRef = useRef(false);
disableCameraRef.current = disableCamera;
...

return <Worldview 
        ... 
        onCameraStateChange={state => !disableCameraRef.current && setCameraState(state) }
    ></Worldview>

from webviz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.