Set grid major div min to 1

This commit is contained in:
Zach Pomerantz 2016-02-19 15:58:08 -08:00
parent 5d78867197
commit c9362a4073
3 changed files with 8 additions and 6 deletions

View file

@ -146,7 +146,7 @@
<div class="property-section">
<label>Major Grid Every</label>
<span>
<input type='number' id="major-spacing" min="2" step="1", ></input>
<input type='number' id="major-spacing" min="1" step="1", ></input>
</span>
</div>

View file

@ -187,10 +187,10 @@ Grid = function(opts) {
that.setVisible(data.visible, true);
}
updateGrid();
updateGrid(true);
}
function updateGrid() {
function updateGrid(noUpdate) {
Overlays.editOverlay(gridOverlay, {
position: { x: 0, y: origin.y, z: 0 },
visible: that.visible && that.enabled,
@ -200,7 +200,9 @@ Grid = function(opts) {
alpha: gridAlpha,
});
that.emitUpdate();
if (!noUpdate) {
that.emitUpdate();
}
}
function cleanup() {
@ -243,7 +245,7 @@ GridTool = function(opts) {
} else if (data.type == "update") {
horizontalGrid.update(data);
for (var i = 0; i < listeners.length; i++) {
listeners[i](data);
listeners[i] && listeners[i](data);
}
} else if (data.type == "action") {
var action = data.action;

View file

@ -133,7 +133,7 @@ Grid3DOverlay* Grid3DOverlay::createClone() const {
}
void Grid3DOverlay::updateGrid() {
const int MAJOR_GRID_EVERY_MIN = 5;
const int MAJOR_GRID_EVERY_MIN = 1;
const float MINOR_GRID_EVERY_MIN = 0.2f;
_majorGridEvery = std::max(_majorGridEvery, MAJOR_GRID_EVERY_MIN);