Commit 38e361ab authored by Matthias Möller's avatar Matthias Möller

Start-Modus

parent f8fd1832
......@@ -3,20 +3,43 @@ import layout from '../templates/components/explorviz-frontend-plugin-bci';
export default Ember.Component.extend({
layout:layout,
emotivWebsocket: Ember.inject.service("emotiv-websocket"),
tagName: "a",
classNameBindings: ["status"],
status : "",
click: function(){
console.log("clicked");
this.get("emotivWebsocket").start();
},
attributeBindings:["title"],
title: "BCI-Verbindung",
title: Ember.computed("emotivWebsocket.isActivated", "emotivWebsocket.status", function(){
let emotivWebsocket = this.get("emotivWebsocket");
if(emotivWebsocket !== "connected"){
return "press button to start BCI-Connection";
}
else if(emotivWebsocket.isActivated){
return "press ctrl+b to deactivate BCI-mode";
}else{
return "press ctrl+b to activate BCI-mode";
}
}),
isActivated: false,
init(){
this._super(...arguments);
this.status=Ember.computed("emotivWebsocket.status", function(){return this.get("emotivWebsocket").status;}.bind(this));
this.click=this.click.bind(this);
$(document)[0].addEventListener("keyup", function(evt){
if(evt.ctrlKey && evt.key=="b"){
this.get("emotivWebsocket").toogleActivation();
}
}.bind(this));
}
});
......@@ -5,6 +5,7 @@ export default Ember.Service.extend({
websockets : Ember.inject.service("websockets"),
socketReference:null,
status:"",
isActivated: false,
start: function(){
this.set("status", "connecting");
......@@ -55,6 +56,10 @@ export default Ember.Service.extend({
event.wheelDelta = wheelDelta;
canvas.dispatchEvent(event);
},
toogleActivation: function(){
this.set("isActivated", !this.get("isActivated"));
}
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment