Skip to content

Commit c828048

Browse files
committed
resize plots without activating WGLMakie globally
1 parent a1e26c3 commit c828048

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

NetworkDynamicsInspector/assets/app.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ span {
2020
.maingrid {
2121
display: grid;
2222
grid-template-columns: min-content auto;
23+
align-items: start; /* make sure ts col is as short as possible for resize event */
2324
width: 100%;
2425
gap: 0px;
2526
}

NetworkDynamicsInspector/src/NetworkDynamicsInspector.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using NetworkDynamics: NetworkDynamics, SII, EIndex, VIndex, Network,
77
obssym, psym, sym, extract_nw
88

99
using Graphs: nv, ne
10-
using WGLMakie: WGLMakie
10+
using WGLMakie: WGLMakie, WithConfig
1111
using WGLMakie.Makie: Makie, @lift, MouseEvent, Point2f, with_theme,
1212
lines!, vlines!, Theme, Figure, Colorbar, Axis,
1313
xlims!, ylims!, autolimits!, hidespines!, hidedecorations!,
@@ -65,7 +65,6 @@ function get_webapp(app)
6565
@info "GUI Session updated"
6666
end
6767

68-
WGLMakie.activate!(resize_to=:parent)
6968
clear_obs!(app)
7069

7170
resize_gp = js"""

NetworkDynamicsInspector/src/graphplot.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ function graphplot_card(app, session)
220220
<li><strong>Ctrl + Click</strong> resets axis after zoom</li>
221221
</ul>
222222
""")
223-
Card([fig, help]; class="bonito-card graphplot-card")
223+
Card([WithConfig(fig; resize_to=:parent), help]; class="bonito-card graphplot-card")
224224
end
225225
function _gracefully_extract_states!(vec, sol, t, idxs, rel)
226226
isvalid(s) = SII.is_variable(sol, s) || SII.is_parameter(sol, s) || SII.is_observed(sol, s)
@@ -379,7 +379,7 @@ function gpstate_control_card(app, type)
379379

380380
childs = Any[DOM.div(
381381
selector,
382-
DOM.div(fig; style=Styles("height" => "40px")),
382+
DOM.div(WithConfig(fig; resize_to=:parent); style=Styles("height" => "40px")),
383383
# fig,
384384
# RoundedLabel(@lift $maxrange[1]; style=Styles("text-align"=>"right")),
385385
cslider,

NetworkDynamicsInspector/src/timeseries.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ function timeseries_card(app, key, session)
444444
card = Card(
445445
[DOM.div(
446446
comp_state_sel_dom,
447-
DOM.div(fig; class="timeseries-axis-container"),
447+
DOM.div(WithConfig(fig; resize_to=:parent); class="timeseries-axis-container"),
448448
closebutton(app, key);
449449
class="timeseries-card-container"
450450
), help];

0 commit comments

Comments
 (0)