Skip to content

Commit

Permalink
Merge pull request #25 from JuliaPlots/sd/canvas_resize
Browse files Browse the repository at this point in the history
resize canvas when scene size changes
  • Loading branch information
SimonDanisch committed Feb 20, 2020
2 parents f71f942 + 48e3fdf commit 94d165f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/WGLMakie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ function three_display(session::Session, scene::Scene)
document.addEventListener("keyup", keyup, false);
}"""
)
canvas_width = lift(x-> [round.(Int, widths(x))...], pixelarea(scene))
onjs(session, canvas_width, js"""function update_size(canvas_width){
var w_h = deserialize_js(canvas_width);
$(renderer).setSize(w_h[0], w_h[1]);
var canvas = $(canvas)
canvas.style.width = w_h[0];
canvas.style.height = w_h[1];
}""")
connect_scene_events!(session, scene, comm)
mousedrag(scene, nothing)
three = ThreeDisplay(threemod, renderer, window)
Expand Down

0 comments on commit 94d165f

Please sign in to comment.