Skip to content
Snippets Groups Projects
Commit 1602e9bd authored by johnshaughnessy's avatar johnshaughnessy
Browse files

Rename buildMap to buildBindingsForSrcs

parent 16828c58
No related branches found
No related tags found
No related merge requests found
...@@ -25,7 +25,7 @@ import { resolveActionSets } from "./resolve-action-sets"; ...@@ -25,7 +25,7 @@ import { resolveActionSets } from "./resolve-action-sets";
import { GamepadDevice } from "./devices/gamepad"; import { GamepadDevice } from "./devices/gamepad";
import { gamepadBindings } from "./bindings/generic-gamepad"; import { gamepadBindings } from "./bindings/generic-gamepad";
function buildMap(registeredMappings) { function buildBindingsForSrcs(registeredMappings) {
const map = new Map(); const map = new Map();
const add = (path, binding) => { const add = (path, binding) => {
if (!map.has(path)) { if (!map.has(path)) {
...@@ -70,7 +70,7 @@ AFRAME.registerSystem("userinput", { ...@@ -70,7 +70,7 @@ AFRAME.registerSystem("userinput", {
this.activeDevices = new Set([new MouseDevice(), new AppAwareMouseDevice(), new KeyboardDevice(), new HudDevice()]); this.activeDevices = new Set([new MouseDevice(), new AppAwareMouseDevice(), new KeyboardDevice(), new HudDevice()]);
this.registeredMappings = new Set([keyboardDebuggingBindings]); this.registeredMappings = new Set([keyboardDebuggingBindings]);
this.map = buildMap(this.registeredMappings); this.bindingsForSrc = buildBindingsForSrcs(this.registeredMappings);
this.xformStates = new Map(); this.xformStates = new Map();
const appAwareTouchscreenDevice = new AppAwareTouchscreenDevice(); const appAwareTouchscreenDevice = new AppAwareTouchscreenDevice();
...@@ -91,7 +91,7 @@ AFRAME.registerSystem("userinput", { ...@@ -91,7 +91,7 @@ AFRAME.registerSystem("userinput", {
this.registeredMappings.add(keyboardMouseUserBindings); this.registeredMappings.add(keyboardMouseUserBindings);
} }
} }
this.map = buildMap(this.registeredMappings); this.bindingsForSrc = buildBindingsForSrcs(this.registeredMappings);
}; };
this.el.sceneEl.addEventListener("enter-vr", updateBindingsForVRMode); this.el.sceneEl.addEventListener("enter-vr", updateBindingsForVRMode);
this.el.sceneEl.addEventListener("exit-vr", updateBindingsForVRMode); this.el.sceneEl.addEventListener("exit-vr", updateBindingsForVRMode);
...@@ -128,7 +128,7 @@ AFRAME.registerSystem("userinput", { ...@@ -128,7 +128,7 @@ AFRAME.registerSystem("userinput", {
this.registeredMappings.add(gamepadBindings); this.registeredMappings.add(gamepadBindings);
} }
this.activeDevices.add(gamepadDevice); this.activeDevices.add(gamepadDevice);
this.map = buildMap(this.registeredMappings); this.bindingsForSrc = buildBindingsForSrcs(this.registeredMappings);
}, },
false false
); );
...@@ -138,7 +138,7 @@ AFRAME.registerSystem("userinput", { ...@@ -138,7 +138,7 @@ AFRAME.registerSystem("userinput", {
for (const device of this.activeDevices) { for (const device of this.activeDevices) {
if (device.gamepad === e.gamepad) { if (device.gamepad === e.gamepad) {
this.activeDevices.delete(device); this.activeDevices.delete(device);
this.map = buildMap(this.registeredMappings); this.bindingsForSrc = buildBindingsForSrcs(this.registeredMappings);
return; return;
} }
} }
...@@ -205,7 +205,7 @@ AFRAME.registerSystem("userinput", { ...@@ -205,7 +205,7 @@ AFRAME.registerSystem("userinput", {
while (subpaths.length > 1) { while (subpaths.length > 1) {
const highestPriorityBindingForSubpath = maxAmongActive( const highestPriorityBindingForSubpath = maxAmongActive(
Array.join(subpaths, "/"), Array.join(subpaths, "/"),
this.map, this.bindingsForSrc,
this.activeSets this.activeSets
); );
if ((binding.priority || 0) < highestPriorityBindingForSubpath.priority) { if ((binding.priority || 0) < highestPriorityBindingForSubpath.priority) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment