@@ -289,19 +289,21 @@ impl GraphicElementRendered for GraphicGroupTable {
289
289
290
290
let mut layer = false ;
291
291
292
- let bounds = self
293
- . instance_ref_iter ( )
294
- . filter_map ( |element| element. instance . bounding_box ( transform, true ) )
295
- . reduce ( Quad :: combine_bounds) ;
296
- if let Some ( bounds) = bounds {
297
- let blend_mode = match render_params. view_mode {
298
- ViewMode :: Outline => peniko:: Mix :: Normal ,
299
- _ => alpha_blending. blend_mode . to_peniko ( ) ,
300
- } ;
292
+ let blend_mode = match render_params. view_mode {
293
+ ViewMode :: Outline => peniko:: Mix :: Normal ,
294
+ _ => alpha_blending. blend_mode . to_peniko ( ) ,
295
+ } ;
296
+ let mut bounds = None ;
301
297
302
- let factor = if render_params. for_mask { 1. } else { alpha_blending. fill } ;
303
- let opacity = alpha_blending. opacity * factor;
304
- if opacity < 1. || ( render_params. view_mode != ViewMode :: Outline && alpha_blending. blend_mode != BlendMode :: default ( ) ) {
298
+ let factor = if render_params. for_mask { 1. } else { alpha_blending. fill } ;
299
+ let opacity = alpha_blending. opacity * factor;
300
+ if opacity < 1. || ( render_params. view_mode != ViewMode :: Outline && alpha_blending. blend_mode != BlendMode :: default ( ) ) {
301
+ bounds = self
302
+ . instance_ref_iter ( )
303
+ . filter_map ( |element| element. instance . bounding_box ( transform, true ) )
304
+ . reduce ( Quad :: combine_bounds) ;
305
+
306
+ if let Some ( bounds) = bounds {
305
307
scene. push_layer (
306
308
peniko:: BlendMode :: new ( blend_mode, peniko:: Compose :: SrcOver ) ,
307
309
opacity,
@@ -321,6 +323,12 @@ impl GraphicElementRendered for GraphicGroupTable {
321
323
if !next_clips {
322
324
mask_instance_state = None ;
323
325
}
326
+ if !layer {
327
+ bounds = self
328
+ . instance_ref_iter ( )
329
+ . filter_map ( |element| element. instance . bounding_box ( transform, true ) )
330
+ . reduce ( Quad :: combine_bounds) ;
331
+ }
324
332
325
333
if let Some ( bounds) = bounds {
326
334
let rect = kurbo:: Rect :: new ( bounds[ 0 ] . x , bounds[ 0 ] . y , bounds[ 1 ] . x , bounds[ 1 ] . y ) ;
0 commit comments