@@ -400,16 +400,16 @@ impl TemplateApp {
400400
401401 // handle dragging from panel
402402 // TODO probably should add panel_drag to the world so rendering is easier
403- if let Some ( panel_drag) = & self . panel_drag {
404- if inside_rect ( & canvas_rect, & panel_drag. ty ) {
405- log :: debug! ( "drag inside rect" ) ;
406- match panel_drag . ty {
407- InstanceType :: Gate ( gate ) => {
408- self . draw_gate ( ui , & gate) ;
409- }
410- InstanceType :: Wire ( wire ) => {
411- Self :: draw_wire ( ui , & wire) ;
412- }
403+ if let Some ( panel_drag) = & self . panel_drag
404+ && inside_rect ( & canvas_rect, & panel_drag. ty )
405+ {
406+ log :: debug! ( "drag inside rect" ) ;
407+ match panel_drag . ty {
408+ InstanceType :: Gate ( gate) => {
409+ self . draw_gate ( ui , & gate ) ;
410+ }
411+ InstanceType :: Wire ( wire) => {
412+ Self :: draw_wire ( ui , & wire ) ;
413413 }
414414 }
415415 }
@@ -590,11 +590,11 @@ impl TemplateApp {
590590 // TODO: implement instance rotate
591591 } else if let Some ( _p_drag) = & mut self . panel_drag {
592592 // rotate instance when dragging from panel
593- } else if let Some ( mouse_pos) = pointer_pos {
594- if let Some ( i) = self . interacted_instance ( mouse_pos) {
595- let wire = self . get_wire_mut ( i . id ) ;
596- wire . rotate_cw ( ) ;
597- }
593+ } else if let Some ( mouse_pos) = pointer_pos
594+ && let Some ( i) = self . interacted_instance ( mouse_pos)
595+ {
596+ let wire = self . get_wire_mut ( i . id ) ;
597+ wire . rotate_cw ( ) ;
598598 }
599599 }
600600 for instance in & self . instances {
0 commit comments