diff --git a/src/metabrushes/MetaBrush/Brush/Widget.hs b/src/metabrushes/MetaBrush/Brush/Widget.hs index f31b966..56db7a3 100644 --- a/src/metabrushes/MetaBrush/Brush/Widget.hs +++ b/src/metabrushes/MetaBrush/Brush/Widget.hs @@ -122,13 +122,16 @@ widgetUpdate widget mode ( oldPt, newPt ) ( MkR oldFlds ) = | ℝ3 w h θ <- oldFlds -> case mode of ScaleAction whatScale -> - let T ( ℝ2 w' h' ) = rotate ( cos -θ ) ( sin -θ ) newPt + let T ( ℝ2 w0 h0 ) = rotate ( cos -θ ) ( sin -θ ) newPt + -- Don't allow width/height to become 0. + w' = max 1e-6 ( abs w0 ) + h' = max 1e-6 ( abs h0 ) in case whatScale of - ScaleXY -> MkR $ ℝ3 ( abs w' ) ( abs h' ) θ - ScaleX -> MkR $ ℝ3 ( abs w' ) h θ - ScaleY -> MkR $ ℝ3 w ( abs h' ) θ + ScaleXY -> MkR $ ℝ3 w' h' θ + ScaleX -> MkR $ ℝ3 w' h θ + ScaleY -> MkR $ ℝ3 w h' θ RotateAction {} - | norm newPt < 1e-5 + | norm newPt < 1e-6 -> MkR oldFlds | otherwise ->