This is a migrated thread and some comments may be shown as answers.

Crosshair when ColorPicker not on the active tab

1 Answer 51 Views
ColorPicker
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Iron
Steven asked on 13 May 2020, 06:35 PM

When the color picker is on a tab that is not active when the page loads the cursor (crosshair) is not in the right location.  The color is correct, the cursor is not.  I tried a few things I saw in this forum, repainting clientside when the tab becomes active, and adding this script to the bottom of the page.  But no luck.  Any Ideas?  Thank you.  Telerik version = 2017.3.913.45

function OnClientActiveTabChanged()
{
    $find("<%=colorBackGround.ClientID %>").repaint();
}
Telerik.Web.UI.RadColorPicker.prototype._updateHslSliderBackground = function (hsl, isCustomColor)
        {
            var color = this._hslToRgb(hsl.h, hsl.s, 0.5);
            var slider = isCustomColor ? this.get_millionCustomColorsSlider() : this.get_millionColorsSlider();
            if (slider._trackElement)
            {
                slider._trackElement.style.backgroundColor = this._rgbValuesToHex(color.r, color.g, color.b);
            }
        }

 

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 18 May 2020, 01:07 PM

Hi Steven,

You can force the colorPicker to update the color of its HSV palette whn the tab is changed, by setting the desired color again in a similar way:

            function onTabSelected(s, e) {
                var picker = $find("<%=colorBackGround.ClientID %>");
                picker.set_selectedColor(picker.get_selectedColor());
            }

Regards,
Vessy
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
ColorPicker
Asked by
Steven
Top achievements
Rank 1
Iron
Answers by
Vessy
Telerik team
Share this question
or