pub(crate) fn update_scale(&mut self, scale: f32) {
        match &mut self.shape_type {
            ShapeType::Drawing(s) => {
                let self_pos = self.pos.pos;
                s.iter_mut().for_each(|v| {
                    v.update_scale(scale);
                    v.update_pos(self_pos + v.pos.pos * scale);
                })
            }
            ShapeType::Text {
                text: _,
                align: _,
                font_size,
                font_weight: _,
            } => {
                *font_size *= scale;
            }
            ShapeType::Line { from, to } => {
                *from *= scale;
                *to *= scale;
            }
            ShapeType::Circle { radius } => {
                *radius *= scale;
            }
            ShapeType::Image { data: _ } => {}
            ShapeType::Path {
                keypoints,
                closed: _,
            } => {
                keypoints.iter_mut().for_each(|v| {
                    *v *= scale;
                });
            }
        }

        self.pos.pos = self.pos.position_from_center() * scale;
        self.pos.size = self.pos.size.map(|v| v * scale);

        match self.style.as_mut().map(|v| &mut v.stroke) {
            Some(Some(Stroke::Full { color: _, width })) => {
                *width *= scale;
            }
            Some(Some(Stroke::Dashed {
                color: _,
                width,
                on,
                off,
            })) => {
                *width *= scale;
                *on *= scale;
                *off *= scale;
            }
            _ => {}
        }
    }
/// Update the scale of the shape.
Update the scale of the shape.
Update the scale of the shape .
pub(crate) fn update_scale(&mut self, scale: f32) {
        match &mut self.shape_type {
            ShapeType::Drawing(s) => {
                let self_pos = self.pos.pos;
                s.iter_mut().for_each(|v| {
                    v.update_scale(scale);
                    v.update_pos(self_pos + v.pos.pos * scale);
                })
            }
            ShapeType::Text {
                text: _,
                align: _,
                font_size,
                font_weight: _,
            } => {
                *font_size *= scale;
            }
            ShapeType::Line { from, to } => {
                *from *= scale;
                *to *= scale;
            }
            ShapeType::Circle { radius } => {
                *radius *= scale;
            }
            ShapeType::Image { data: _ } => {}
            ShapeType::Path {
                keypoints,
                closed: _,
            } => {
                keypoints.iter_mut().for_each(|v| {
                    *v *= scale;
                });
            }
        }
        self.pos.pos = self.pos.position_from_center() * scale;
        self.pos.size = self.pos.size.map(|v| v * scale);
        match self.style.as_mut().map(|v| &mut v.stroke) {
            Some(Some(Stroke::Full { color: _, width })) => {
                *width *= scale;
            }
            Some(Some(Stroke::Dashed {
                color: _,
                width,
                on,
                off,
            })) => {
                *width *= scale;
                *on *= scale;
                *off *= scale;
            }
            _ => {}
        }
    }
pub ( crate ) fn update_scale ( & mut self , scale : f32 ) { match & mut self . shape_type { ShapeType :: Drawing ( s ) => { let self_pos = self . pos . pos ; s . iter_mut ( ) . for_each ( | v | { v . update_scale ( scale ) ; v . update_pos ( self_pos + v . pos . pos * scale ) ; } ) } ShapeType :: Text { text : _ , align : _ , font_size , font_weight : _ , } => { * font_size *= scale ; } ShapeType :: Line { from , to } => { * from *= scale ; * to *= scale ; } ShapeType :: Circle { radius } => { * radius *= scale ; } ShapeType :: Image { data : _ } => { } ShapeType :: Path { keypoints , closed : _ , } => { keypoints . iter_mut ( ) . for_each ( | v | { * v *= scale ; } ) ; } } self . pos . pos = self . pos . position_from_center ( ) * scale ; self . pos . size = self . pos . size . map ( | v | v * scale ) ; match self . style . as_mut ( ) . map ( | v | & mut v . stroke ) { Some ( Some ( Stroke :: Full { color : _ , width } ) ) => { * width *= scale ; } Some ( Some ( Stroke :: Dashed { color : _ , width , on , off , } ) ) => { * width *= scale ; * on *= scale ; * off *= scale ; } _ => { } } }
Update the scale of the shape.
Update the scale of the shape .
&mut self
scale
f32
&mut self
scale
f32