Slider steps

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

undavide

Slider steps

Post by undavide »

Hello,
this is probably easy but it's been long time since I was dealing with ScriptUI.
In a Flex based interface, "snapInterval" is used to define a Slider's step:

Code: Select all<s:HSlider id="mySlider"
           x="10" y="53"
           width="200"    
           maximum="10" minimum="1"
           snapInterval="0.1"/>

That is, the slider's value goes [1, 1.1 ... 9.9, 10]
Is there any ScriptUI equivalent?
Thanks

Davide

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

ysong

Slider steps

Post by ysong »

I use this to make the value always be a integer:

Code: Select allslider.onChanging = function() {
  this.value = parseInt(this.value);
  sizevar.text = "" + this.value + " x " + this.value;
};


maby u can set a step var this way,not elegant,but worked:

Code: Select all 
slider.onChanging = function() {
  var step;
  step = 50;
  this.value = parseInt(this.value / step) * step;
  sizevar.text = "" + this.value + " x " + this.value;
};
undavide

Slider steps

Post by undavide »

I gave up elegance some time ago
Thanks for the suggestion, I've implemented it in a slider that mimic the exponential behavior of PS ones:

Code: Select allmySlider.onChanging = function() {
  this.parent.myText.text = parseInt((-0.9 + Math.exp(3 * this.value)) * 10) / 10;
};

Davide