mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 06:23:35 +02:00
Merge pull request #4297 from huffman/fix-mouse-look-clash
Fix mouse look clash
This commit is contained in:
commit
5cd1950bed
1 changed files with 39 additions and 11 deletions
|
@ -127,7 +127,7 @@ var toolBar = (function () {
|
||||||
height: toolHeight,
|
height: toolHeight,
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
visible: true
|
visible: true
|
||||||
}, true, false);
|
});
|
||||||
|
|
||||||
browseModelsButton = toolBar.addTool({
|
browseModelsButton = toolBar.addTool({
|
||||||
imageURL: toolIconUrl + "list-icon.svg",
|
imageURL: toolIconUrl + "list-icon.svg",
|
||||||
|
@ -262,6 +262,8 @@ var toolBar = (function () {
|
||||||
toolBar.move(toolsX, toolsY);
|
toolBar.move(toolsX, toolsY);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var newModelButtonDown = false;
|
||||||
|
var browseModelsButtonDown = false;
|
||||||
that.mousePressEvent = function (event) {
|
that.mousePressEvent = function (event) {
|
||||||
var clickedOverlay,
|
var clickedOverlay,
|
||||||
url,
|
url,
|
||||||
|
@ -274,19 +276,14 @@ var toolBar = (function () {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle these two buttons in the mouseRelease event handler so that we don't suppress a mouseRelease event from
|
||||||
|
// occurring when showing a modal dialog.
|
||||||
if (newModelButton === toolBar.clicked(clickedOverlay)) {
|
if (newModelButton === toolBar.clicked(clickedOverlay)) {
|
||||||
url = Window.prompt("Model URL", modelURLs[Math.floor(Math.random() * modelURLs.length)]);
|
newModelButtonDown = true;
|
||||||
if (url !== null && url !== "") {
|
|
||||||
addModel(url);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browseModelsButton === toolBar.clicked(clickedOverlay)) {
|
if (browseModelsButton === toolBar.clicked(clickedOverlay)) {
|
||||||
url = Window.s3Browse(".*(fbx|FBX)");
|
browseModelsButtonDown = true;
|
||||||
if (url !== null && url !== "") {
|
|
||||||
addModel(url);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,6 +345,7 @@ var toolBar = (function () {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (newTextButton === toolBar.clicked(clickedOverlay)) {
|
if (newTextButton === toolBar.clicked(clickedOverlay)) {
|
||||||
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE));
|
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE));
|
||||||
|
|
||||||
|
@ -367,10 +365,37 @@ var toolBar = (function () {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
that.mouseReleaseEvent = function(event) {
|
||||||
|
var handled = false;
|
||||||
|
if (newModelButtonDown) {
|
||||||
|
var clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y });
|
||||||
|
if (newModelButton === toolBar.clicked(clickedOverlay)) {
|
||||||
|
url = Window.prompt("Model URL", modelURLs[Math.floor(Math.random() * modelURLs.length)]);
|
||||||
|
if (url !== null && url !== "") {
|
||||||
|
addModel(url);
|
||||||
|
}
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
} else if (browseModelsButtonDown) {
|
||||||
|
var clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y });
|
||||||
|
if (browseModelsButton === toolBar.clicked(clickedOverlay)) {
|
||||||
|
url = Window.s3Browse(".*(fbx|FBX)");
|
||||||
|
if (url !== null && url !== "") {
|
||||||
|
addModel(url);
|
||||||
|
}
|
||||||
|
handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
newModelButtonDown = false;
|
||||||
|
browseModelsButtonDown = false;
|
||||||
|
|
||||||
|
return handled;
|
||||||
|
}
|
||||||
|
|
||||||
that.cleanup = function () {
|
that.cleanup = function () {
|
||||||
toolBar.cleanup();
|
toolBar.cleanup();
|
||||||
};
|
};
|
||||||
|
@ -533,6 +558,9 @@ function highlightEntityUnderCursor(position, accurateRay) {
|
||||||
|
|
||||||
|
|
||||||
function mouseReleaseEvent(event) {
|
function mouseReleaseEvent(event) {
|
||||||
|
if (toolBar.mouseReleaseEvent(event)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (placingEntityID) {
|
if (placingEntityID) {
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
selectionManager.setSelections([placingEntityID]);
|
selectionManager.setSelections([placingEntityID]);
|
||||||
|
|
Loading…
Reference in a new issue