# Numerical aberrations in sliders

**URL:** <https://forums.creativeclouddeveloper.com/t/numerical-aberrations-in-sliders/7255>\
**Category:** Photoshop\
**Tags:** javascript\
**Created:** [December 15, 2023, 1:25am UTC](https://forums.creativeclouddeveloper.com/t/numerical-aberrations-in-sliders/7255 "2023-12-15T01:25:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ancelmoa](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/ancelmoa/32/3640_2.png) [@Ancelmoa](https://forums.creativeclouddeveloper.com/u/Ancelmoa)\
**Post date:** [December 15, 2023, 1:25am UTC](https://forums.creativeclouddeveloper.com/t/numerical-aberrations-in-sliders/7255/1 "2023-12-15T01:25:12Z")

</div>

Could anyone help me solve this problem?

 ![Captura de tela 2023-12-14 222018](https://us1.discourse-cdn.com/flex015/uploads/xdplugins/original/2X/e/ea85e7d9d0be6df785257122d0af4e9a0b1f82e1.png)

---

<div class="post-metadata">

**Author:** ![JasonM](https://avatars.discourse-cdn.com/v4/letter/j/3be4f8/32.png) [@JasonM](https://forums.creativeclouddeveloper.com/u/JasonM)\
**Post date:** [December 15, 2023, 7:53am UTC](https://forums.creativeclouddeveloper.com/t/numerical-aberrations-in-sliders/7255/2 "2023-12-15T07:53:29Z")

</div>

Are you asking how to round the values? Maybe this?

```auto
myInput.value = Math.round(mySlider.value * 100) / 100;

```

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [December 15, 2023, 8:07am UTC](https://forums.creativeclouddeveloper.com/t/numerical-aberrations-in-sliders/7255/3 "2023-12-15T08:07:18Z")

</div>

I believe it’s about UI and value being cut off on the far right outside of dialog window

---

<div class="post-metadata">

**Author:** ![Ancelmoa](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/ancelmoa/32/3640_2.png) [@Ancelmoa](https://forums.creativeclouddeveloper.com/u/Ancelmoa)\
**Post date:** [December 15, 2023, 12:44pm UTC](https://forums.creativeclouddeveloper.com/t/numerical-aberrations-in-sliders/7255/4 "2023-12-15T12:44:31Z")

</div>

Exactly this problem. here is the code.  
I would like to thank my noble colleagues for their attention.

```auto
const dialogimpress = document.getElementById('tamImpress');
const impresDial = document.getElementById('impressDialog');

  dialogimpress.addEventListener('click', () => {
  impresDial.show({title: "Tratamento para impressão",resize: "both",size: { width: 250, height: 200}});       
  
  
  
});

const abrirSlid = document.getElementById('abrirSlid');
const SlidModal = document.getElementById('DiaSld');
const desfoqueSlider = document.getElementById('desfoque');
const texturaSlider = document.getElementById('textura');
const btnClose = document.getElementById('aplyin');
// Função assíncrona com a lógica que você quer executar antes da abertura da janela
const abrirPeleMod = async () => {
    await core.executeAsModal(async () => {      
      // Sua lógica aqui
      app.batchPlay([], {});
    });
  };
abrirSlid.addEventListener('click', async () => {
    // Chama a função assíncrona antes de abrir a janela dialog
    desfoqueSlider.value = 0.1; 
    texturaSlider.value = 0.1;
   
  await abrirPeleMod();
  
  SlidModal.show({title: "Tratamento de pele",resize: "both",size: { width: 350, height: 200}}); 
  btnClose.onclick = function() {

    core.executeAsModal(async () => {
      // Sua lógica aqui
      app.batchPlay([], {});
    });
    SlidModal.close()
  }
 
});

document.querySelector('#Corrigir').addEventListener('click', async () => {
  await core.executeAsModal(async () => {
  await app.batchPlay([{"_obj":"select","_target":[{"_name":"Pele Manual02","_ref":"layer"}],"makeVisible":false},
  {"_obj":"select","_target":[{"_ref":"paintbrushTool"}]}], {});
  })
});

const slDesfoque = document.querySelector("#desfoque");
slDesfoque.addEventListener("change", async (func) => {
	document.querySelector("#vDesf").innerHTML = slDesfoque.value 
	await suavPele(slDesfoque.value);
}) 
///////////////////////////
async function suavPele(Textura){
	async function suavPele() {
		await batchPlay( [{"_obj":"set","_target":[{"_index":2,"_ref":"filterFX"},{"_ref":"layer",_name: "AjustPele", _value: "targetEnum"}],"filterFX":{"_obj":"filterFX","filter":{"_obj":"highPass","radius":{"_unit":"pixelsUnit","_value":Textura}}}} ], 
			{ modalBehavior: "wait" } );
	}
	async function runModalFunction() {await executeAsModal(suavPele);}
	await runModalFunction();
}

const slTextura = document.querySelector("#textura");
slTextura.addEventListener("change", async (func) => {
	document.querySelector("#vTextur").innerHTML = slTextura.value 
	await textura(slTextura.value);
}) 
///////////////////////////
async function textura(Desfoque){
	async function textura() {
		await batchPlay( [{"_obj":"set","_target":[{"_index":3,"_ref":"filterFX"},{"_ref":"layer",_name: "AjustPele", _value: "targetEnum"}],"filterFX":{"_obj":"filterFX","filter":{"_obj":"gaussianBlur","radius":{"_unit":"pixelsUnit","_value":Desfoque}}}}], 
			{ modalBehavior: "wait" } );
	}
	async function runModalFunction() {await executeAsModal(textura);}
	await runModalFunction();
}

```

---

<div class="post-metadata">

**Author:** ![Ancelmoa](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/ancelmoa/32/3640_2.png) [@Ancelmoa](https://forums.creativeclouddeveloper.com/u/Ancelmoa)\
**Post date:** [December 15, 2023, 1:40pm UTC](https://forums.creativeclouddeveloper.com/t/numerical-aberrations-in-sliders/7255/5 "2023-12-15T13:40:06Z")

</div>

Here is the modified code and my sincere thanks.

```auto
const slDesfoque = document.querySelector("#desfoque");
slDesfoque.addEventListener("change", async (func) => {
  const roundedValue = Math.round(slDesfoque.value * 10) / 10; // Arredonda para uma casa decimal
  document.querySelector("#vDesf").innerHTML = roundedValue;
  await suavPele(roundedValue);
}) 
///////////////////////////
async function suavPele(Textura){
	async function suavPele() {
		await batchPlay( [{"_obj":"set","_target":[{"_index":2,"_ref":"filterFX"},{"_ref":"layer",_name: "AjustPele", _value: "targetEnum"}],"filterFX":{"_obj":"filterFX","filter":{"_obj":"highPass","radius":{"_unit":"pixelsUnit","_value":Textura}}}} ], 
			{ modalBehavior: "wait" } );
	}
	async function runModalFunction() {await executeAsModal(suavPele);}
	await runModalFunction();
}

const slTextura = document.querySelector("#textura");
slTextura.addEventListener("change", async (func) => {
  const roundedValue = Math.round(slTextura.value * 10) / 10; // Arredonda para uma casa decimal
  document.querySelector("#vTextur").innerHTML = roundedValue;
  await textura(roundedValue);;
}) 
///////////////////////////
async function textura(Desfoque){
	async function textura() {
		await batchPlay( [{"_obj":"set","_target":[{"_index":3,"_ref":"filterFX"},{"_ref":"layer",_name: "AjustPele", _value: "targetEnum"}],"filterFX":{"_obj":"filterFX","filter":{"_obj":"gaussianBlur","radius":{"_unit":"pixelsUnit","_value":Desfoque}}}}], 
			{ modalBehavior: "wait" } );
	}
	async function runModalFunction() {await executeAsModal(textura);}
	await runModalFunction();
}

```
