mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-18 13:38:03 +08:00
Merge pull request #7537 from microsoft/user/martinchrzan/ColorPickerShowColorWhenFormatChanged
Update string color represention when color format changed, but mouse…
This commit is contained in:
commit
3906896947
@ -24,6 +24,7 @@ namespace ColorPicker.Mouse
|
|||||||
private readonly IUserSettings _userSettings;
|
private readonly IUserSettings _userSettings;
|
||||||
private System.Windows.Point _previousMousePosition = new System.Windows.Point(-1, 1);
|
private System.Windows.Point _previousMousePosition = new System.Windows.Point(-1, 1);
|
||||||
private Color _previousColor = Color.Transparent;
|
private Color _previousColor = Color.Transparent;
|
||||||
|
private bool _colorFormatChanged;
|
||||||
|
|
||||||
[ImportingConstructor]
|
[ImportingConstructor]
|
||||||
public MouseInfoProvider(AppStateHandler appStateMonitor, IUserSettings userSettings)
|
public MouseInfoProvider(AppStateHandler appStateMonitor, IUserSettings userSettings)
|
||||||
@ -40,6 +41,7 @@ namespace ColorPicker.Mouse
|
|||||||
|
|
||||||
_mouseHook = new MouseHook();
|
_mouseHook = new MouseHook();
|
||||||
_userSettings = userSettings;
|
_userSettings = userSettings;
|
||||||
|
_userSettings.CopiedColorRepresentation.PropertyChanged += CopiedColorRepresentation_PropertyChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
public event EventHandler<Color> MouseColorChanged;
|
public event EventHandler<Color> MouseColorChanged;
|
||||||
@ -73,9 +75,10 @@ namespace ColorPicker.Mouse
|
|||||||
}
|
}
|
||||||
|
|
||||||
var color = GetPixelColor(mousePosition);
|
var color = GetPixelColor(mousePosition);
|
||||||
if (_previousColor != color)
|
if (_previousColor != color || _colorFormatChanged)
|
||||||
{
|
{
|
||||||
_previousColor = color;
|
_previousColor = color;
|
||||||
|
_colorFormatChanged = false;
|
||||||
MouseColorChanged?.Invoke(this, color);
|
MouseColorChanged?.Invoke(this, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,6 +140,11 @@ namespace ColorPicker.Mouse
|
|||||||
OnMouseDown?.Invoke(this, p);
|
OnMouseDown?.Invoke(this, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CopiedColorRepresentation_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
_colorFormatChanged = true;
|
||||||
|
}
|
||||||
|
|
||||||
private void DisposeHook()
|
private void DisposeHook()
|
||||||
{
|
{
|
||||||
if (_timer.IsEnabled)
|
if (_timer.IsEnabled)
|
||||||
|
Loading…
Reference in New Issue
Block a user