ginebra2/chrome/js/ActionButton.js
changeset 5 0f2326c2a325
parent 0 1450b09d0cfd
equal deleted inserted replaced
1:b0dd75e285d2 5:0f2326c2a325
    68 
    68 
    69 // Commented out because onclick is not reliable.  Slight movements between mouse down
    69 // Commented out because onclick is not reliable.  Slight movements between mouse down
    70 // and mouse up seem to cancel the onclick.
    70 // and mouse up seem to cancel the onclick.
    71 //    this.onClick = function() {
    71 //    this.onClick = function() {
    72 //        window.chrome.alert("ActionButton::onClick: " + this);
    72 //        window.chrome.alert("ActionButton::onClick: " + this);
    73 //        if(this.action.enabled) {
    73 //        if (this.action.enabled) {
    74 //            this.action.trigger();
    74 //            this.action.trigger();
    75 //        }
    75 //        }
    76 //        else {
    76 //        else {
    77 //            window.chrome.alert("ActionButton::onClick: not enabled");
    77 //            window.chrome.alert("ActionButton::onClick: not enabled");
    78 //        }
    78 //        }
    79 //    }
    79 //    }
    80     
    80 
    81     this.onMouseDown = function() {
    81     this.onMouseDown = function() {
    82         // window.chrome.alert("ActionButton::onMouseDown " + this);
    82         // window.chrome.alert("ActionButton::onMouseDown " + this);
    83         if (!this.isDown) {
    83         if (!this.isDown) {
    84             this.isDown = true;
    84             this.isDown = true;
    85             this.updateButton.call(this);
    85             this.updateButton.call(this);
   105     this.onMouseOut = function() {
   105     this.onMouseOut = function() {
   106         // window.chrome.alert("ActionButton::onMouseOut " + this);
   106         // window.chrome.alert("ActionButton::onMouseOut " + this);
   107         if (this.isDown) {
   107         if (this.isDown) {
   108             this.isDown = false;
   108             this.isDown = false;
   109             this.updateButton.call(this);
   109             this.updateButton.call(this);
   110             
   110 
   111             if (this.triggerOnMouseOut) {
   111             if (this.triggerOnMouseOut) {
   112                 // Trigger the action.
   112                 // Trigger the action.
   113                 this.action.trigger();
   113                 this.action.trigger();
   114             }
   114             }
   115         }
   115         }