mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-29 12:39:55 +02:00
style fixes for eslint
This commit is contained in:
parent
c66badc53c
commit
6c15577653
1 changed files with 31 additions and 29 deletions
|
@ -1,6 +1,6 @@
|
||||||
var GRID_CONTROLS_HTML_URL = Script.resolvePath('../html/gridControls.html');
|
var GRID_CONTROLS_HTML_URL = Script.resolvePath('../html/gridControls.html');
|
||||||
|
|
||||||
Grid = function (opts) {
|
Grid = function(opts) {
|
||||||
var that = {};
|
var that = {};
|
||||||
var gridColor = { red: 0, green: 0, blue: 0 };
|
var gridColor = { red: 0, green: 0, blue: 0 };
|
||||||
var gridAlpha = 0.6;
|
var gridAlpha = 0.6;
|
||||||
|
@ -29,52 +29,54 @@ Grid = function (opts) {
|
||||||
that.visible = false;
|
that.visible = false;
|
||||||
that.enabled = false;
|
that.enabled = false;
|
||||||
|
|
||||||
that.getOrigin = function () {
|
that.getOrigin = function() {
|
||||||
return origin;
|
return origin;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.getMinorIncrement = function () {
|
that.getMinorIncrement = function() {
|
||||||
return minorGridEvery;
|
return minorGridEvery;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.setMinorIncrement = function (value) {
|
that.setMinorIncrement = function(value) {
|
||||||
minorGridEvery = value;
|
minorGridEvery = value;
|
||||||
updateGrid();
|
updateGrid();
|
||||||
};
|
};
|
||||||
|
|
||||||
that.getMajorIncrement = function () {
|
that.getMajorIncrement = function() {
|
||||||
return majorGridEvery;
|
return majorGridEvery;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.setMajorIncrement = function (value) {
|
that.setMajorIncrement = function(value) {
|
||||||
majorGridEvery = value;
|
majorGridEvery = value;
|
||||||
updateGrid();
|
updateGrid();
|
||||||
};
|
};
|
||||||
|
|
||||||
that.getColor = function () {
|
that.getColor = function() {
|
||||||
return gridColor;
|
return gridColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
that.setColor = function (value) {
|
that.setColor = function(value) {
|
||||||
gridColor = value;
|
gridColor = value;
|
||||||
updateGrid();
|
updateGrid();
|
||||||
};
|
};
|
||||||
|
|
||||||
that.getSnapToGrid = function () {
|
that.getSnapToGrid = function() {
|
||||||
return snapToGrid;
|
return snapToGrid;
|
||||||
};
|
};
|
||||||
that.setSnapToGrid = function (value) {
|
that.setSnapToGrid = function(value) {
|
||||||
snapToGrid = value;
|
snapToGrid = value;
|
||||||
that.emitUpdate();
|
that.emitUpdate();
|
||||||
};
|
};
|
||||||
|
|
||||||
that.setEnabled = function (enabled) {
|
that.setEnabled = function(enabled) {
|
||||||
that.enabled = enabled;
|
that.enabled = enabled;
|
||||||
updateGrid();
|
updateGrid();
|
||||||
};
|
};
|
||||||
|
|
||||||
that.getVisible = function () { return that.visible; };
|
that.getVisible = function() {
|
||||||
that.setVisible = function (visible, noUpdate) {
|
return that.visible;
|
||||||
|
};
|
||||||
|
that.setVisible = function(visible, noUpdate) {
|
||||||
that.visible = visible;
|
that.visible = visible;
|
||||||
updateGrid();
|
updateGrid();
|
||||||
|
|
||||||
|
@ -83,7 +85,7 @@ Grid = function (opts) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
that.snapToSurface = function (position, dimensions, registration) {
|
that.snapToSurface = function(position, dimensions, registration) {
|
||||||
if (!snapToGrid) {
|
if (!snapToGrid) {
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +105,7 @@ Grid = function (opts) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
that.snapToGrid = function (position, majorOnly, dimensions, registration) {
|
that.snapToGrid = function(position, majorOnly, dimensions, registration) {
|
||||||
if (!snapToGrid) {
|
if (!snapToGrid) {
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
@ -125,9 +127,9 @@ Grid = function (opts) {
|
||||||
position.z = Math.round(position.z / spacing) * spacing;
|
position.z = Math.round(position.z / spacing) * spacing;
|
||||||
|
|
||||||
return Vec3.sum(Vec3.sum(position, Vec3.multiplyVbyV(registration, dimensions)), origin);
|
return Vec3.sum(Vec3.sum(position, Vec3.multiplyVbyV(registration, dimensions)), origin);
|
||||||
}
|
};
|
||||||
|
|
||||||
that.snapToSpacing = function (delta, majorOnly) {
|
that.snapToSpacing = function(delta, majorOnly) {
|
||||||
if (!snapToGrid) {
|
if (!snapToGrid) {
|
||||||
return delta;
|
return delta;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +146,7 @@ Grid = function (opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
that.setPosition = function (newPosition, noUpdate) {
|
that.setPosition = function(newPosition, noUpdate) {
|
||||||
origin = { x: 0, y: newPosition.y, z: 0 };
|
origin = { x: 0, y: newPosition.y, z: 0 };
|
||||||
updateGrid();
|
updateGrid();
|
||||||
|
|
||||||
|
@ -153,7 +155,7 @@ Grid = function (opts) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
that.emitUpdate = function () {
|
that.emitUpdate = function() {
|
||||||
if (that.onUpdate) {
|
if (that.onUpdate) {
|
||||||
that.onUpdate({
|
that.onUpdate({
|
||||||
origin: origin,
|
origin: origin,
|
||||||
|
@ -166,7 +168,7 @@ Grid = function (opts) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
that.update = function (data) {
|
that.update = function(data) {
|
||||||
if (data.snapToGrid !== undefined) {
|
if (data.snapToGrid !== undefined) {
|
||||||
snapToGrid = data.snapToGrid;
|
snapToGrid = data.snapToGrid;
|
||||||
}
|
}
|
||||||
|
@ -223,7 +225,7 @@ Grid = function (opts) {
|
||||||
|
|
||||||
that.addListener = function (callback) {
|
that.addListener = function (callback) {
|
||||||
that.onUpdate = callback;
|
that.onUpdate = callback;
|
||||||
}
|
};
|
||||||
|
|
||||||
Script.scriptEnding.connect(cleanup);
|
Script.scriptEnding.connect(cleanup);
|
||||||
updateGrid();
|
updateGrid();
|
||||||
|
@ -233,7 +235,7 @@ Grid = function (opts) {
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
GridTool = function (opts) {
|
GridTool = function(opts) {
|
||||||
var that = {};
|
var that = {};
|
||||||
|
|
||||||
var horizontalGrid = opts.horizontalGrid;
|
var horizontalGrid = opts.horizontalGrid;
|
||||||
|
@ -244,18 +246,18 @@ GridTool = function (opts) {
|
||||||
webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
webView.setVisible = function (value) { };
|
webView.setVisible = function (value) { };
|
||||||
|
|
||||||
horizontalGrid.addListener(function (data) {
|
horizontalGrid.addListener(function(data) {
|
||||||
webView.emitScriptEvent(JSON.stringify(data));
|
webView.emitScriptEvent(JSON.stringify(data));
|
||||||
if (selectionDisplay) {
|
if (selectionDisplay) {
|
||||||
selectionDisplay.updateHandles();
|
selectionDisplay.updateHandles();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
webView.webEventReceived.connect(function (data) {
|
webView.webEventReceived.connect(function(data) {
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print("gridTool.js: Error parsing JSON: " + e.name + " data " + data)
|
print("gridTool.js: Error parsing JSON: " + e.name + " data " + data);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,13 +284,13 @@ GridTool = function (opts) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
that.addListener = function (callback) {
|
that.addListener = function(callback) {
|
||||||
listeners.push(callback);
|
listeners.push(callback);
|
||||||
}
|
};
|
||||||
|
|
||||||
that.setVisible = function (visible) {
|
that.setVisible = function(visible) {
|
||||||
webView.setVisible(visible);
|
webView.setVisible(visible);
|
||||||
}
|
};
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue