@@ -6,7 +6,7 @@ use crate::{
66 gpu_state:: GpuResourceAllocator ,
77 mouse_state:: MouseState ,
88 shader:: { Shader , TextureResource } ,
9- shape:: { compute_distance, Circle , RevisionStack , Shape } ,
9+ shape:: { compute_distance, Circle , EditorState , Shape } ,
1010 shape_uniform:: { CircleData , ShapeUniform , MAX_CIRCLES } ,
1111 } ,
1212} ;
@@ -30,7 +30,7 @@ pub struct AppState<'a> {
3030 pub feature_uniform : FeatureUniform ,
3131 pub draw_uniform : DrawUniform ,
3232 pub mouse_state : MouseState ,
33- pub revision_stack : RevisionStack ,
33+ pub editor_state : EditorState ,
3434 pub modifiers : Modifiers ,
3535
3636 pub image_shader : Shader ,
@@ -92,7 +92,7 @@ impl<'a> AppState<'a> {
9292 ) ;
9393
9494 let mouse_state = MouseState :: default ( ) ;
95- let revision_stack = RevisionStack :: default ( ) ;
95+ let editor_state = EditorState :: default ( ) ;
9696 let modifiers = Modifiers :: default ( ) ;
9797
9898 Ok ( Self {
@@ -102,7 +102,7 @@ impl<'a> AppState<'a> {
102102 feature_uniform,
103103 draw_uniform,
104104 mouse_state,
105- revision_stack ,
105+ editor_state ,
106106 modifiers,
107107 image_shader,
108108 shape_shader,
@@ -162,7 +162,7 @@ impl<'a> AppState<'a> {
162162 ( self . size . width as f32 , self . size . height as f32 ) ,
163163 ) ;
164164
165- self . revision_stack . push_shape ( Shape :: Circle ( circle) ) ;
165+ self . editor_state . push_shape ( Shape :: Circle ( circle) ) ;
166166
167167 // Clear state
168168 self . mouse_state . set_start_drag ( None ) ;
@@ -178,7 +178,7 @@ impl<'a> AppState<'a> {
178178 let mouse_coordinate = self . mouse_state . position ( ) ;
179179
180180 if let Some ( circle_index) =
181- self . revision_stack . shape_stack . find_shape_at_point (
181+ self . editor_state . shape_stack . find_shape_at_point (
182182 mouse_coordinate,
183183 self . size . width ,
184184 self . size . height ,
@@ -190,7 +190,7 @@ impl<'a> AppState<'a> {
190190
191191 // Calculate offset from circle center to mouse position
192192 let Shape :: Circle ( circle) =
193- self . revision_stack . shape_stack . get_unchecked ( circle_index) ;
193+ self . editor_state . shape_stack . get_unchecked ( circle_index) ;
194194
195195 let ( x, y) = circle. center ( ) ;
196196
@@ -244,11 +244,9 @@ impl<'a> AppState<'a> {
244244 let new_y = normalized_y - offset_y;
245245
246246 // Move the circle to the new position
247- self . revision_stack . shape_stack . move_shape (
248- selected_index,
249- new_x,
250- new_y,
251- ) ;
247+ self . editor_state
248+ . shape_stack
249+ . move_shape ( selected_index, new_x, new_y) ;
252250 }
253251 }
254252 }
@@ -322,15 +320,15 @@ impl<'a> AppState<'a> {
322320 | ( KeyCode :: Backspace , ElementState :: Pressed ) => {
323321 // Delete the selected circle
324322 if let Some ( selected_index) = self . mouse_state . selected_shape ( ) {
325- self . revision_stack . shape_stack . remove_shape ( selected_index) ;
323+ self . editor_state . shape_stack . remove_shape ( selected_index) ;
326324 self . mouse_state . set_selected_shape ( None ) ;
327325 self . mouse_state . set_dragging_shape ( false ) ;
328326 }
329327 }
330328 ( KeyCode :: KeyZ , ElementState :: Pressed ) => {
331329 #[ cfg( target_os = "macos" ) ]
332330 if self . modifiers . state ( ) . super_key ( ) {
333- self . revision_stack . undo ( ) ;
331+ self . editor_state . undo ( ) ;
334332 }
335333
336334 #[ cfg( not( target_os = "macos" ) ) ]
@@ -359,7 +357,7 @@ impl<'a> AppState<'a> {
359357 }
360358
361359 fn update_shape_data ( & mut self ) {
362- let num_circles = self . revision_stack . shape_stack . len ( ) . min ( MAX_CIRCLES ) ;
360+ let num_circles = self . editor_state . shape_stack . len ( ) . min ( MAX_CIRCLES ) ;
363361
364362 self . shape_uniform . set_num_circles ( num_circles as u32 ) ;
365363 self . shape_uniform
@@ -373,7 +371,7 @@ impl<'a> AppState<'a> {
373371 // Update circle storage buffer
374372 let mut circle_data = vec ! [ CircleData :: default ( ) ; MAX_CIRCLES ] ;
375373 for ( i, ( _, shape) ) in self
376- . revision_stack
374+ . editor_state
377375 . shape_stack
378376 . shapes ( )
379377 . into_iter ( )
0 commit comments