mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
removed button image, extraneous variables
This commit is contained in:
parent
17322645f2
commit
3af0c138dd
1 changed files with 1 additions and 55 deletions
|
@ -32,32 +32,17 @@ var movementParameters = DEFAULT_PARAMETERS;
|
||||||
|
|
||||||
var mouseLook = (function () {
|
var mouseLook = (function () {
|
||||||
|
|
||||||
var MOUSELOOK_BUTTON_URL = HIFI_PUBLIC_BUCKET + "images/tools/directory.svg",
|
var BUTTON_WIDTH = 50,
|
||||||
CURSORMODE_BUTTON_URL = HIFI_PUBLIC_BUCKET + "images/tools/marketplace.svg",
|
|
||||||
BUTTON_WIDTH = 50,
|
|
||||||
BUTTON_HEIGHT = 50,
|
BUTTON_HEIGHT = 50,
|
||||||
BUTTON_ALPHA = 0.9,
|
BUTTON_ALPHA = 0.9,
|
||||||
BUTTON_MARGIN = 8,
|
BUTTON_MARGIN = 8,
|
||||||
mouseLookButton,
|
|
||||||
EDIT_TOOLBAR_BUTTONS = 10, // Number of buttons in edit.js toolbar
|
|
||||||
viewport,
|
|
||||||
active = false,
|
active = false,
|
||||||
keyboardID = 0;
|
keyboardID = 0;
|
||||||
|
|
||||||
function updateButtonPosition() {
|
|
||||||
Overlays.editOverlay(mouseLookButton, {
|
|
||||||
x: viewport.x - BUTTON_WIDTH - BUTTON_MARGIN,
|
|
||||||
y: viewport.y - BUTTON_HEIGHT - BUTTON_MARGIN
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onKeyPressEvent(event) {
|
function onKeyPressEvent(event) {
|
||||||
if (event.text == 'm' && event.isMeta) {
|
if (event.text == 'm' && event.isMeta) {
|
||||||
active = !active;
|
active = !active;
|
||||||
updateMapping();
|
updateMapping();
|
||||||
Overlays.editOverlay(mouseLookButton, {
|
|
||||||
imageURL: active ? MOUSELOOK_BUTTON_URL : CURSORMODE_BUTTON_URL
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,8 +55,6 @@ var mouseLook = (function () {
|
||||||
yawSpeed = 0;
|
yawSpeed = 0;
|
||||||
pitchSpeed = 0;
|
pitchSpeed = 0;
|
||||||
|
|
||||||
// remove right click modifier from mouse pitch and yaw
|
|
||||||
var rightClick = Controller.getAvailableInputs(keyboardID)[46].input.channel;
|
|
||||||
var a = Controller.getAvailableInputs(keyboardID)[10].input.channel;
|
var a = Controller.getAvailableInputs(keyboardID)[10].input.channel;
|
||||||
var d = Controller.getAvailableInputs(keyboardID)[13].input.channel;
|
var d = Controller.getAvailableInputs(keyboardID)[13].input.channel;
|
||||||
var left = Controller.getAvailableInputs(keyboardID)[36].input.channel;
|
var left = Controller.getAvailableInputs(keyboardID)[36].input.channel;
|
||||||
|
@ -83,17 +66,6 @@ var mouseLook = (function () {
|
||||||
for (j = 0; j < inputChannels.length; j++) {
|
for (j = 0; j < inputChannels.length; j++) {
|
||||||
var inputChannel = inputChannels[j];
|
var inputChannel = inputChannels[j];
|
||||||
|
|
||||||
// Get rid of right click modifier on pitch and yaw
|
|
||||||
// if (inputChannel.modifier.device == keyboardID &&
|
|
||||||
// inputChannel.modifier.channel == rightClick) {
|
|
||||||
// Controller.removeInputChannel(inputChannel);
|
|
||||||
// inputChannel.modifier.device = 0;
|
|
||||||
// inputChannel.modifier.channel = 0;
|
|
||||||
// inputChannel.modifier.type = 0;
|
|
||||||
// inputChannel.modifier.id = 0;
|
|
||||||
// Controller.addInputChannel(inputChannel);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// make a, d, left, and right strafe
|
// make a, d, left, and right strafe
|
||||||
if ((inputChannel.input.channel == a || inputChannel.input.channel == left) && inputChannel.modifier.device == 0) {
|
if ((inputChannel.input.channel == a || inputChannel.input.channel == left) && inputChannel.modifier.device == 0) {
|
||||||
Controller.removeInputChannel(inputChannel);
|
Controller.removeInputChannel(inputChannel);
|
||||||
|
@ -129,14 +101,6 @@ var mouseLook = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScriptUpdate(dt) {
|
function onScriptUpdate(dt) {
|
||||||
var oldViewport = viewport;
|
|
||||||
|
|
||||||
viewport = Controller.getViewportDimensions();
|
|
||||||
|
|
||||||
if (viewport.x !== oldViewport.x || viewport.y !== oldViewport.y) {
|
|
||||||
updateButtonPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (active && Window.hasFocus()) {
|
if (active && Window.hasFocus()) {
|
||||||
var x = Window.getCursorPositionX();
|
var x = Window.getCursorPositionX();
|
||||||
// I'm not sure why this + 0.5 is necessary?
|
// I'm not sure why this + 0.5 is necessary?
|
||||||
|
@ -178,20 +142,6 @@ var mouseLook = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
viewport = Controller.getViewportDimensions();
|
|
||||||
|
|
||||||
mouseLookButton = Overlays.addOverlay("image", {
|
|
||||||
imageURL: CURSORMODE_BUTTON_URL,
|
|
||||||
width: BUTTON_WIDTH,
|
|
||||||
height: BUTTON_HEIGHT,
|
|
||||||
x: viewport.x - BUTTON_WIDTH - BUTTON_MARGIN,
|
|
||||||
y: viewport.y - BUTTON_MARGIN - BUTTON_HEIGHT,
|
|
||||||
alpha: BUTTON_ALPHA,
|
|
||||||
visible: true
|
|
||||||
});
|
|
||||||
|
|
||||||
updateButtonPosition();
|
|
||||||
|
|
||||||
keyboardID = Controller.findDevice("Keyboard");
|
keyboardID = Controller.findDevice("Keyboard");
|
||||||
|
|
||||||
Controller.keyPressEvent.connect(onKeyPressEvent);
|
Controller.keyPressEvent.connect(onKeyPressEvent);
|
||||||
|
@ -216,14 +166,10 @@ var mouseLook = (function () {
|
||||||
if (menuItem == "Mouselook Mode") {
|
if (menuItem == "Mouselook Mode") {
|
||||||
active = !active;
|
active = !active;
|
||||||
updateMapping();
|
updateMapping();
|
||||||
Overlays.editOverlay(mouseLookButton, {
|
|
||||||
imageURL: active ? MOUSELOOK_BUTTON_URL : CURSORMODE_BUTTON_URL
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function tearDown() {
|
function tearDown() {
|
||||||
Overlays.deleteOverlay(mouseLookButton);
|
|
||||||
if (keyboardID != 0) {
|
if (keyboardID != 0) {
|
||||||
Controller.resetDevice(keyboardID);
|
Controller.resetDevice(keyboardID);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue