Code Monkey home page Code Monkey logo

Comments (12)

wieslawsoltes avatar wieslawsoltes commented on June 3, 2024 1

I think this might be duplicate of #21 and probably fixed by cdb406e

from colorpicker.

jamsoft avatar jamsoft commented on June 3, 2024

Yeah I was just thinking the same as I was reviewing your fix. It's almost certainly the same issue.

I had wondered if it was possibly picking up mouse values from outside it's Bounds hence the NaN but I think you're right.

from colorpicker.

wieslawsoltes avatar wieslawsoltes commented on June 3, 2024

Yeah I was just thinking the same as I was reviewing your fix. It's almost certainly the same issue.

I had wondered if it was possibly picking up mouse values from outside it's Bounds hence the NaN but I think you're right.

Oh NaN that might be different issue

from colorpicker.

wieslawsoltes avatar wieslawsoltes commented on June 3, 2024

Added coercion for NaN values so exception can be avoided hopefully

from colorpicker.

jamsoft avatar jamsoft commented on June 3, 2024

Sounds like a good idea

from colorpicker.

wieslawsoltes avatar wieslawsoltes commented on June 3, 2024

Release version 0.10.17 with a fix

from colorpicker.

jamsoft avatar jamsoft commented on June 3, 2024

Yeah I tested this the other day, still seems to be crashing my app so I need to do a bit more digging on this one.

from colorpicker.

jamsoft avatar jamsoft commented on June 3, 2024

Still seeing some odd issues with 0.10.17 unfortunately.

If I remove any Binding on Color and run the app, viewing the page with the ColorPicker on immediately bombs the app.

I decided to remove all of my logic and so just set the Color property to a fixed value with no binding:

<colorPicker:ColorPicker x:Name="main"
                                 Grid.ColumnSpan="2"
                                 Margin="10" 
                                 Color="White">
    <colorPicker:ColorPicker.Styles>
        <Style Selector="colorPicker|ColorPicker /template/ colorPicker|ColorPickerValuesPresenter">
            <Setter Property="MinHeight" Value="200" />
            <Setter Property="MinWidth" Value="200" />
            <Setter Property="IsVisible" Value="True" />
        </Style>
        <Style Selector="colorPicker|ColorPicker /template/ colorPicker|ColorPickerPropertiesPresenter#PART_ColorPickerPropertiesPresenter">
            <Setter Property="(DockPanel.Dock)" Value="Right" />
            <Setter Property="IsVisible" Value="False" />
        </Style>
    </colorPicker:ColorPicker.Styles>
</colorPicker:ColorPicker>

Viewing the page works just fine. But dragging the color thumb to the bottom of the ColorPickerValuesPresenter viewable area is still bombing the app.

