File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,9 @@ fn app() -> Element {
4242 background_color: "#f0f0f0" ,
4343 ondragover: |e| e. prevent_default( ) ,
4444 ondrop: move |e| {
45- if let Some ( item_id) = e. data_transfer( ) . get_data( "text/plain" ) . and_then( |data| data. parse:: <usize >( ) . ok( ) ) {
46- if let Some ( pos) = items. iter( ) . position( |item| item. id == item_id) {
47- items. write( ) [ pos] . category = category. to_string( ) ;
48- }
45+ if let Some ( item_id) = e. data_transfer( ) . get_data( "text/plain" ) . and_then( |data| data. parse:: <usize >( ) . ok( ) )
46+ && let Some ( pos) = items. iter( ) . position( |item| item. id == item_id) {
47+ items. write( ) [ pos] . category = category. to_string( ) ;
4948 }
5049 } ,
5150 h2 { "Category: {category}" }
Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ fn app() -> Element {
2020 let read = div_element. read ( ) ;
2121 let client_rect = read. as_ref ( ) . map ( |el| el. get_client_rect ( ) ) ;
2222
23- if let Some ( client_rect) = client_rect {
24- if let Ok ( rect) = client_rect. await {
25- dimensions . set ( rect ) ;
26- }
23+ if let Some ( client_rect) = client_rect
24+ && let Ok ( rect) = client_rect. await
25+ {
26+ dimensions . set ( rect ) ;
2727 }
2828 } ;
2929
You can’t perform that action at this time.
0 commit comments