mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 04:37:48 +02:00
Merge pull request #7277 from sethalves/edit-vs-mouse-grab
Edit vs mouse grab
This commit is contained in:
commit
d879300413
2 changed files with 29 additions and 1 deletions
|
@ -345,6 +345,7 @@ var toolBar = (function() {
|
||||||
if (active && !Entities.canAdjustLocks()) {
|
if (active && !Entities.canAdjustLocks()) {
|
||||||
Window.alert(INSUFFICIENT_PERMISSIONS_ERROR_MSG);
|
Window.alert(INSUFFICIENT_PERMISSIONS_ERROR_MSG);
|
||||||
} else {
|
} else {
|
||||||
|
Messages.sendLocalMessage("edit-events", JSON.stringify({enabled: active}));
|
||||||
isActive = active;
|
isActive = active;
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
entityListTool.setVisible(false);
|
entityListTool.setVisible(false);
|
||||||
|
@ -1949,4 +1950,4 @@ entityListTool.webView.eventBridge.webEventReceived.connect(function(data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -49,6 +49,8 @@ var IDENTITY_QUAT = {
|
||||||
};
|
};
|
||||||
var ACTION_TTL = 10; // seconds
|
var ACTION_TTL = 10; // seconds
|
||||||
|
|
||||||
|
var enabled = true;
|
||||||
|
|
||||||
function getTag() {
|
function getTag() {
|
||||||
return "grab-" + MyAvatar.sessionUUID;
|
return "grab-" + MyAvatar.sessionUUID;
|
||||||
}
|
}
|
||||||
|
@ -306,6 +308,10 @@ Grabber.prototype.computeNewGrabPlane = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Grabber.prototype.pressEvent = function(event) {
|
Grabber.prototype.pressEvent = function(event) {
|
||||||
|
if (!enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.isLeftButton!==true ||event.isRightButton===true || event.isMiddleButton===true) {
|
if (event.isLeftButton!==true ||event.isRightButton===true || event.isMiddleButton===true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -559,8 +565,29 @@ function keyReleaseEvent(event) {
|
||||||
grabber.keyReleaseEvent(event);
|
grabber.keyReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function editEvent(channel, message, sender, localOnly) {
|
||||||
|
if (channel != "edit-events") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (sender != MyAvatar.sessionUUID) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!localOnly) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
data = JSON.parse(message);
|
||||||
|
if ("enabled" in data) {
|
||||||
|
enabled = !data["enabled"];
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Controller.mousePressEvent.connect(pressEvent);
|
Controller.mousePressEvent.connect(pressEvent);
|
||||||
Controller.mouseMoveEvent.connect(moveEvent);
|
Controller.mouseMoveEvent.connect(moveEvent);
|
||||||
Controller.mouseReleaseEvent.connect(releaseEvent);
|
Controller.mouseReleaseEvent.connect(releaseEvent);
|
||||||
Controller.keyPressEvent.connect(keyPressEvent);
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
Controller.keyReleaseEvent.connect(keyReleaseEvent);
|
||||||
|
Messages.subscribe("edit-events");
|
||||||
|
Messages.messageReceived.connect(editEvent);
|
||||||
|
|
Loading…
Reference in a new issue