@@ -13,7 +13,7 @@ mutable struct Scene <: AbstractScene
1313 events:: Events
1414
1515 px_area:: Node{IRect2D}
16- # plot_area::Node{IRect2D}
16+ clear :: Bool
1717
1818 camera:: Camera
1919 camera_controls:: RefValue
3636
3737Base. haskey (scene:: Scene , key:: Symbol ) = haskey (scene. attributes, key)
3838function Base. getindex (scene:: Scene , key:: Symbol )
39- if haskey (scene. attributes, key)
40- return scene. attributes[key]
41- else
42- return scene. theme[key]
43- end
39+ return haskey (scene. attributes, key) ? scene. attributes[key] : scene. theme[key]
4440end
4541
4642function Base. setindex! (scene:: Scene , value, key:: Symbol )
5046function Scene (
5147 events:: Events ,
5248 px_area:: Node{IRect2D} ,
49+ clear:: Bool ,
5350 camera:: Camera ,
5451 camera_controls:: RefValue ,
5552 scene_limits,
@@ -67,7 +64,7 @@ function Scene(
6764 updated = Node (false )
6865
6966 scene = Scene (
70- parent, events, px_area, camera, camera_controls,
67+ parent, events, px_area, clear, camera, camera_controls,
7168 Node {Union{Nothing, FRect3D}} (scene_limits),
7269 transformation, plots, theme, attributes,
7370 children, current_screens, updated
@@ -106,9 +103,7 @@ function Scene(
106103end
107104
108105
109- function Scene (
110- ;scene_attributes...
111- )
106+ function Scene (;clear = true , scene_attributes... )
112107 events = Events ()
113108 theme = current_default_theme (; scene_attributes... )
114109 attributes = copy (theme)
@@ -123,6 +118,7 @@ function Scene(
123118 scene = Scene (
124119 events,
125120 px_area,
121+ clear,
126122 Camera (px_area),
127123 RefValue {Any} (EmptyCamera ()),
128124 nothing ,
@@ -146,24 +142,25 @@ function Scene(
146142 scene:: Scene ;
147143 events = scene. events,
148144 px_area = scene. px_area,
145+ clear = false ,
149146 cam = scene. camera,
150147 camera_controls = scene. camera_controls,
151148 transformation = Transformation (scene),
152149 theme = copy (theme (scene)),
153150 current_screens = scene. current_screens,
154- clear = false ,
155151 kw_args...
156152 )
157153 child = Scene (
158154 events,
159155 px_area,
156+ clear,
160157 cam,
161158 camera_controls,
162159 nothing ,
163160 transformation,
164161 AbstractPlot[],
165162 merge (current_default_theme (), theme),
166- merge! (Attributes (clear = clear ; kw_args... ), scene. attributes),
163+ merge! (Attributes (; kw_args... ), scene. attributes),
167164 Scene[],
168165 current_screens,
169166 scene
@@ -181,13 +178,14 @@ function Scene(parent::Scene, area; clear = false, attributes...)
181178 child = Scene (
182179 events,
183180 px_area,
181+ clear,
184182 Camera (px_area),
185183 RefValue {Any} (EmptyCamera ()),
186184 nothing ,
187185 Transformation (),
188186 AbstractPlot[],
189- current_default_theme (clear = clear ; attributes... ),
190- merge! (Attributes (clear = clear ; attributes... ), parent. attributes),
187+ current_default_theme (; attributes... ),
188+ merge! (Attributes (; attributes... ), parent. attributes),
191189 Scene[],
192190 parent. current_screens,
193191 parent
0 commit comments