From a5985ef5cf13d135954f8435a9a2e88f0b420e2d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net>
Date: Thu, 28 Apr 2022 15:17:44 +0200
Subject: [PATCH] implements #16

---
 src/wgl.jl | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/wgl.jl b/src/wgl.jl
index ea16c8c..8a3d87e 100644
--- a/src/wgl.jl
+++ b/src/wgl.jl
@@ -127,8 +127,8 @@ struct AssayPlot
     homebutton::HomeButton
 end
 
-function AssayPlot(ctrl, larvae::DecoratedLarvae)
-    fig = Figure()
+function AssayPlot(ctrl, larvae::DecoratedLarvae; size=(1000, 750))
+    fig = Figure(resolution=size)
     ax = Axis(fig.layout[1, 1], aspect=DataAspect())
     larvaplot!(ax, larvae)
     setbounds!(ax, ctrl, larvae)
@@ -139,21 +139,22 @@ function AssayPlot(ctrl, larvae::DecoratedLarvae)
     AssayPlot(ctrl, fig, ax, larvae, button)
 end
 
-function AssayPlot(ctrl, larvae::Vector{LarvaModel})
+function AssayPlot(ctrl, larvae::Vector{LarvaModel}; kwargs...)
     sample = downsampler()
     plot = AssayPlot(ctrl,
                      DecoratedLarvae(sample.(larvae),
                                      gettags(ctrl),
-                                     gettimestep(ctrl)))
+                                     gettimestep(ctrl));
+                     kwargs...)
     return plot
 end
 
-function AssayPlot(ctrl, larvae::Dict{LarvaID, LarvaModel}, args...)
-    AssayPlot(ctrl, collect(values(larvae)), args...)
+function AssayPlot(ctrl, larvae::Dict{LarvaID, LarvaModel}, args...; kwargs...)
+    AssayPlot(ctrl, collect(values(larvae)), args...; kwargs...)
 end
 
-function assayplot(data, ctrl)
-    plot = AssayPlot(ctrl, data)
+function assayplot(data, ctrl; kwargs...)
+    plot = AssayPlot(ctrl, data; kwargs...)
     setmouseevents!(plot; consume=true)
     return plot
 end
@@ -178,9 +179,9 @@ struct TrackPlot
     homebutton::HomeButton
 end
 
-function TrackPlot(controller, larvae::Vector{LarvaModel})
+function TrackPlot(controller, larvae::Vector{LarvaModel}; size=(1000, 750))
     view = SingleLarvaView(larvae, controller)
-    fig = Figure()
+    fig = Figure(resolution=size)
     ax = Axis(fig.layout[1, 1], aspect=DataAspect())
     larvaplot!(ax, view)
     setbounds!(ax, controller, larvae)
@@ -201,9 +202,9 @@ function TrackPlot(controller, larvae::Vector{LarvaModel})
     TrackPlot(controller, fig, ax, larvae, view, button)
 end
 
-TrackPlot(ctrl, model::Dict{<:Integer, LarvaModel}, args...) = TrackPlot(ctrl, collect(values(model)), args...)
+TrackPlot(ctrl, model::Dict{<:Integer, LarvaModel}, args...; kwargs...) = TrackPlot(ctrl, collect(values(model)), args...; kwargs...)
 
-trackplot(model, controller) = TrackPlot(controller, model)
+trackplot(model, controller; kwargs...) = TrackPlot(controller, model; kwargs...)
 
 function JSServe.jsrender(session::Session, p::TrackPlot)
     r(session,
-- 
GitLab