| @@ -1166,6 +1166,19 @@ function displayEntity(entity, view, x, y, selectEntity = false, refresh = false | |||||
| entity.dirty = true; | entity.dirty = true; | ||||
| if (refresh && config.autoFitAdd) { | |||||
| const x = parseFloat(selected.dataset.x); | |||||
| Object.keys(entities).forEach(id => { | |||||
| const element = document.querySelector("#entity-" + id); | |||||
| const newX = parseFloat(element.dataset.x) - x + 0.5; | |||||
| element.dataset.x = newX; | |||||
| }); | |||||
| const entity = entities[selected.dataset.key]; | |||||
| const height = math.multiply(entity.views[entity.view].height, 1.1); | |||||
| setWorldHeight(config.height, height); | |||||
| } | |||||
| if (refresh) | if (refresh) | ||||
| updateSizes(true); | updateSizes(true); | ||||
| } | } | ||||
| @@ -1338,6 +1351,18 @@ const settingsData = { | |||||
| checkFitWorld(); | checkFitWorld(); | ||||
| } | } | ||||
| }, | }, | ||||
| "zoom-when-adding": { | |||||
| name: "Zoom When Adding", | |||||
| desc: "Zoom to fit when you add a new entity", | |||||
| type: "toggle", | |||||
| default: false, | |||||
| get value() { | |||||
| return config.autoFitAdd; | |||||
| }, | |||||
| set value(param) { | |||||
| config.autoFitAdd = param; | |||||
| } | |||||
| }, | |||||
| "names": { | "names": { | ||||
| name: "Show Names", | name: "Show Names", | ||||
| desc: "Display names over entities", | desc: "Display names over entities", | ||||