mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 06:37:27 +02:00
Move handling of add model buttons to mouseRelease
This commit is contained in:
parent
d1f7a730ad
commit
97e70920ce
1 changed files with 38 additions and 10 deletions
|
@ -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