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

Hue Shift, Saturation, etc. values get reset when switch to another UI element?

1 Answer 73 Views
ImageEditor
This is a migrated thread and some comments may be shown as answers.
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Rob A. asked on 02 Dec 2020, 09:11 PM

If I select Hue Shift and move the slider and have a value of 115.75, then I click on the "Saturation" item and make adjustments via slide to 20.12, now I click on Hue Shift and it's value has reset back to 0.0 even though the "Hue shift" has been applied to the image?

My expectation was the Hue Shift value would be retained NOT reset ... this happens to all the command controls.  Is there a way to prevent the reset of these values when I navigate from command (HueShift) to command (Saturation)?

I noticed your ImageEditor sample application has the same issue ... see video for clarity:

https://youtu.be/ya4a5lMQBdU

Cheers, Rob.

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 07 Dec 2020, 10:34 AM

Hello Rob,

Clicking on another tool will commit the currently executing one. To prevent this, you can subscribe to the ToolCommiting event of RadImageEditor and cancel the action. For example:

private void RadImageEditor_ToolCommitting(object sender, ToolCommittingEventArgs e)
{
	// if should cancel HueShift or Saturation tool committing
	e.Cancel = true;
}

Note that when you cancel the tool, you won't get the hue shift, but the slider will get reset. If you want to prevent also this, you can create a custom HueShiftTool and override its ResetSettings() method, where you can cache and restore the HueShift value.

public class CustomHueShiftTool : HueShiftTool
{
	public override void ResetSettings()
	{
		var effect = (HueShiftEffect)this.Effect;
		var hueShiftCache = effect.HueShift;
		base.ResetSettings();
		effect.HueShift = hueShiftCache;
	}
}

About the resetting of the slider but keeping the hue shift effect, this behavior is expected and it mimics most image editing tools. Basically, the hue/saturation settings are applied directly to the editing image when you commit the corresponding tool. At this state you already have a modified image and when you active the tool you apply hue/saturation again but over the modified picture. This behavior is the same in tools like Photoshop and Paint .NET for example. You may notice that the slider in some other tools may preserve its position but this will offset the colors again instead of keep the original ones as you probably expect.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
ImageEditor
Asked by
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Martin Ivanov
Telerik team
Share this question
or