Skip to content

Commit a93a006

Browse files
committed
Fix selection tools mistakenly "grabbing" last interactive...
...point when creating many selections in quick succession.
1 parent 80c36f9 commit a93a006

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Modules/SelectionUI.bas

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -321,21 +321,17 @@ End Function
321321
'This sub will return a constant correlating to the nearest selection point. See the relevant enum for details.
322322
Public Function IsCoordSelectionPOI(ByVal imgX As Double, ByVal imgY As Double, ByRef srcImage As pdImage) As PD_PointOfInterest
323323

324+
IsCoordSelectionPOI = poi_Undefined
325+
324326
'If the current selection is...
325327
' 1) raster-type, or...
326328
' 2) inactive...
327329
'...disallow POIs entirely. (These types of selections do not support on-canvas interactions.)
328-
If (srcImage.MainSelection.GetSelectionShape = ss_Raster) Or (Not srcImage.IsSelectionActive) Then
329-
IsCoordSelectionPOI = poi_Undefined
330-
Exit Function
331-
End If
330+
If (srcImage.MainSelection.GetSelectionShape = ss_Raster) Or (Not srcImage.IsSelectionActive) Then Exit Function
332331

333332
'Similarly, POIs are only enabled if the current selection tool matches the current selection shape.
334333
' (If a new selection shape has been selected, the user is definitely not modifying the existing selection.)
335-
If (g_CurrentTool <> SelectionUI.GetRelevantToolFromSelectShape()) Then
336-
IsCoordSelectionPOI = poi_Undefined
337-
Exit Function
338-
End If
334+
If (g_CurrentTool <> SelectionUI.GetRelevantToolFromSelectShape()) Then IsCoordSelectionPOI = poi_Undefined
339335

340336
'We're now going to compare the passed coordinate against a hard-coded list of "points of interest." These POIs
341337
' differ by selection type, as different selections allow for different levels of interaction. (For example, a polygon
@@ -402,6 +398,10 @@ Public Function IsCoordSelectionPOI(ByVal imgX As Double, ByVal imgY As Double,
402398
IsCoordSelectionPOI = poi_CornerSE
403399
ElseIf (closestPoint = 3) Then
404400
IsCoordSelectionPOI = poi_CornerSW
401+
402+
'Failsafe only
403+
Else
404+
IsCoordSelectionPOI = poi_Undefined
405405
End If
406406

407407
Else
@@ -708,11 +708,11 @@ Public Sub NotifySelectionKeyUp(ByRef srcCanvas As pdCanvas, ByVal Shift As Shif
708708
End Sub
709709

710710
Public Sub NotifySelectionMouseDown(ByRef srcCanvas As pdCanvas, ByVal imgX As Single, ByVal imgY As Single)
711-
711+
712+
If m_IgnoreUserInput Then Exit Sub
713+
712714
m_MouseDown = True
713715
m_HasMouseMoved = False
714-
715-
If m_IgnoreUserInput Then Exit Sub
716716

717717
'Check to see if a selection is already active. If it is, see if the user is clicking on a POI
718718
' (and initiating a transform) or clicking somewhere else (initiating a new selection).
@@ -892,7 +892,7 @@ Public Sub NotifySelectionMouseMove(ByRef srcCanvas As pdCanvas, ByVal lmbState
892892
m_HasMouseMoved = True
893893

894894
'Handling varies based on the current mouse state, obviously.
895-
If lmbState Then
895+
If m_MouseDown Then
896896

897897
'Basic selection tools
898898
Select Case g_CurrentTool

PhotoDemon.vbp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ Description="PhotoDemon Photo Editor"
513513
CompatibleMode="0"
514514
MajorVer=8
515515
MinorVer=9
516-
RevisionVer=1742
516+
RevisionVer=1743
517517
AutoIncrementVer=1
518518
ServerSupportFiles=0
519519
VersionComments="Copyright 2000-2022 Tanner Helland - photodemon.org"

0 commit comments

Comments
 (0)