Ox.Range: update size if max/min/step changes
This commit is contained in:
parent
1cbaee2d67
commit
97ede3643e
1 changed files with 6 additions and 3 deletions
|
@ -53,6 +53,9 @@ Ox.Range = function(options, self) {
|
||||||
})
|
})
|
||||||
.options(options || {})
|
.options(options || {})
|
||||||
.update({
|
.update({
|
||||||
|
max: setSizes,
|
||||||
|
min: setSizes,
|
||||||
|
step: setSizes,
|
||||||
size: setSizes,
|
size: setSizes,
|
||||||
trackColors: setTrackColors,
|
trackColors: setTrackColors,
|
||||||
value: setThumb
|
value: setThumb
|
||||||
|
@ -76,9 +79,6 @@ Ox.Range = function(options, self) {
|
||||||
|
|
||||||
self.trackColors = self.options.trackColors.length;
|
self.trackColors = self.options.trackColors.length;
|
||||||
self.trackImages = self.options.trackImages.length;
|
self.trackImages = self.options.trackImages.length;
|
||||||
self.values = (
|
|
||||||
self.options.max - self.options.min + self.options.step
|
|
||||||
) / self.options.step;
|
|
||||||
|
|
||||||
setSizes();
|
setSizes();
|
||||||
|
|
||||||
|
@ -219,6 +219,9 @@ Ox.Range = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSizes() {
|
function setSizes() {
|
||||||
|
self.values = (
|
||||||
|
self.options.max - self.options.min + self.options.step
|
||||||
|
) / self.options.step;
|
||||||
self.trackSize = self.options.size - self.options.arrows * 32;
|
self.trackSize = self.options.size - self.options.arrows * 32;
|
||||||
self.thumbSize = Math.max(self.trackSize / self.values, self.options.thumbSize);
|
self.thumbSize = Math.max(self.trackSize / self.values, self.options.thumbSize);
|
||||||
self.trackImageWidths = self.trackImages == 1
|
self.trackImageWidths = self.trackImages == 1
|
||||||
|
|
Loading…
Reference in a new issue