From 047e89a3f4e363d9f4a56e2f014d7858a32d40bc Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Tue, 23 Jun 2020 12:39:59 -0400 Subject: [PATCH] Fix auto-fit/zoom working incorrectly with the y-axis locked Entities positioned above the ground were going off the screen. --- macrovision.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/macrovision.js b/macrovision.js index d540be46..c7d69ce8 100644 --- a/macrovision.js +++ b/macrovision.js @@ -1550,15 +1550,9 @@ function displayEntity(entity, view, x, y, selectEntity = false, refresh = false entity.dirty = true; if (refresh && config.autoFitAdd) { - const x = parseFloat(selected.dataset.x); - const y = parseFloat(selected.dataset.y); - - config.x = x; - config.y = y; - - const entity = entities[selected.dataset.key]; - const height = math.multiply(entity.views[entity.view].height, 1.1); - setWorldHeight(config.height, height); + let targets = {}; + targets[entityIndex - 1] = entity; + fitEntities(targets); } if (refresh) updateSizes(true); @@ -3358,6 +3352,9 @@ function fitEntities(targetEntities, manual = false, factor = 1.1) { count += 1; }); + if (config.lockYAxis) { + minY = 0; + } let ySize = (maxY - minY) * factor; let xSize = (maxX - minX) * factor;