From 086917084d17b81e01000557817534f8cf7a3cff Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Thu, 20 Feb 2020 10:48:52 -0500 Subject: [PATCH] Reformat the source files --- macrovision.js | 34 +++++------ presets/buildings.js | 4 +- presets/characters.js | 132 +++++++++++++++++++++--------------------- presets/cities.js | 4 +- presets/landmarks.js | 2 +- presets/naturals.js | 2 +- presets/objects.js | 2 +- presets/scenes.js | 2 +- presets/vehicles.js | 6 +- 9 files changed, 94 insertions(+), 94 deletions(-) diff --git a/macrovision.js b/macrovision.js index 2309f702..5ff616ed 100644 --- a/macrovision.js +++ b/macrovision.js @@ -118,7 +118,7 @@ function updateSizes() { drawScale(); let ordered = Object.entries(entities); - + ordered.sort((e1, e2) => { return e1[1].views[e1[1].view].height.toNumber("meters") - e2[1].views[e2[1].view].height.toNumber("meters") }); @@ -131,7 +131,7 @@ function updateSizes() { zIndex -= 1; }); - + } function drawScale() { @@ -408,7 +408,7 @@ function configEntityOptions(entity, view) { entity.sizes.forEach(defaultInfo => { const button = document.createElement("button"); button.classList.add("options-button"); - + button.innerText = defaultInfo.name; button.addEventListener("click", e => { @@ -483,12 +483,12 @@ function configViewOptions(entity, view) { }); select.setAttribute("oldUnit", select.value); - + select.addEventListener("input", e => { const value = input.value == 0 ? 1 : input.value; const oldUnit = select.getAttribute("oldUnit"); entity.views[view][key] = math.unit(value, oldUnit).to(select.value); - input.value = entity.views[view][key].toNumber(select.value); + input.value = entity.views[view][key].toNumber(select.value); select.setAttribute("oldUnit", select.value); @@ -543,7 +543,7 @@ function testClick(event) { clickDown(target.parentElement, event.clientX, event.clientY); return; } - + // Get click coordinates let w = target.width; @@ -567,8 +567,8 @@ function testClick(event) { var x = event.clientX - target.getBoundingClientRect().x, y = event.clientY - target.getBoundingClientRect().y, alpha; - testCtx.canvas.width = w; - testCtx.canvas.height = h; + testCtx.canvas.width = w; + testCtx.canvas.height = h; // Draw image to canvas // and read Alpha channel value @@ -703,7 +703,7 @@ document.addEventListener("DOMContentLoaded", () => { option.innerText = lengthOption; option.value = lengthOption; - + if (lengthOption === "meters") { option.selected = true; } @@ -722,7 +722,7 @@ document.addEventListener("DOMContentLoaded", () => { x += 0.7 / stuff.length; }) - + const order = Object.keys(entities).sort((a, b) => { const entA = entities[a]; @@ -784,7 +784,7 @@ document.addEventListener("DOMContentLoaded", () => { entities[selected.dataset.key].view = e.target.value; const image = entities[selected.dataset.key].views[e.target.value].image; selected.querySelector(".entity-image").src = image.source; - + if (image.bottom !== undefined) { selected.querySelector(".entity-image").style.setProperty("--offset", ((-1 + image.bottom) * 100) + "%") } else { @@ -819,7 +819,7 @@ document.addEventListener("DOMContentLoaded", () => { document.querySelector("#options-world-autofit").addEventListener("input", e => { config.autoFit = e.target.checked; - + if (config.autoFit) { fitWorld(); @@ -828,7 +828,7 @@ document.addEventListener("DOMContentLoaded", () => { document.querySelector("#options-world-autofit-mode").addEventListener("input", e => { config.autoFitMode = e.target.value; - + if (config.autoFit) { fitWorld(); } @@ -863,7 +863,7 @@ document.addEventListener("DOMContentLoaded", () => { } }); - + document.addEventListener("paste", e => { try { const data = JSON.parse(e.clipboardData.getData("text")); @@ -875,9 +875,9 @@ document.addEventListener("DOMContentLoaded", () => { } importScene(data); - } catch(err) { + } catch (err) { console.error(err); - + // probably wasn't valid data } }); @@ -904,7 +904,7 @@ function prepareEntities() { availableEntities["vehicles"] = makeVehicles(); availableEntities["cities"] = makeCities(); - availableEntities["characters"].sort((x,y) => { + availableEntities["characters"].sort((x, y) => { return x.name < y.name ? -1 : 1 }); const holder = document.querySelector("#spawners"); diff --git a/presets/buildings.js b/presets/buildings.js index 774b5b29..45622009 100644 --- a/presets/buildings.js +++ b/presets/buildings.js @@ -24,7 +24,7 @@ function makeBuilding(name, height, image) { }, }; - return makeEntity({name: name}, views); + return makeEntity({ name: name }, views); } @@ -63,7 +63,7 @@ function makeSkyscraper(name, image, startingSize) { height: math.unit(650, "meters") }); - const entity = makeEntity({name: name}, views, sizes); + const entity = makeEntity({ name: name }, views, sizes); entity.views[entity.defaultView].height = startingSize; return entity; diff --git a/presets/characters.js b/presets/characters.js index db839cc6..38179162 100644 --- a/presets/characters.js +++ b/presets/characters.js @@ -35,7 +35,7 @@ function makeCharacter(name, author, viewInfo, defaultSizes, defaultSize) { } }); - const entity = makeEntity({name: name}, views, defaultSizes); + const entity = makeEntity({ name: name }, views, defaultSizes); if (defaultSize) { entity.views[entity.defaultView].height = defaultSize; @@ -180,7 +180,7 @@ function makeMarch() { } }; - const entity = makeEntity({name: "March", author: "March-Dragon"}, views, []); + const entity = makeEntity({ name: "March", author: "March-Dragon" }, views, []); entity.sizes.push({ name: "Normal", @@ -241,7 +241,7 @@ function makeNoir() { } }; - const entity = makeEntity({name: "Noir", author: "March-Dragon"}, views, []); + const entity = makeEntity({ name: "Noir", author: "March-Dragon" }, views, []); entity.sizes.push({ name: "Normal", @@ -321,7 +321,7 @@ function makeOkuri() { } }; - const entity = makeEntity({name: "Okuri", author: "OrionMechadragon"}, views, []); + const entity = makeEntity({ name: "Okuri", author: "OrionMechadragon" }, views, []); entity.views.front.height = math.unit(100, "miles"); return entity; } @@ -370,7 +370,7 @@ function makeManny() { } }; - const entity = makeEntity({name: "Manny", author: "Dialuca01"}, views, []); + const entity = makeEntity({ name: "Manny", author: "Dialuca01" }, views, []); entity.sizes.push({ name: "Normal", @@ -392,7 +392,7 @@ function makeManny() { name: "Gigamacro", height: math.unit(41769, "miles") }); - + entity.views.front.height = math.unit(78, "feet"); return entity; } @@ -483,8 +483,8 @@ function makeAdake() { }, }; - const entity = makeEntity({name: "Adake", author: "Dialuca01"}, views, []); - + const entity = makeEntity({ name: "Adake", author: "Dialuca01" }, views, []); + entity.sizes.push({ name: "Normal", height: math.unit(7, "feet") @@ -548,7 +548,7 @@ function makeElijah() { } }; - const entity = makeEntity({name: "Elijah", author: "Elijah"}, views, []); + const entity = makeEntity({ name: "Elijah", author: "Elijah" }, views, []); entity.sizes.push({ name: "Normal", @@ -633,7 +633,7 @@ function makeRai() { } }; - const entity = makeEntity({name: "Rai", author: "shadowblade945"}, views, []); + const entity = makeEntity({ name: "Rai", author: "shadowblade945" }, views, []); entity.views.front.height = math.unit(302, "feet"); return entity; } @@ -683,7 +683,7 @@ function makeJazzy() { } }; - const entity = makeEntity({name: "Jazzy", author: "Jazzywolf"}, views, []); + const entity = makeEntity({ name: "Jazzy", author: "Jazzywolf" }, views, []); entity.views.front.height = math.unit(216, "feet"); return entity; } @@ -712,7 +712,7 @@ function makeFlamm() { } }; - const entity = makeEntity({name: "Flamm", author: "Flamm"}, views, []); + const entity = makeEntity({ name: "Flamm", author: "Flamm" }, views, []); entity.sizes.push({ name: "Normal", @@ -792,8 +792,8 @@ function makeZephiro() { } }; - const entity = makeEntity({name: "Zephiro", author: "Zephiro"}, views, []); - entity.views.front.height = math.unit(118, "feet"); + const entity = makeEntity({ name: "Zephiro", author: "Zephiro" }, views, []); + entity.views.front.height = math.unit(118, "feet"); entity.sizes.push({ name: "Micro", @@ -802,7 +802,7 @@ function makeZephiro() { entity.sizes.push({ name: "Normal", - height: math.unit(5 + 3/12, "feet") + height: math.unit(5 + 3 / 12, "feet") }); entity.sizes.push({ @@ -837,8 +837,8 @@ function makeFory() { } }; - const entity = makeEntity({name: "Fory", author: "Manny"}, views, []); - + const entity = makeEntity({ name: "Fory", author: "Manny" }, views, []); + entity.sizes.push({ name: "Normal", @@ -941,7 +941,7 @@ function makeKurrikage() { } }; - const entity = makeEntity({name: "Kurrikage", author: "Kurrikage"}, views, []); + const entity = makeEntity({ name: "Kurrikage", author: "Kurrikage" }, views, []); entity.views.front.height = math.unit(12, "feet"); return entity; } @@ -970,7 +970,7 @@ function makeShingo() { } }; - const entity = makeEntity({name: "Shingo", author: "Threes"}, views, []); + const entity = makeEntity({ name: "Shingo", author: "Threes" }, views, []); entity.sizes.push({ name: "Micro", @@ -1013,7 +1013,7 @@ function makeAigey() { } }; - const entity = makeEntity({name: "Aigey", author: "Aigey"}, views, []); + const entity = makeEntity({ name: "Aigey", author: "Aigey" }, views, []); entity.sizes.push({ name: "Macro", @@ -1024,9 +1024,9 @@ function makeAigey() { name: "Megamacro", height: math.unit(100, "miles") }); - + entity.views[entity.defaultView].height = math.unit(200, "feet"); - + return entity; } @@ -1054,11 +1054,11 @@ function makeNatasha() { } }; - const entity = makeEntity({name: "Natasha", author: "Natasha"}, views, []); + const entity = makeEntity({ name: "Natasha", author: "Natasha" }, views, []); entity.sizes.push({ name: "Normal", - height: math.unit(5 + 5/12, "feet") + height: math.unit(5 + 5 / 12, "feet") }); entity.sizes.push({ @@ -1079,9 +1079,9 @@ function makeNatasha() { name: "Macro++", height: math.unit(1, "mile") }); - + entity.views[entity.defaultView].height = math.unit(100, "feet"); - + return entity; } @@ -1150,7 +1150,7 @@ function makeMalik() { }, }; - const entity = makeEntity({name: "Malik", author: "Fuzzypaws"}, views, []); + const entity = makeEntity({ name: "Malik", author: "Fuzzypaws" }, views, []); entity.sizes.push({ name: "Macro", @@ -1163,7 +1163,7 @@ function makeMalik() { }); entity.views[entity.defaultView].height = math.unit(156, "feet"); - + return entity; } @@ -1211,10 +1211,10 @@ function makeSefer() { }, }; - const entity = makeEntity({name: "Sefer", author: "Fuzzypaws"}, views, []); + const entity = makeEntity({ name: "Sefer", author: "Fuzzypaws" }, views, []); entity.views[entity.defaultView].height = math.unit(6, "feet"); - + return entity; } @@ -1228,7 +1228,7 @@ characterMakers["North"] = () => { weight: math.unit(124.738, "kg"), name: "Body", image: { - extra: 1225/1050, + extra: 1225 / 1050, source: "./media/characters/north/front.svg" } } @@ -1721,7 +1721,7 @@ characterMakers["GiantGrowingVixen"] = () => { [ { name: "Extremely Puny", - height: math.unit(9 + 5/12, "feet") + height: math.unit(9 + 5 / 12, "feet") }, { name: "Horribly Small", @@ -1774,28 +1774,28 @@ characterMakers["Asana"] = () => { "Asana", { front: { - height: math.unit(7 + 5/6, "feet"), + height: math.unit(7 + 5 / 6, "feet"), weight: math.unit(325, "lb"), name: "Front", image: { source: "./media/characters/asana/front.svg", - extra: 1128/1068 + extra: 1128 / 1068 } }, back: { - height: math.unit(7 + 5/6, "feet"), + height: math.unit(7 + 5 / 6, "feet"), weight: math.unit(325, "lb"), name: "Back", image: { source: "./media/characters/asana/back.svg", - extra: 1128/1068 + extra: 1128 / 1068 } }, }, [ { name: "Standard", - height: math.unit(7 + 5/6, "feet") + height: math.unit(7 + 5 / 6, "feet") }, { name: "Large", @@ -1814,7 +1814,7 @@ characterMakers["Asana"] = () => { height: math.unit(5e12, "lightyears") } ], - math.unit(7 + 5/6, "feet") + math.unit(7 + 5 / 6, "feet") ) }; @@ -1830,7 +1830,7 @@ characterMakers["Ebony"] = () => { image: { source: "./media/characters/ebony/front.svg", bottom: 0.03, - extra: 1045/810 + 0.03 + extra: 1045 / 810 + 0.03 } }, side: { @@ -1840,7 +1840,7 @@ characterMakers["Ebony"] = () => { image: { source: "./media/characters/ebony/side.svg", bottom: 0.03, - extra: 1045/810 + 0.03 + extra: 1045 / 810 + 0.03 } }, back: { @@ -1850,14 +1850,14 @@ characterMakers["Ebony"] = () => { image: { source: "./media/characters/ebony/back.svg", bottom: 0.01, - extra: 1045/810 + 0.01 + extra: 1045 / 810 + 0.01 } }, }, [ { name: "Standard", - height: math.unit(9/8 * (7 + 5/12), "feet") + height: math.unit(9 / 8 * (7 + 5 / 12), "feet") }, { name: "Macro", @@ -1868,7 +1868,7 @@ characterMakers["Ebony"] = () => { height: math.unit(13000, "km") } ], - math.unit(7 + 5/12, "feet") + math.unit(7 + 5 / 12, "feet") ) }; @@ -2140,7 +2140,7 @@ characterMakers["Cryae"] = () => { name: "Side", image: { source: "./media/characters/cryae/side.svg", - extra: 3500/1500 + extra: 3500 / 1500 } } }, @@ -2165,7 +2165,7 @@ characterMakers["Xera"] = () => { name: "Front", image: { source: "./media/characters/xera/front.svg", - extra: 2300/2061 + extra: 2300 / 2061 } }, side: { @@ -2174,7 +2174,7 @@ characterMakers["Xera"] = () => { name: "Side", image: { source: "./media/characters/xera/side.svg", - extra: 2300/2061 + extra: 2300 / 2061 } }, back: { @@ -2223,7 +2223,7 @@ characterMakers["Nebula"] = () => { name: "Front", image: { source: "./media/characters/nebula/front.svg", - extra: 2600/2450 + extra: 2600 / 2450 } } }, @@ -2523,7 +2523,7 @@ characterMakers["Chez"] = () => { "Ashtrek", { front: { - height: math.unit(7 + 9/12, "feet"), + height: math.unit(7 + 9 / 12, "feet"), weight: math.unit(379, "lbs"), name: "Front", image: { @@ -2531,7 +2531,7 @@ characterMakers["Chez"] = () => { } }, side: { - height: math.unit(7 + 9/12, "feet"), + height: math.unit(7 + 9 / 12, "feet"), weight: math.unit(379, "lbs"), name: "Side", image: { @@ -2542,14 +2542,14 @@ characterMakers["Chez"] = () => { [ { name: "Normal", - height: math.unit(7 + 9/12, "feet") + height: math.unit(7 + 9 / 12, "feet") }, { name: "God King", height: math.unit(9750000, "meters") } ], - math.unit(7 + 9/12, "feet") + math.unit(7 + 9 / 12, "feet") ) }; @@ -2565,7 +2565,7 @@ characterMakers["Kaylum"] = () => { image: { source: "./media/characters/kaylum/front.svg", bottom: 0.01, - extra: 1166/1031 + extra: 1166 / 1031 } }, frontWingless: { @@ -2575,7 +2575,7 @@ characterMakers["Kaylum"] = () => { image: { source: "./media/characters/kaylum/front-wingless.svg", bottom: 0.01, - extra: 1117/1031 + extra: 1117 / 1031 } } @@ -2632,7 +2632,7 @@ characterMakers["Geta"] = () => { }, { name: "Normal", - height: math.unit(5 + 5/12, "feet") + height: math.unit(5 + 5 / 12, "feet") } ], math.unit(3, "inches") @@ -2886,7 +2886,7 @@ characterMakers["Sigvald"] = () => { name: "Front", image: { source: "./media/characters/sigvald/front.svg", - extra: 1000/850 + extra: 1000 / 850 } }, back: { @@ -2964,7 +2964,7 @@ characterMakers["Tobias"] = () => { name: "Side", image: { source: "./media/characters/tobias/side.svg", - extra: 5/4 + extra: 5 / 4 } }, }, @@ -2993,7 +2993,7 @@ characterMakers["Kieran"] = () => { name: "Side", image: { source: "./media/characters/kieran/side.svg", - extra: 950/850 + extra: 950 / 850 } }, }, @@ -3047,7 +3047,7 @@ characterMakers["Miranda"] = () => { name: "Front", image: { source: "./media/characters/miranda/front.svg", - extra: 10.6/10 + extra: 10.6 / 10 } }, }, @@ -3072,7 +3072,7 @@ characterMakers["James"] = () => { name: "Front", image: { source: "./media/characters/james/front.svg", - extra: 10/8.5 + extra: 10 / 8.5 } }, }, @@ -3121,7 +3121,7 @@ characterMakers["Lukas"] = () => { name: "Side", image: { source: "./media/characters/lukas/side.svg", - extra: 7.25/6.5 + extra: 7.25 / 6.5 } }, }, @@ -3202,7 +3202,7 @@ characterMakers["Deerpuff"] = () => { name: "Standing", image: { source: "./media/characters/deerpuff/standing.svg", - extra: 682/624 + extra: 682 / 624 } }, sitting: { @@ -3211,8 +3211,8 @@ characterMakers["Deerpuff"] = () => { name: "Sitting", image: { source: "./media/characters/deerpuff/sitting.svg", - bottom: 44/400, - extra: 1 / (1 - 44/400) + bottom: 44 / 400, + extra: 1 / (1 - 44 / 400) } }, taurLaying: { @@ -3268,13 +3268,13 @@ characterMakers["Vivian"] = () => { } }, sitting: { - height: math.unit(6/1.75, "feet"), + height: math.unit(6 / 1.75, "feet"), weight: math.unit(170, "lbs"), name: "Sitting", image: { source: "./media/characters/vivian/sitting.svg", - bottom: 1/6.4, - extra: (1 / (1 - 1/6.4)) * (1 + 164/1600) + bottom: 1 / 6.4, + extra: (1 / (1 - 1 / 6.4)) * (1 + 164 / 1600) } }, }, diff --git a/presets/cities.js b/presets/cities.js index daa9b67f..0962afad 100644 --- a/presets/cities.js +++ b/presets/cities.js @@ -19,7 +19,7 @@ function makeCity(name, height) { console.log(views) - return makeEntity({name: name}, views); + return makeEntity({ name: name }, views); } function addCity(name, height) { @@ -56,7 +56,7 @@ function makeCities() { results.push(addCity("Columbus", math.unit(629, "feet"))); // Canada - + results.push(addCity("Toronto", math.unit(1814, "feet"))); results.push(addCity("Montreal", math.unit(743, "feet"))); results.push(addCity("Vancouver", math.unit(659, "feet"))); diff --git a/presets/landmarks.js b/presets/landmarks.js index bd997ae4..7520fbee 100644 --- a/presets/landmarks.js +++ b/presets/landmarks.js @@ -14,7 +14,7 @@ function makeLandmark(name, height, image) { }, }; - return makeEntity({name: name}, views); + return makeEntity({ name: name }, views); } function makeLandmarks() { diff --git a/presets/naturals.js b/presets/naturals.js index 4c5d8fe9..4d415fe6 100644 --- a/presets/naturals.js +++ b/presets/naturals.js @@ -2,7 +2,7 @@ function makeState(name, height, width, area) { return { name: name, constructor: () => makeEntity( - {name: name}, + { name: name }, { state: { attributes: { diff --git a/presets/objects.js b/presets/objects.js index a10f4064..504d6f66 100644 --- a/presets/objects.js +++ b/presets/objects.js @@ -25,7 +25,7 @@ function makeObject(name, viewInfo) { } }); - return makeEntity({name: name}, views); + return makeEntity({ name: name }, views); } function makeObjects() { diff --git a/presets/scenes.js b/presets/scenes.js index e96ad761..d14cd986 100644 --- a/presets/scenes.js +++ b/presets/scenes.js @@ -25,4 +25,4 @@ scenes["military"] = () => { arrangeEntities(order); fitWorld(); -} \ No newline at end of file +} diff --git a/presets/vehicles.js b/presets/vehicles.js index 6d52d697..67bc1487 100644 --- a/presets/vehicles.js +++ b/presets/vehicles.js @@ -1,6 +1,6 @@ function makeVehicle(name, sides, mass) { views = { - + } Object.entries(sides).forEach(([key, val]) => { @@ -24,7 +24,7 @@ function makeVehicle(name, sides, mass) { } }); - return makeEntity({name: name}, views); + return makeEntity({ name: name }, views); } function makeVehicles() { @@ -45,7 +45,7 @@ function makeVehicles() { height: math.unit(38.5, "feet"), image: { source: "./media/vehicles/vertical-bus.svg" } }, - + }, math.unit(30000, "lb"), )