mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 05:16:55 +02:00
Merge pull request #4198 from huffman/edit-always-on
editEntities.js always on
This commit is contained in:
commit
72c088fdc6
2 changed files with 55 additions and 25 deletions
|
@ -62,6 +62,11 @@ selectionManager.addEventListener(function() {
|
||||||
gridTool.setVisible(true);
|
gridTool.setVisible(true);
|
||||||
hasShownPropertiesTool = true;
|
hasShownPropertiesTool = true;
|
||||||
}
|
}
|
||||||
|
if (!selectionManager.hasSelection()) {
|
||||||
|
toolBar.setActive(false);
|
||||||
|
} else {
|
||||||
|
toolBar.setActive(true);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
|
@ -129,11 +134,13 @@ var toolBar = (function () {
|
||||||
function initialize() {
|
function initialize() {
|
||||||
toolBar = new ToolBar(0, 0, ToolBar.VERTICAL);
|
toolBar = new ToolBar(0, 0, ToolBar.VERTICAL);
|
||||||
|
|
||||||
|
// Hide active button for now - this may come back, so not deleting yet.
|
||||||
activeButton = toolBar.addTool({
|
activeButton = toolBar.addTool({
|
||||||
imageURL: toolIconUrl + "models-tool.svg",
|
imageURL: toolIconUrl + "models-tool.svg",
|
||||||
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
|
// subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: Tool.IMAGE_WIDTH, height: Tool.IMAGE_HEIGHT },
|
||||||
width: toolWidth,
|
subImage: { x: 0, y: Tool.IMAGE_WIDTH, width: 0, height: 0 },
|
||||||
height: toolHeight,
|
width: 0,//toolWidth,
|
||||||
|
height: 0,//toolHeight,
|
||||||
alpha: 0.9,
|
alpha: 0.9,
|
||||||
visible: true
|
visible: true
|
||||||
}, true, false);
|
}, true, false);
|
||||||
|
@ -548,7 +555,7 @@ function mouseMoveEvent(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseHasMovedSincePress = true;
|
mouseHasMovedSincePress = true;
|
||||||
if (isActive) {
|
|
||||||
// allow the selectionDisplay and cameraManager to handle the event first, if it doesn't handle it, then do our own thing
|
// allow the selectionDisplay and cameraManager to handle the event first, if it doesn't handle it, then do our own thing
|
||||||
if (selectionDisplay.mouseMoveEvent(event) || cameraManager.mouseMoveEvent(event)) {
|
if (selectionDisplay.mouseMoveEvent(event) || cameraManager.mouseMoveEvent(event)) {
|
||||||
return;
|
return;
|
||||||
|
@ -558,9 +565,6 @@ function mouseMoveEvent(event) {
|
||||||
|
|
||||||
highlightEntityUnderCursor(lastMousePosition, false);
|
highlightEntityUnderCursor(lastMousePosition, false);
|
||||||
idleMouseTimerId = Script.setTimeout(handleIdleMouse, IDLE_MOUSE_TIMEOUT);
|
idleMouseTimerId = Script.setTimeout(handleIdleMouse, IDLE_MOUSE_TIMEOUT);
|
||||||
} else {
|
|
||||||
cameraManager.mouseMoveEvent(event);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleIdleMouse() {
|
function handleIdleMouse() {
|
||||||
|
@ -613,7 +617,7 @@ function mouseReleaseEvent(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseClickEvent(event) {
|
function mouseClickEvent(event) {
|
||||||
if (!isActive) {
|
if (!event.isRightButton) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,6 +628,7 @@ function mouseClickEvent(event) {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
toolBar.setActive(true);
|
||||||
var pickRay = result.pickRay;
|
var pickRay = result.pickRay;
|
||||||
var foundEntity = result.entityID;
|
var foundEntity = result.entityID;
|
||||||
|
|
||||||
|
@ -837,6 +842,8 @@ Controller.keyReleaseEvent.connect(function (event) {
|
||||||
// since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items
|
// since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items
|
||||||
if (event.text == "BACKSPACE" || event.text == "DELETE") {
|
if (event.text == "BACKSPACE" || event.text == "DELETE") {
|
||||||
deleteSelectedEntities();
|
deleteSelectedEntities();
|
||||||
|
} else if (event.text == "ESC") {
|
||||||
|
selectionManager.clearSelections();
|
||||||
} else if (event.text == "TAB") {
|
} else if (event.text == "TAB") {
|
||||||
selectionDisplay.toggleSpaceMode();
|
selectionDisplay.toggleSpaceMode();
|
||||||
} else if (event.text == "f") {
|
} else if (event.text == "f") {
|
||||||
|
@ -1040,4 +1047,4 @@ PropertiesTool = function(opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
propertiesTool = PropertiesTool();
|
propertiesTool = PropertiesTool();
|
||||||
|
toolBar.setActive(true);
|
||||||
|
|
|
@ -267,6 +267,11 @@ CameraManager = function() {
|
||||||
if (that.enabled && that.mode != MODE_INACTIVE) {
|
if (that.enabled && that.mode != MODE_INACTIVE) {
|
||||||
var x = Window.getCursorPositionX();
|
var x = Window.getCursorPositionX();
|
||||||
var y = Window.getCursorPositionY();
|
var y = Window.getCursorPositionY();
|
||||||
|
if (!hasDragged) {
|
||||||
|
that.lastMousePosition.x = x;
|
||||||
|
that.lastMousePosition.y = y;
|
||||||
|
hasDragged = true;
|
||||||
|
}
|
||||||
if (that.mode == MODE_ORBIT) {
|
if (that.mode == MODE_ORBIT) {
|
||||||
var diffX = x - that.lastMousePosition.x;
|
var diffX = x - that.lastMousePosition.x;
|
||||||
var diffY = y - that.lastMousePosition.y;
|
var diffY = y - that.lastMousePosition.y;
|
||||||
|
@ -294,9 +299,31 @@ CameraManager = function() {
|
||||||
|
|
||||||
that.moveFocalPoint(dPosition);
|
that.moveFocalPoint(dPosition);
|
||||||
}
|
}
|
||||||
var newX = Window.x + Window.innerWidth / 2;
|
|
||||||
var newY = Window.y + Window.innerHeight / 2;
|
var newX = x;
|
||||||
|
var newY = y;
|
||||||
|
var updatePosition = false;
|
||||||
|
|
||||||
|
if (x <= Window.x) {
|
||||||
|
newX = Window.x + Window.innerWidth;
|
||||||
|
updatePosition = true;
|
||||||
|
} else if (x >= (Window.x + Window.innerWidth)) {
|
||||||
|
newX = Window.x;
|
||||||
|
updatePosition = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y <= Window.y) {
|
||||||
|
newY = Window.y + Window.innerHeight;
|
||||||
|
updatePosition = true;
|
||||||
|
} else if (y >= (Window.y + Window.innerHeight)) {
|
||||||
|
newY = Window.y;
|
||||||
|
updatePosition = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updatePosition) {
|
||||||
Window.setCursorPosition(newX, newY);
|
Window.setCursorPosition(newX, newY);
|
||||||
|
}
|
||||||
|
|
||||||
that.lastMousePosition.x = newX;
|
that.lastMousePosition.x = newX;
|
||||||
that.lastMousePosition.y = newY;
|
that.lastMousePosition.y = newY;
|
||||||
|
|
||||||
|
@ -305,6 +332,7 @@ CameraManager = function() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasDragged = false;
|
||||||
that.mousePressEvent = function(event) {
|
that.mousePressEvent = function(event) {
|
||||||
if (cameraTool.mousePressEvent(event)) {
|
if (cameraTool.mousePressEvent(event)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -319,12 +347,7 @@ CameraManager = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (that.mode != MODE_INACTIVE) {
|
if (that.mode != MODE_INACTIVE) {
|
||||||
var newX = Window.x + Window.innerWidth / 2;
|
hasDragged = false;
|
||||||
var newY = Window.y + Window.innerHeight / 2;
|
|
||||||
Window.setCursorPosition(newX, newY);
|
|
||||||
that.lastMousePosition.x = newX;
|
|
||||||
that.lastMousePosition.y = newY;
|
|
||||||
Window.setCursorVisible(false);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue