don't deselect selection after brush widget update

This commit is contained in:
sheaf 2024-10-19 16:14:33 +02:00
parent 5adcb34de6
commit 3fe46fc029

View file

@ -1022,7 +1022,8 @@ instance HandleAction MouseClick where
then pure Don'tModifyDoc
else do
-- Clicked on an unselected point: only select that point.
let newDoc = set ( field' @"documentMetadata" . field' @"selectedPoints" )
let newDoc =
set ( field' @"documentMetadata" . field' @"selectedPoints" )
( StrokePoints $ Map.singleton u ( Set.singleton i ) )
doc
pure ( UpdateDoc $ UpdateDocumentTo newDoc TrivialDiff )
@ -1211,8 +1212,13 @@ instance HandleAction MouseRelease where
Just hold
| PathMode <- mode
, DragMoveHold { holdStartPos = pos0, dragAction } <- hold
, not $ inPointClickRange zoom pos0 pos
-> let
->
if inPointClickRange zoom pos0 pos
then
let mbDoc' = fst <$> selectAt selMode pos doc
in pure ( UpdateDoc $ UpdateDocumentTo ( fromMaybe doc mbDoc' ) TrivialDiff )
else
let
alternateMode :: Bool
alternateMode = any ( \case { Alt _ -> True; _ -> False } ) modifiers
in case dragUpdate pos0 pos dragAction alternateMode doc of
@ -1226,12 +1232,17 @@ instance HandleAction MouseRelease where
in pure $ UpdateDoc ( UpdateDocumentTo doc' diff )
Nothing -> pure Don'tModifyDoc
| SelectionHold pos0 <- hold
, not $ inPointClickRange zoom pos0 pos
, let mbDoc' = fst <$> selectRectangle selMode pos0 pos doc
-> pure ( UpdateDoc $ UpdateDocumentTo ( fromMaybe doc mbDoc' ) TrivialDiff )
_ ->
let mbDoc' = fst <$> selectAt selMode pos doc
-> let mbDoc'
| inPointClickRange zoom pos0 pos
= fst <$> selectAt selMode pos doc
| otherwise
= fst <$> selectRectangle selMode pos0 pos doc
in pure ( UpdateDoc $ UpdateDocumentTo ( fromMaybe doc mbDoc' ) TrivialDiff )
| otherwise
-> pure Don'tModifyDoc
Nothing -> do
let mbDoc' = fst <$> selectAt selMode pos doc
pure ( UpdateDoc $ UpdateDocumentTo ( fromMaybe doc mbDoc' ) TrivialDiff )
Pen -> case mode of
PathMode -> do