Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double clicking to edit sketch while moving the mouse can hide the client side scene (aka white screen) #4823

Open
JordanNoone opened this issue Dec 16, 2024 · 1 comment
Labels
bug Something isn't working coredump Issues that contain a coredump. desktop-app Issues from the desktop app.

Comments

@JordanNoone
Copy link
Contributor

[Add a title above and insert a description of the issue here]

Screenshot

Core Dump

coredump-2ca683b8-cb5d-4ffc-9f08-379988480fc4.json

Reference ID: 2ca683b8-cb5d-4ffc-9f08-379988480fc4

KCL Code
sketch001 = startSketchOn('XZ')
  |> startProfileAt([0, 0], %)
  |> line([3.14, 3.14], %)
  |> line([3.14, 3.14], %)
  |> line([3.14, 3.14], %)

@JordanNoone JordanNoone added bug Something isn't working coredump Issues that contain a coredump. desktop-app Issues from the desktop app. labels Dec 16, 2024
@nadr0 nadr0 changed the title white Double clicking to edit sketch while moving the mouse can hide the client side scene (aka white screen) Dec 17, 2024
@nadr0
Copy link
Collaborator

nadr0 commented Dec 17, 2024

The bug should be related to this block of code, below you can see the variable hideClient. This is the problematic state that can get into a bad value. Will be debugging this and fixing it.

In ClientSideSceneComp.tsx

function useShouldHideScene(): { hideClient: boolean; hideServer: boolean } {
  const [isCamMoving, setIsCamMoving] = useState(false)
  const [isTween, setIsTween] = useState(false)

  const { state } = useModelingContext()

  useEffect(() => {
    sceneInfra.camControls.setIsCamMovingCallback((isMoving, isTween) => {
      setIsCamMoving(isMoving)
      setIsTween(isTween)
    })
  }, [])

  if (DEBUG_SHOW_BOTH_SCENES || !isCamMoving)
    return { hideClient: false, hideServer: false }
  let hideServer = state.matches('Sketch')
  if (isTween) {
    hideServer = false
  }

  return { hideClient: !hideServer, hideServer }
}
  return (
    <>
      <div
        ref={canvasRef}
        style={{ cursor: cursor }}
        data-testid="client-side-scene"
        className={`absolute inset-0 h-full w-full transition-all duration-300 ${
          hideClient ? 'opacity-0' : 'opacity-100'
        } ${hideServer ? 'bg-chalkboard-10 dark:bg-chalkboard-100' : ''} ${
          !hideClient && !hideServer && state.matches('Sketch')
            ? 'bg-chalkboard-10/80 dark:bg-chalkboard-100/80'
            : ''
        }`}
      ></div>
      <Overlays />
    </>
  )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working coredump Issues that contain a coredump. desktop-app Issues from the desktop app.
Projects
None yet
Development

No branches or pull requests

2 participants