| @@ -619,7 +619,15 @@ function updateSizes(dirtyOnly = false) { | |||||
| updateRatios(); | updateRatios(); | ||||
| if (config.lockYAxis) { | if (config.lockYAxis) { | ||||
| config.y = 0; | |||||
| if (config.groundPos === "high") { | |||||
| config.y = -config.height.toNumber("meters") / 2; | |||||
| } else if (config.groundPos === "medium") { | |||||
| config.y = -config.height.toNumber("meters") / 4; | |||||
| } else if (config.groundPos === "low") { | |||||
| config.y = -config.height.toNumber("meters") / 6; | |||||
| } else { | |||||
| config.y = 0; | |||||
| } | |||||
| } | } | ||||
| drawScales(dirtyOnly); | drawScales(dirtyOnly); | ||||
| @@ -2244,6 +2252,25 @@ const settingsData = { | |||||
| } | } | ||||
| } | } | ||||
| }, | }, | ||||
| "ground-pos": { | |||||
| name: "Ground Position", | |||||
| desc: "How high the ground is if the y-axis is locked", | |||||
| type: "select", | |||||
| default: "bottom", | |||||
| options: [ | |||||
| "high", | |||||
| "medium", | |||||
| "low", | |||||
| "bottom" | |||||
| ], | |||||
| get value() { | |||||
| return config.groundPos; | |||||
| }, | |||||
| set value(param) { | |||||
| config.groundPos = param; | |||||
| updateSizes(); | |||||
| } | |||||
| }, | |||||
| "auto-scale": { | "auto-scale": { | ||||
| name: "Auto-Size World", | name: "Auto-Size World", | ||||
| desc: "Constantly zoom to fit the largest entity", | desc: "Constantly zoom to fit the largest entity", | ||||
| @@ -3724,7 +3751,25 @@ function prepareEntities() { | |||||
| button.addEventListener("click", e => { | button.addEventListener("click", e => { | ||||
| const newEntity = entityList[select.value].constructor() | const newEntity = entityList[select.value].constructor() | ||||
| displayEntity(newEntity, newEntity.defaultView, config.x, config.y + (config.lockYAxis ? 0 : config.height.toNumber("meters")/2), true, true); | |||||
| let yOffset = 0; | |||||
| if (config.lockYAxis) { | |||||
| if (config.groundPos === "high") { | |||||
| yOffset = config.height.toNumber("meters")/2; | |||||
| } | |||||
| else if (config.groundPos === "medium") { | |||||
| yOffset = config.height.toNumber("meters")/4; | |||||
| } | |||||
| else if (config.groundPos === "low") { | |||||
| yOffset = config.height.toNumber("meters")/6; | |||||
| } | |||||
| else if (config.groundPos === "bottom") { | |||||
| yOffset = 0; | |||||
| } | |||||
| } else { | |||||
| yOffset = (config.lockYAxis ? 0 : config.height.toNumber("meters")/2); | |||||
| } | |||||
| displayEntity(newEntity, newEntity.defaultView, config.x, config.y + yOffset, true, true); | |||||
| }); | }); | ||||
| const categoryOption = document.createElement("option"); | const categoryOption = document.createElement("option"); | ||||