mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 07:22:25 +02:00
Replace Overlays by Local Entities
1- Replace Overlays by Local Entities 2- Add the missing header with copyright and license (I have assumed that the author was the same person that make the grid parameter that is referenced there and only used in create App.) 3- Minor requested code change (0.0 instead of 0 in condition using real numbers)
This commit is contained in:
parent
bbde93f54b
commit
510eb08be1
1 changed files with 17 additions and 6 deletions
|
@ -1,3 +1,12 @@
|
|||
// gridTool.js
|
||||
//
|
||||
// Created by Ryan Huffman on 6 Nov 2014
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
// Copyright 2020 Vircadia contributors.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
/* global keyUpEventFromUIWindow */
|
||||
|
||||
var GRID_CONTROLS_HTML_URL = Script.resolvePath('../html/gridControls.html');
|
||||
|
@ -16,18 +25,19 @@ Grid = function() {
|
|||
|
||||
var snapToGrid = false;
|
||||
|
||||
var gridOverlay = Overlays.addOverlay("grid", {
|
||||
var gridEntityTool = Entities.addEntity({
|
||||
type: "Grid",
|
||||
rotation: Quat.fromPitchYawRollDegrees(90, 0, 0),
|
||||
dimensions: { x: scale, y: scale, z: scale },
|
||||
position: origin,
|
||||
visible: false,
|
||||
drawInFront: false,
|
||||
renderLayer: "world",
|
||||
color: gridColor,
|
||||
alpha: gridAlpha,
|
||||
minorGridEvery: minorGridEvery,
|
||||
majorGridEvery: majorGridEvery,
|
||||
ignorePickIntersection: true
|
||||
});
|
||||
}, "local");
|
||||
|
||||
that.visible = false;
|
||||
that.enabled = false;
|
||||
|
@ -166,7 +176,7 @@ Grid = function() {
|
|||
|
||||
that.moveToAvatar = function() {
|
||||
var position = MyAvatar.getJointPosition("LeftFoot");
|
||||
if (position.x === 0 && position.y === 0 && position.z === 0) {
|
||||
if (position.x === 0.0 && position.y === 0.0 && position.z === 0.0) {
|
||||
position = MyAvatar.position;
|
||||
}
|
||||
that.setPosition(position);
|
||||
|
@ -222,7 +232,7 @@ Grid = function() {
|
|||
};
|
||||
|
||||
function updateGrid(noUpdate) {
|
||||
Overlays.editOverlay(gridOverlay, {
|
||||
Entities.editEntity(gridEntityTool, {
|
||||
position: { x: 0, y: origin.y, z: 0 },
|
||||
visible: that.visible && that.enabled,
|
||||
minorGridEvery: minorGridEvery,
|
||||
|
@ -230,6 +240,7 @@ Grid = function() {
|
|||
color: gridColor,
|
||||
alpha: gridAlpha
|
||||
});
|
||||
|
||||
|
||||
if (!noUpdate) {
|
||||
that.emitUpdate();
|
||||
|
@ -237,7 +248,7 @@ Grid = function() {
|
|||
}
|
||||
|
||||
function cleanup() {
|
||||
Overlays.deleteOverlay(gridOverlay);
|
||||
Entities.deleteEntity(gridEntityTool);
|
||||
}
|
||||
|
||||
that.addListener = function(callback) {
|
||||
|
|
Loading…
Reference in a new issue