mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 23:57:13 +02:00
Merge pull request #11957 from zfox23/commerce_fixEditDependencies
Further remove dependencies of marketplaces.js on edit.js
This commit is contained in:
commit
b5899f7a00
2 changed files with 34 additions and 6 deletions
|
@ -242,7 +242,9 @@ GridTool = function(opts) {
|
||||||
|
|
||||||
horizontalGrid.addListener(function(data) {
|
horizontalGrid.addListener(function(data) {
|
||||||
webView.emitScriptEvent(JSON.stringify(data));
|
webView.emitScriptEvent(JSON.stringify(data));
|
||||||
selectionDisplay.updateHandles();
|
if (selectionDisplay) {
|
||||||
|
selectionDisplay.updateHandles();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
webView.webEventReceived.connect(function(data) {
|
webView.webEventReceived.connect(function(data) {
|
||||||
|
|
|
@ -11,9 +11,12 @@
|
||||||
/* global Tablet, Script, HMD, UserActivityLogger, Entities */
|
/* global Tablet, Script, HMD, UserActivityLogger, Entities */
|
||||||
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
|
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
|
||||||
|
|
||||||
|
var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
|
|
||||||
(function () { // BEGIN LOCAL_SCOPE
|
(function () { // BEGIN LOCAL_SCOPE
|
||||||
|
|
||||||
Script.include("../libraries/WebTablet.js");
|
Script.include("/~/system/libraries/WebTablet.js");
|
||||||
|
Script.include("/~/system/libraries/gridTool.js");
|
||||||
|
|
||||||
var METAVERSE_SERVER_URL = Account.metaverseServerURL;
|
var METAVERSE_SERVER_URL = Account.metaverseServerURL;
|
||||||
var MARKETPLACE_URL = METAVERSE_SERVER_URL + "/marketplace";
|
var MARKETPLACE_URL = METAVERSE_SERVER_URL + "/marketplace";
|
||||||
|
@ -170,6 +173,33 @@
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var grid = new Grid();
|
||||||
|
function adjustPositionPerBoundingBox(position, direction, registration, dimensions, orientation) {
|
||||||
|
// Adjust the position such that the bounding box (registration, dimenions, and orientation) lies behind the original
|
||||||
|
// position in the given direction.
|
||||||
|
var CORNERS = [
|
||||||
|
{ x: 0, y: 0, z: 0 },
|
||||||
|
{ x: 0, y: 0, z: 1 },
|
||||||
|
{ x: 0, y: 1, z: 0 },
|
||||||
|
{ x: 0, y: 1, z: 1 },
|
||||||
|
{ x: 1, y: 0, z: 0 },
|
||||||
|
{ x: 1, y: 0, z: 1 },
|
||||||
|
{ x: 1, y: 1, z: 0 },
|
||||||
|
{ x: 1, y: 1, z: 1 },
|
||||||
|
];
|
||||||
|
|
||||||
|
// Go through all corners and find least (most negative) distance in front of position.
|
||||||
|
var distance = 0;
|
||||||
|
for (var i = 0, length = CORNERS.length; i < length; i++) {
|
||||||
|
var cornerVector =
|
||||||
|
Vec3.multiplyQbyV(orientation, Vec3.multiplyVbyV(Vec3.subtract(CORNERS[i], registration), dimensions));
|
||||||
|
var cornerDistance = Vec3.dot(cornerVector, direction);
|
||||||
|
distance = Math.min(cornerDistance, distance);
|
||||||
|
}
|
||||||
|
position = Vec3.sum(Vec3.multiply(distance, direction), position);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
var HALF_TREE_SCALE = 16384;
|
var HALF_TREE_SCALE = 16384;
|
||||||
function getPositionToCreateEntity(extra) {
|
function getPositionToCreateEntity(extra) {
|
||||||
var CREATE_DISTANCE = 2;
|
var CREATE_DISTANCE = 2;
|
||||||
|
@ -258,10 +288,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isActive) {
|
|
||||||
selectionManager.setSelections(pastedEntityIDs);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
Window.notifyEditError("Can't import entities: entities would be out of bounds.");
|
Window.notifyEditError("Can't import entities: entities would be out of bounds.");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue