color4Dpickerdlg.cpp: avoid selecting accidentally a new color when the mouse cursor is inside a color map when opening the dialog
This commit is contained in:
parent
356f607cd6
commit
84f1c8e0c6
|
@ -11,6 +11,7 @@ COLOR4D_PICKER_DLG::COLOR4D_PICKER_DLG( wxWindow* aParent, KIGFX::COLOR4D& aCurr
|
|||
bool aAllowOpacityControl )
|
||||
: COLOR4D_PICKER_DLG_BASE( aParent )
|
||||
{
|
||||
m_allowMouseEvents = false;
|
||||
m_allowOpacityCtrl = aAllowOpacityControl;
|
||||
m_previousColor4D = aCurrentColor;
|
||||
m_newColor4D = aCurrentColor;
|
||||
|
@ -493,6 +494,7 @@ void COLOR4D_PICKER_DLG::buttColorClick( wxCommandEvent& event )
|
|||
|
||||
void COLOR4D_PICKER_DLG::onRGBMouseClick( wxMouseEvent& event )
|
||||
{
|
||||
m_allowMouseEvents = true;
|
||||
wxPoint mousePos = event.GetPosition();
|
||||
|
||||
// The cursor position is relative to the m_bitmapHSV wxBitmap center
|
||||
|
@ -532,7 +534,7 @@ void COLOR4D_PICKER_DLG::onRGBMouseClick( wxMouseEvent& event )
|
|||
|
||||
void COLOR4D_PICKER_DLG::onRGBMouseDrag( wxMouseEvent& event )
|
||||
{
|
||||
if( !event.Dragging() )
|
||||
if( !event.Dragging() || !m_allowMouseEvents )
|
||||
{
|
||||
m_selectedCursor = nullptr;
|
||||
return;
|
||||
|
@ -590,6 +592,8 @@ void COLOR4D_PICKER_DLG::onRGBMouseDrag( wxMouseEvent& event )
|
|||
|
||||
void COLOR4D_PICKER_DLG::onHSVMouseClick( wxMouseEvent& event )
|
||||
{
|
||||
m_allowMouseEvents = true;
|
||||
|
||||
if( setHSvaluesFromCursor( event.GetPosition() ) )
|
||||
drawAll();
|
||||
}
|
||||
|
@ -597,7 +601,7 @@ void COLOR4D_PICKER_DLG::onHSVMouseClick( wxMouseEvent& event )
|
|||
|
||||
void COLOR4D_PICKER_DLG::onHSVMouseDrag( wxMouseEvent& event )
|
||||
{
|
||||
if( !event.Dragging() )
|
||||
if( !event.Dragging() || !m_allowMouseEvents )
|
||||
return;
|
||||
|
||||
if( setHSvaluesFromCursor( event.GetPosition() ) )
|
||||
|
|
|
@ -38,6 +38,13 @@ public:
|
|||
static int m_ActivePage; ///< the active notebook page, stored during a session
|
||||
|
||||
private:
|
||||
/* When the dialog is created, the mouse cursor can be on the RGB or HSV palette selector
|
||||
* Because this dialog is created by clicking double clicking on a widget, the left mouse
|
||||
* button is down, thus creating a not wanted mouse event inside this dialog
|
||||
* m_allowMouseEvents is first set to false, and then set to true on the first left mouse
|
||||
* clicking inside this dialog to prevent not wanted mouse drag event
|
||||
*/
|
||||
bool m_allowMouseEvents;
|
||||
bool m_allowOpacityCtrl; ///< true to show the widget,
|
||||
///< false to keep alpha channel = 1.0
|
||||
KIGFX::COLOR4D m_previousColor4D; ///< the inital color4d
|
||||
|
|
Loading…
Reference in New Issue