System.ArgumentException: Invalid Value value.
   at ThemeEditor.Controls.ColorPicker.Props.HsvProperties.ValidateValue(Nullable`1 value) in /_/src/ThemeEditor.Controls.ColorPicker/Props/HsvProperties.cs:line 86
   at Avalonia.ValueStore.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 98
   at Avalonia.AvaloniaObject.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 367
   at ThemeEditor.Controls.ColorPicker.Props.HsvProperties.set_Value(Nullable`1 value) in /_/src/ThemeEditor.Controls.ColorPicker/Props/HsvProperties.cs:line 115
   at ThemeEditor.Controls.ColorPicker.Props.HsvProperties.UpdatePropertyValues() in /_/src/ThemeEditor.Controls.ColorPicker/Props/HsvProperties.cs:line 137
   at ThemeEditor.Controls.ColorPicker.ColorPickerProperties.<OnColorPickerChange>b__12_2(Nullable`1 _) in /_/src/ThemeEditor.Controls.ColorPicker/ColorPickerProperties.cs:line 55
   at System.Reactive.AnonymousObserver`1.OnNextCore(T value) in /_/Rx.NET/Source/src/System.Reactive/AnonymousObserver.cs:line 67
   at System.Reactive.ObserverBase`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 34
   at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value) in /_/src/Avalonia.Base/Reactive/LightweightObservableBase.cs:line 139
   at Avalonia.Reactive.AvaloniaPropertyObservable`1.PropertyChanged(Object sender, AvaloniaPropertyChangedEventArgs e) in /_/src/Avalonia.Base/Reactive/AvaloniaPropertyObservable.cs:line 67
   at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaPropertyChangedEventArgs`1 change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 761
   at Avalonia.AvaloniaObject.Avalonia.PropertyStore.IValueSink.ValueChanged[T](AvaloniaPropertyChangedEventArgs`1 change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 531
   at Avalonia.ValueStore.NotifyValueChanged[T](AvaloniaProperty`1 property, Optional`1 oldValue, BindingValue`1 newValue, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 355
   at Avalonia.ValueStore.SetExisting[T](Object slot, StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 284
   at Avalonia.ValueStore.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 107
   at Avalonia.AvaloniaObject.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 367
   at ThemeEditor.Controls.ColorPicker.ColorPickerValuesPresenter.set_Value3(Nullable`1 value) in /_/src/ThemeEditor.Controls.ColorPicker/ColorPickerValuesPresenter.cs:line 55
   at ThemeEditor.Controls.ColorPicker.ColorPickerValuesPresenter.UpdateValuesFromThumbs() in /_/src/ThemeEditor.Controls.ColorPicker/ColorPickerValuesPresenter.cs:line 219
   at ThemeEditor.Controls.ColorPicker.ColorPickerValuesPresenter.ColorCanvas_PointerMoved(Object sender, PointerEventArgs e) in /_/src/ThemeEditor.Controls.ColorPicker/ColorPickerValuesPresenter.cs:line 310
   at Avalonia.Interactivity.Interactive.<AddHandler>g__InvokeAdapter|4_0[TEventArgs](Delegate baseHandler, Object sender, RoutedEventArgs args) in /_/src/Avalonia.Interactivity/Interactive.cs:line 62
   at Avalonia.Interactivity.Interactive.<>c__4`1.<AddHandler>b__4_1(Delegate baseHandler, Object sender, RoutedEventArgs args) in /_/src/Avalonia.Interactivity/Interactive.cs:line 68
   at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 167
   at Avalonia.Interactivity.EventRoute.RaiseEvent(IInteractive source, RoutedEventArgs e) in /_/src/Avalonia.Interactivity/EventRoute.cs:line 101
   at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Interactivity/Interactive.cs:line 122
   at Avalonia.Input.MouseDevice.MouseMove(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties properties, KeyModifiers inputModifiers, Lazy`1 intermediatePoints) in /_/src/Avalonia.Input/MouseDevice.cs:line 292
   at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e) in /_/src/Avalonia.Input/MouseDevice.cs:line 182
   at Avalonia.Input.MouseDevice.ProcessRawEvent(RawInputEventArgs e) in /_/src/Avalonia.Input/MouseDevice.cs:line 90
   at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) in /_/src/Avalonia.Input/InputManager.cs:line 35
   at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e) in /_/src/Avalonia.Controls/TopLevel.cs:line 508
   at Avalonia.Win32.WindowImpl.AppWndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs:line 520
   at Avalonia.Win32.WindowImpl.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/WindowImpl.WndProc.cs:line 30
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 210
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 65
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209

from colorpicker.

jamsoft avatar jamsoft commented on June 3, 2024

I've removed all my logic and tested again.

This control is still bombing my application.

                    <colorPicker:ColorPicker x:Name="main"
                                                     Grid.ColumnSpan="2"
                                                     Margin="10" 
                                                     Color="White">
                        <colorPicker:ColorPicker.Styles>
                            <Style Selector="colorPicker|ColorPicker /template/ colorPicker|ColorPickerValuesPresenter">
                                <Setter Property="MinHeight" Value="200" />
                                <Setter Property="MinWidth" Value="200" />
                                <Setter Property="IsVisible" Value="True" />
                            </Style>
                            <Style Selector="colorPicker|ColorPicker /template/ colorPicker|ColorPickerPropertiesPresenter#PART_ColorPickerPropertiesPresenter">
                                <Setter Property="(DockPanel.Dock)" Value="Right" />
                                <Setter Property="IsVisible" Value="False" />
                            </Style>
                        </colorPicker:ColorPicker.Styles>
                    </colorPicker:ColorPicker>
System.ArgumentException: Invalid Value value.
   at ThemeEditor.Controls.ColorPicker.Props.HsvProperties.ValidateValue(Nullable`1 value) in /_/src/ThemeEditor.Controls.ColorPicker/Props/HsvProperties.cs:line 86
   at Avalonia.ValueStore.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/ValueStore.cs:line 98
   at Avalonia.AvaloniaObject.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 367
   at ThemeEditor.Controls.ColorPicker.Props.HsvProperties.set_Value(Nullable`1 value) in /_/src/ThemeEditor.Controls.ColorPicker/Props/HsvProperties.cs:line 115
   at ThemeEditor.Controls.ColorPicker.Props.HsvProperties.UpdatePropertyValues() in /_/src/ThemeEditor.Controls.ColorPicker/Props/HsvProperties.cs:line 137

from colorpicker.

wieslawsoltes avatar wieslawsoltes commented on June 3, 2024

I have refactored master branch and changed how validation and coercion of values works

from colorpicker.

jamsoft avatar jamsoft commented on June 3, 2024

Ahhhh, OK. Will grab the latest and check it out. Thanks.

from colorpicker.

jamsoft avatar jamsoft commented on June 3, 2024

Interestingly, the issue has now moved to the far right of the color swatch, hitting that extreme with the thumb bombs the demo.

The issue with the alpha slider is also still there. Dragging to the extreme bombs the demo.

from colorpicker.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.