xtasy99 / dota2buttemplate_fixed

27 stars 14 forks source link

Why not showing options as sliders? #22

Open GniLudio opened 10 months ago

GniLudio commented 10 months ago

It would be nice to have the ability to show settings as sliders.

<!-- Slider -->
<DOTASettingsSlider 
  min="50" max="150" text="Hello World" 
  displayprecision="1" invert="false"
  percentage="true" value100percent="150" 
  mindisplaypercentage="0" onvaluechanged="$.Msg('OnValueChanged');" />
<!-- Styles -->
<include src="s2r://panorama/styles/dotastyles.vcss_c" />
<include src="s2r://panorama/styles/popups/settings_slider.vcss_c" />
<include src="s2r://panorama/styles/hud/dota_hud_clip_builder.vcss_c" />
<include src="s2r://panorama/styles/popups/popup_debut_tool_screen_slider.vcss_c" />

image

Notes:

GniLudio commented 10 months ago

To display the initial value:

function InitSlider(sliderId) {
    const slider = FindDotaHudElement(sliderId);
    const min = isNaN(slider["min"]) ?  0 : slider["min"];
    const value = parseFloat(slider.GetAttributeString("value", min.toString()));
    if (value <= min) slider["min"] = value-1;
    slider.value = value;
    if (value <= min) slider["min"] = min;
}
Snoresville commented 5 months ago

Sorry, didn't see this. Good initiative, turn it into a pull request maybe?