// Signals to the squid to initiate a certain user action
Signals to the squid to initiate a certain user action
Signals to the squid to initiate a certain user action
pub fn initiate(&mut self, initiation: Initiation) {
        match &mut self.data {
            SquidData::Rect(rect) => match initiation {
                Initiation::Translate => {
                    rect.translate_behavior.moving = true;
                    rect.moving_corner = None;
                }
                Initiation::Rotate => (),
                Initiation::Scale => {
                    let real = rect.data.get_real();
                    rect.prescale_size = real.size;
                }
                Initiation::Spread { point, center } => {
                    rect.spread_behavior = SpreadBehavior {
                        origin: center,
                        start: rect.data.get_real().position.reveal(),
                        point,
                    };
                }
                Initiation::Dilate { point, center } => {
                    let real = rect.data.get_real();
                    rect.prescale_size = real.size;
                    rect.dilate_behavior = DilateBehavior {
                        point,
                        origin: center,
                        start: rect.data.get_real().position.reveal(),
                    };
                }
                Initiation::Revolve { point, center } => rect.revolve_behavior.set(&center, &rect.data.get_real().position.reveal(), &point),
            },
            SquidData::Circle(circle) => match initiation {
                Initiation::Translate => circle.translate_behavior.moving = true,
                Initiation::Rotate => (),
                Initiation::Scale => circle.prescale_size = circle.data.get_real().radius,
                Initiation::Spread { point, center } => {
                    circle.spread_behavior = SpreadBehavior {
                        point,
                        origin: center,
                        start: circle.data.get_real().position.reveal(),
                    };
                }
                Initiation::Revolve { point, center } => circle.revolve_behavior.set(&center, &circle.data.get_real().position.reveal(), &point),
                Initiation::Dilate { point, center } => {
                    circle.prescale_size = circle.data.get_real().radius;
                    circle.dilate_behavior = DilateBehavior {
                        point,
                        origin: center,
                        start: circle.data.get_real().position.reveal(),
                    };
                }
            },
            SquidData::Tri(tri) => match initiation {
                Initiation::Translate => {
                    tri.translate_behavior.moving = true;
                    tri.moving_point = None;
                }
                Initiation::Rotate => (),
                Initiation::Scale => {
                    let real = tri.data.get_real();
                    tri.prescale_size = [real.p1.reveal(), real.p2.reveal(), real.p3.reveal()];
                }
                Initiation::Spread { point, center } => {
                    tri.spread_behavior = SpreadBehavior {
                        point,
                        origin: center,
                        start: tri.data.get_real().position.reveal(),
                    };
                }
                Initiation::Revolve { point, center } => tri.revolve_behavior.set(&center, &tri.data.get_real().position.reveal(), &point),
                Initiation::Dilate { point, center } => {
                    let real = tri.data.get_real();
                    tri.prescale_size = [real.p1.reveal(), real.p2.reveal(), real.p3.reveal()];
                    tri.dilate_behavior = DilateBehavior {
                        point,
                        origin: center,
                        start: tri.data.get_real().position.reveal(),
                    };
                }
            },
        }
    }
pub fn initiate ( & mut self , initiation : Initiation ) { match & mut self . data { SquidData :: Rect ( rect ) => match initiation { Initiation :: Translate => { rect . translate_behavior . moving = true ; rect . moving_corner = None ; } Initiation :: Rotate => ( ) , Initiation :: Scale => { let real = rect . data . get_real ( ) ; rect . prescale_size = real . size ; } Initiation :: Spread { point , center } => { rect . spread_behavior = SpreadBehavior { origin : center , start : rect . data . get_real ( ) . position . reveal ( ) , point , } ; } Initiation :: Dilate { point , center } => { let real = rect . data . get_real ( ) ; rect . prescale_size = real . size ; rect . dilate_behavior = DilateBehavior { point , origin : center , start : rect . data . get_real ( ) . position . reveal ( ) , } ; } Initiation :: Revolve { point , center } => rect . revolve_behavior . set ( & center , & rect . data . get_real ( ) . position . reveal ( ) , & point ) , } , SquidData :: Circle ( circle ) => match initiation { Initiation :: Translate => circle . translate_behavior . moving = true , Initiation :: Rotate => ( ) , Initiation :: Scale => circle . prescale_size = circle . data . get_real ( ) . radius , Initiation :: Spread { point , center } => { circle . spread_behavior = SpreadBehavior { point , origin : center , start : circle . data . get_real ( ) . position . reveal ( ) , } ; } Initiation :: Revolve { point , center } => circle . revolve_behavior . set ( & center , & circle . data . get_real ( ) . position . reveal ( ) , & point ) , Initiation :: Dilate { point , center } => { circle . prescale_size = circle . data . get_real ( ) . radius ; circle . dilate_behavior = DilateBehavior { point , origin : center , start : circle . data . get_real ( ) . position . reveal ( ) , } ; } } , SquidData :: Tri ( tri ) => match initiation { Initiation :: Translate => { tri . translate_behavior . moving = true ; tri . moving_point = None ; } Initiation :: Rotate => ( ) , Initiation :: Scale => { let real = tri . data . get_real ( ) ; tri . prescale_size = [ real . p1 . reveal ( ) , real . p2 . reveal ( ) , real . p3 . reveal ( ) ] ; } Initiation :: Spread { point , center } => { tri . spread_behavior = SpreadBehavior { point , origin : center , start : tri . data . get_real ( ) . position . reveal ( ) , } ; } Initiation :: Revolve { point , center } => tri . revolve_behavior . set ( & center , & tri . data . get_real ( ) . position . reveal ( ) , & point ) , Initiation :: Dilate { point , center } => { let real = tri . data . get_real ( ) ; tri . prescale_size = [ real . p1 . reveal ( ) , real . p2 . reveal ( ) , real . p3 . reveal ( ) ] ; tri . dilate_behavior = DilateBehavior { point , origin : center , start : tri . data . get_real ( ) . position . reveal ( ) , } ; } } , } }
Signals to the squid to initiate a certain user action
Signals to the squid to initiate a certain user action
&mut self
initiation
Initiation