Skip to content

Commit 25bc678

Browse files
author
Aaron Sillus
committed
AframeCanvasHoverController working
This controller got its own file, because the original specified it's own eventListeners on multiPart and canvas. This version subscribes for actions.hover/unhover instead.
1 parent ee20af5 commit 25bc678

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

ui/scripts/CanvasHover/AframeCanvasHoverController.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,11 @@ var canvasHoverController = (function() {
2323

2424
actionController.actions.mouse.hover.subscribe(handleOnMouseEnter);
2525
actionController.actions.mouse.unhover.subscribe(handleOnMouseLeave);
26-
27-
var canvas = document.getElementById("x3dom-x3dElement-canvas");
28-
canvas.addEventListener("mousedown", handleOnMousedown, false);
29-
canvas.addEventListener("mouseup", handleOnMouseup, false);
3026

3127
createTooltipContainer();
3228

3329
events.hovered.on.subscribe(onEntityHover);
34-
events.hovered.off.subscribe(onEntityUnhover);
30+
events.hovered.off.subscribe(onEntityUnhover);
3531
}
3632

3733
function reset(){
@@ -98,7 +94,6 @@ var canvasHoverController = (function() {
9894
}
9995

10096
function handleOnMouseEnter(eventObject) {
101-
console.debug(eventObject);
10297
if(isInNavigation){
10398
return;
10499
}
@@ -116,12 +111,10 @@ var canvasHoverController = (function() {
116111
/*posX : multipartEvent.layerX,
117112
posY : multipartEvent.layerY*/
118113
};
119-
120114
events.hovered.on.publish(applicationEvent);
121115
}
122116

123117
function handleOnMouseLeave(eventObject) {
124-
125118
var entity = model.getEntityById(eventObject.target.id);
126119
if(entity === undefined){
127120
events.log.error.publish({ text: "Entity of partID " + multipartEvent.partID + " not in model data."});
@@ -137,7 +130,6 @@ var canvasHoverController = (function() {
137130
}
138131

139132
function onEntityHover(applicationEvent) {
140-
console.debug("onEntityHover");
141133
var entity = applicationEvent.entities[0];
142134

143135
if(entity === undefined){

0 commit comments

Comments
 (0)