CC-2301 : creating different states for the fade editor:

cursor, fadein, fadeout.
This commit is contained in:
Naomi 2013-04-23 16:36:35 -04:00
parent 04a0d9c54e
commit 956bcccd24
5 changed files with 164 additions and 19 deletions

View file

@ -28,6 +28,10 @@ AudioControls.prototype.events = {
click: "stopAudio"
},
"btn_cursor": {
click: "changeState"
},
"btn_select": {
click: "changeState"
},
@ -36,6 +40,15 @@ AudioControls.prototype.events = {
click: "changeState"
},
"btn_fadein": {
click: "changeState"
},
"btn_fadeout": {
click: "changeState"
},
"btns_fade": {
click: "createFade"
},
@ -400,15 +413,25 @@ AudioControls.prototype.stopAudio = function() {
AudioControls.prototype.activateButton = function(el) {
if (el) {
el.classList.remove(this.classes["disabled"]);
el.classList.add(this.classes["active"]);
}
};
AudioControls.prototype.deactivateButton = function(el) {
if (el) {
el.classList.remove(this.classes["active"]);
}
};
AudioControls.prototype.enableButton = function(el) {
if (el) {
el.classList.remove(this.classes["disabled"]);
}
};
AudioControls.prototype.disableButton = function(el) {
if (el) {
el.classList.add(this.classes["disabled"]);
el.classList.remove(this.classes["active"]);
}
};
@ -417,7 +440,7 @@ AudioControls.prototype.changeState = function(e) {
prevEl = el.parentElement.getElementsByClassName('active')[0],
state = el.dataset.state;
this.disableButton(prevEl);
this.deactivateButton(prevEl);
this.activateButton(el);
this.config.setState(state);