File tree Expand file tree Collapse file tree 1 file changed +40
-4
lines changed Expand file tree Collapse file tree 1 file changed +40
-4
lines changed Original file line number Diff line number Diff line change @@ -324,10 +324,14 @@ impl Layer {
324
324
}
325
325
326
326
pub fn build ( & self , ui : & mut Ui , build : impl FnOnce ( & mut Ui ) ) {
327
- let rect = Rect :: new (
328
- ui. translation_stack . translate ( self . rect . origin ) ,
329
- self . rect . size ,
330
- ) ;
327
+ let rect = if self . rect == Rect :: zero ( ) {
328
+ Rect :: zero ( )
329
+ } else {
330
+ Rect :: new (
331
+ ui. translation_stack . translate ( self . rect . origin ) ,
332
+ self . rect . size ,
333
+ )
334
+ } ;
331
335
332
336
ui. layers . push ( ) ;
333
337
ui. layers . current_mut ( ) . scissor_rect = rect;
@@ -405,6 +409,38 @@ pub fn scroll() -> Scroll {
405
409
Scroll :: new ( )
406
410
}
407
411
412
+ pub struct Card { }
413
+
414
+ impl Default for Card {
415
+ fn default ( ) -> Self {
416
+ Self :: new ( )
417
+ }
418
+ }
419
+
420
+ impl Card {
421
+ pub fn new ( ) -> Self {
422
+ Self { }
423
+ }
424
+
425
+ pub fn build ( & self , ui : & mut Ui , build : impl FnOnce ( & mut Ui ) ) -> Point {
426
+ let last = self :: translate ( ) . build ( ui, |ui| {
427
+ self :: layer ( ) . build ( ui, build) ;
428
+ } ) ;
429
+
430
+ self :: quad ( )
431
+ . size ( last. x , last. y )
432
+ . color ( [ 42 ; 3 ] )
433
+ . border_radius ( [ 5.0 ; 4 ] )
434
+ . build ( ui) ;
435
+
436
+ last
437
+ }
438
+ }
439
+
440
+ pub fn card ( ) -> Card {
441
+ Card :: new ( )
442
+ }
443
+
408
444
#[ derive( Debug , Clone ) ]
409
445
pub struct Quad {
410
446
rect : Rect ,
You can’t perform that action at this time.
0 commit comments