summaryrefslogtreecommitdiff
path: root/framework/Web/Javascripts/source
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2014-03-26 19:54:37 +0100
committerDavid <ottodavid@gmx.net>2014-08-21 17:32:37 +0200
commitadb88ab5ac7980af3fea4cc035a158d92b1ab1a6 (patch)
tree0327ddcb6e3f4565d49eb8572d3977570d972182 /framework/Web/Javascripts/source
parentc382794ff0e7575ae31cc549789a84d75e6f9a57 (diff)
Fix #502
(cherry picked from commit e2fb2ab1e2b5925f16d4dd5c3ac514a0e54ee026) Conflicts: framework/Web/Javascripts/source/prado/controls/slider.js
Diffstat (limited to 'framework/Web/Javascripts/source')
-rw-r--r--framework/Web/Javascripts/source/prado/controls/slider.js31
1 files changed, 21 insertions, 10 deletions
diff --git a/framework/Web/Javascripts/source/prado/controls/slider.js b/framework/Web/Javascripts/source/prado/controls/slider.js
index 2e26ee51..d612d654 100644
--- a/framework/Web/Javascripts/source/prado/controls/slider.js
+++ b/framework/Web/Javascripts/source/prado/controls/slider.js
@@ -18,17 +18,9 @@ Prado.WebUI.TSlider = Class.extend(Prado.WebUI.PostBackControl,
this.maximum = this.options.maximum || this.range.end;
this.minimum = this.options.minimum || this.range.start;
this.hiddenField=$(this.options.ID+'_1');
+ this.trackInitialized=false;
- // Will be used to align the handle onto the track, if necessary
- this.alignX = parseInt(this.options.alignX || - this.track.offsetLeft);
- this.alignY = parseInt(this.options.alignY || - this.track.offsetTop);
-
- this.trackLength = this.maximumOffset() - this.minimumOffset();
- this.handleLength = this.isVertical() ?
- (this.handle.offsetHeight != 0 ?
- this.handle.offsetHeight : this.handles.style.height.replace(/px$/,"")) :
- (this.handle.offsetWidth != 0 ? this.handle.offsetWidth :
- this.handle.style.width.replace(/px$/,""));
+ this.initializeTrack();
this.active = false;
this.dragging = false;
@@ -64,6 +56,24 @@ Prado.WebUI.TSlider = Class.extend(Prado.WebUI.PostBackControl,
if(this.options['AutoPostBack']==true)
this.observe(this.hiddenField, "change", Prado.PostBack.bindEvent(this,options));
+ initializeTrack : function()
+ {
+ if(this.trackInitialized || !$(this.track).is(":visible"))
+ return;
+
+ // Will be used to align the handle onto the track, if necessary
+ this.alignX = parseInt(this.options.alignX || - this.track.offsetLeft);
+ this.alignY = parseInt(this.options.alignY || - this.track.offsetTop);
+
+ this.trackLength = this.maximumOffset() - this.minimumOffset();
+ this.handleLength = this.isVertical() ?
+ (this.handle.offsetHeight != 0 ?
+ this.handle.offsetHeight : this.handles.style.height.replace(/px$/,"")) :
+ (this.handle.offsetWidth != 0 ? this.handle.offsetWidth :
+ this.handle.style.width.replace(/px$/,""));
+ this.trackInitialized=true;
+ },
+
},
setDisabled: function(){
@@ -151,6 +161,7 @@ Prado.WebUI.TSlider = Class.extend(Prado.WebUI.PostBackControl,
startDrag: function(event) {
if(Event.isLeftClick(event)) {
+ this.initializeTrack();
if(!this.disabled){
this.active = true;
var handle = Event.element(event);