Author: F.antonov
Date: 2007-03-07 07:50:41 -0500 (Wed, 07 Mar 2007)
New Revision: 33
Modified:
trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
Log:
Fix for bug RFA-188.
Modified:
trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js
===================================================================
---
trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-03-07
11:11:59 UTC (rev 32)
+++
trunk/richfaces/inputnumber-slider/src/main/resources/org/richfaces/renderkit/html/script/SliderScript.js 2007-03-07
12:50:41 UTC (rev 33)
@@ -1,11 +1,12 @@
if(!Exadel) var Exadel = {};
Exadel.Slider = Class.create();
Exadel.Slider.prototype = {
- initialize: function(handle, track, tip, input, options) {
+ initialize: function(handle, track, tip, table, options) {
var slider = this;
this.handle = $( handle );
this.tip = $( tip );
this.track = $( track );
+ this.mainTable = $( table );
this.input = $( options.inputId ) || document.getElementsByName(options.inputId)[0];
this.options= options || {};
@@ -52,7 +53,8 @@
if(!this.options.disabled){
this.documentBodyOload = this.load.bindAsEventListener(this);
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
+ //this.eventMouseUp = this.endDrag.bindAsEventListener(this);
+ this.eventMouseUp = this.processMouseUp.bindAsEventListener(this);
this.eventMouseMove = this.update.bindAsEventListener(this);
this.eventMouseDown = this.startDrag.bindAsEventListener(this);
this.eventEditFocus = this.editFocus.bindAsEventListener(this);
@@ -206,6 +208,7 @@
window.document.onmouseup = this.eventMouseUp.bindAsEventListener(this);
window.document.onmousemove = this.eventMouseMove.bindAsEventListener(this);
this.editBlur();
+ this.prevMouseDownEvent = event;
if(Event.isLeftClick(event)) {
if(!this.disabled){
@@ -240,6 +243,11 @@
pointer -= this.offsetX + offsets[0];
this.setValue(this.translateToValue( pointer ));
},
+
+ processMouseUp: function(event) {
+ this.endDrag(event);
+ this.fireClickIfNeeded(event);
+ },
endDrag: function(event) {
window.document.onmouseup = this.prevMouseUp;
@@ -260,6 +268,22 @@
if (RichFaces.navigatorType() != "MSIE")
this.fireEditEvent("change");
},
+
+ fireClickIfNeeded: function(event){
+ if (this.prevMouseDownEvent.target != event.target &&
+ //this.prevMouseDownEvent.screenX == event.clientX &&
+ //this.prevMouseDownEvent.screenY == event.clientY &&
+ RichFaces.navigatorType() != "MSIE") {
+ if( document.createEvent ) {
+ var evObj = document.createEvent("MouseEvents");
+ evObj.initEvent( "click", true, false );
+ //evObj.initMouseEvent("click", true, false, window,
+ // event.detail, event.screenX, event.screenY, event.clientX,
event.clientY,
+ // event.ctrlKey, event.altKey, event.shiftKey, event.metaKey,
event.button, null);
+ this.mainTable.dispatchEvent(evObj);
+ }
+ }
+ },
isValueChanged : function(){
var ret =this.prevValue != this.value
Show replies by date