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

WGLMakie error in window event callback #3517

Closed
kbarros opened this issue Dec 27, 2023 · 0 comments · Fixed by #3522
Closed

WGLMakie error in window event callback #3517

kbarros opened this issue Dec 27, 2023 · 0 comments · Fixed by #3522
Labels
bug WGLMakie This relates to WGLMakie.jl, the Web-based WebGL backend for Makie.

Comments

@kbarros
Copy link
Contributor

kbarros commented Dec 27, 2023

Execute the following code:

using WGLMakie
zs = LinRange(0, 3, 20)
xs = cos.(5zs)
ys = sin.(5zs)
fig = meshscatter(xs, ys, zs, markersize = 0.1, color = zs)
DataInspector(fig)
fig
  • From the terminal, this will launch a browser tab with the 3D scene, but interactive controls are lost (for example, mouse-drag will not rotate).

  • From a VSCode window, this will open a new tab with the 3D scene, interactive controls are broken in a different way, and Julia reports the following error:

┌ Warning: Error in window event callback
│   exception =
│    Session is not open and would result in this function to indefinitely block.
│            It may unblock, if the browser is still connecting and opening the session later on. If this is expected,
│            you may try setting `error_on_closed=false`
│    Stacktrace:
│      [1] error(s::String)
│        @ Base ./error.jl:35
│      [2] evaljs_value(session::JSServe.Session{JSServe.WebSocketConnection}, js::JSServe.JSCode; error_on_closed::Bool, timeout::Float64)
│        @ JSServe ~/.julia/packages/JSServe/BRpDB/src/session.jl:246
│      [3] evaljs_value(session::JSServe.Session{JSServe.WebSocketConnection}, js::JSServe.JSCode)
│        @ JSServe ~/.julia/packages/JSServe/BRpDB/src/session.jl:243
│      [4] pick_sorted(scene::Scene, screen::WGLMakie.Screen, xy::Point{2, Float32}, range::Int64)
│        @ WGLMakie ~/.julia/packages/WGLMakie/XT8NJ/src/picking.jl:53
│      [5] pick_sorted(scene::Scene, xy::Point{2, Float32}, range::Int64)
│        @ Makie ~/.julia/packages/Makie/Qvk4f/src/interaction/interactive_api.jl:124
│      [6] on_hover(inspector::DataInspector)
│        @ Makie ~/.julia/packages/Makie/Qvk4f/src/interaction/inspector.jl:304
│      [7] (::Makie.var"#1236#1240"{DataInspector})(::Tuple{Float64, Float64})
│        @ Makie ~/.julia/packages/Makie/Qvk4f/src/interaction/inspector.jl:280
│      [8] #invokelatest#2
│        @ Base ./essentials.jl:887 [inlined]
│      [9] invokelatest
│        @ Base ./essentials.jl:884 [inlined]
│     [10] notify
│        @ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206 [inlined]
│     [11] setindex!(observable::Observable, val::Any)
│        @ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:123
│     [12] (::WGLMakie.var"#56#58"{Dict{Any, Any}, Scene, Events})()
│        @ WGLMakie ~/.julia/packages/WGLMakie/XT8NJ/src/events.jl:57
└ @ WGLMakie ~/.julia/packages/WGLMakie/XT8NJ/src/events.jl:109

The following modified code responds to events correctly, however:

using WGLMakie
begin
    zs = LinRange(0, 3, 20)
    xs = cos.(5zs)
    ys = sin.(5zs)
    fig = meshscatter(xs, ys, zs, markersize = 0.1, color = zs)
    DataInspector(fig)
    fig
end

The key difference seems to be that the modified code does not call display on the DataInspector.

@kbarros kbarros added the bug label Dec 27, 2023
@SimonDanisch SimonDanisch added the WGLMakie This relates to WGLMakie.jl, the Web-based WebGL backend for Makie. label Dec 28, 2023
SimonDanisch added a commit that referenced this issue Dec 29, 2023
SimonDanisch added a commit that referenced this issue Dec 29, 2023
* cleanup three display and fix #3517

* fix delete

* fix #3503
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug WGLMakie This relates to WGLMakie.jl, the Web-based WebGL backend for Makie.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants