@@ -22,10 +22,6 @@ pub enum CanvasDrag {
2222
2323#[ derive( serde:: Deserialize , serde:: Serialize , Debug , Clone , Copy ) ]
2424pub enum Drag {
25- Panel {
26- pos : Pos2 ,
27- kind : InstanceKind ,
28- } ,
2925 Canvas ( CanvasDrag ) ,
3026 Label {
3127 id : LabelId ,
@@ -141,17 +137,6 @@ impl App {
141137
142138 pub fn handle_dragging ( & mut self , ui : & mut Ui , mouse : Pos2 ) {
143139 match self . drag {
144- Some ( Drag :: Panel { pos : _, kind } ) => match kind {
145- InstanceKind :: Gate ( gate_kind) => self . draw_gate_preview ( ui, gate_kind, mouse) ,
146- InstanceKind :: Power => self . draw_power_preview ( ui, mouse) ,
147- InstanceKind :: Wire => {
148- self . draw_wire ( ui, & Wire :: new_at ( mouse) , false , false ) ;
149- }
150- InstanceKind :: Lamp => self . draw_lamp_preview ( ui, mouse) ,
151- InstanceKind :: CustomCircuit ( def) => {
152- self . draw_custom_circuit_preview ( ui, def, mouse) ;
153- }
154- } ,
155140 Some ( Drag :: Selecting { start } ) => {
156141 let start_screen = start - self . viewport_offset ;
157142 let mouse_screen = mouse - self . viewport_offset ;
@@ -321,9 +306,6 @@ impl App {
321306 None => { }
322307 }
323308
324- if let Some ( Drag :: Panel { pos, kind : _ } ) = self . drag . as_mut ( ) {
325- * pos = mouse;
326- }
327309 self . compute_potential_connections ( ) ;
328310 }
329311
@@ -332,41 +314,15 @@ impl App {
332314 return ;
333315 } ;
334316 match drag {
335- Drag :: Panel { pos, kind } => {
336- if let InstanceKind :: CustomCircuit ( definition_index) = kind
337- && definition_index >= self . db . custom_circuit_definitions . len ( )
338- {
339- return ;
340- }
341-
342- let id = match kind {
343- InstanceKind :: Gate ( gate_kind) => self . db . new_gate ( Gate {
344- kind : gate_kind,
345- pos,
346- } ) ,
347- InstanceKind :: Power => self . db . new_power ( Power { pos, on : true } ) ,
348- InstanceKind :: Wire => {
349- let w = Wire :: new_at ( pos) ;
350- self . db . new_wire ( w)
351- }
352- InstanceKind :: Lamp => self . db . new_lamp ( Lamp { pos } ) ,
353- InstanceKind :: CustomCircuit ( definition_index) => {
354- self . db
355- . new_custom_circuit ( crate :: custom_circuit:: CustomCircuit {
356- pos,
357- definition_index,
358- } )
359- }
360- } ;
361- self . connection_manager . mark_instance_dirty ( id) ;
362- }
363317 Drag :: Canvas ( canvas_drag) => match canvas_drag {
364318 CanvasDrag :: Single { id, offset : _ } => {
365319 self . connection_manager . mark_instance_dirty ( id) ;
320+ self . current_dirty = true ;
366321 }
367322 CanvasDrag :: Selected { start : _ } => {
368323 let selected: Vec < InstanceId > = self . selected . iter ( ) . copied ( ) . collect ( ) ;
369324 self . connection_manager . mark_instances_dirty ( & selected) ;
325+ self . current_dirty = true ;
370326 }
371327 } ,
372328 Drag :: Selecting { start } => {
@@ -401,6 +357,7 @@ impl App {
401357 }
402358 Drag :: Resize { id, start : _ } => {
403359 self . connection_manager . mark_instance_dirty ( id) ;
360+ self . current_dirty = true ;
404361 }
405362 Drag :: PinToWire {
406363 source_pin : _,
@@ -418,9 +375,9 @@ impl App {
418375 } => {
419376 self . connection_manager
420377 . mark_instance_dirty ( original_wire_id) ;
378+ self . current_dirty = true ;
421379 }
422380 }
423- self . current_dirty = true ;
424381 self . connection_manager . rebuild_spatial_index ( & self . db ) ;
425382 self . potential_connections . clear ( ) ;
426383 self . drag_had_movement = false ;
0 commit comments