Procházet zdrojové kódy

Add toggleable height bars for each entity

tags/v0.1.0
Fen Dweller před 6 roky
rodič
revize
2ce5c535bb
3 změnil soubory, kde provedl 30 přidání a 1 odebrání
  1. +15
    -0
      macrovision.css
  2. +5
    -1
      macrovision.html
  3. +10
    -0
      macrovision.js

+ 15
- 0
macrovision.css Zobrazit soubor

@@ -451,4 +451,19 @@ input[type=checkbox] {


input ~ label { input ~ label {
user-select: none; user-select: none;
}

body.toggle-height-bars .height-bar {
display: block;
}

.height-bar {
display: none;
min-width: 120vw;
min-height: 3px;
height: 3px;
position: absolute;
background: repeating-linear-gradient(90deg, #aaaaaaff, #aaaaaaff 20px, #aaaaaa00 20px, #aaaaaa00 40px);
top: calc(-100% + var(--extra));
left: calc(-120vw + 24px);
} }

+ 5
- 1
macrovision.html Zobrazit soubor

@@ -26,7 +26,7 @@
<link rel="icon" href="https://crux.sexy/images/macrovision.ico"> <link rel="icon" href="https://crux.sexy/images/macrovision.ico">
</head> </head>


<body class="toggle-bottom-name toggle-entity-name">
<body class="toggle-bottom-name toggle-entity-name toggle-height-bars">
<div id="help"> <div id="help">
<h1>Discord</h1> <h1>Discord</h1>
<p> <p>
@@ -112,6 +112,10 @@
<input type="checkbox" id="options-world-show-bottom-names" checked=true> <input type="checkbox" id="options-world-show-bottom-names" checked=true>
<label for="options-world-show-bottom-names">Names at bottom</label> <label for="options-world-show-bottom-names">Names at bottom</label>
</div> </div>
<div class="options-row">
<input type="checkbox" id="options-world-show-height-bars" checked=true>
<label for="options-world-show-height-bars">Height bars</label>
</div>


<div class="options-label"> <div class="options-label">
Auto-sizing mode Auto-sizing mode


+ 10
- 0
macrovision.js Zobrazit soubor

@@ -843,6 +843,7 @@ function displayEntity(entity, view, x, y) {
img.addEventListener("dragstart", e => { img.addEventListener("dragstart", e => {
e.preventDefault(); e.preventDefault();
}); });
const nameTag = document.createElement("div"); const nameTag = document.createElement("div");
nameTag.classList.add("entity-name"); nameTag.classList.add("entity-name");
nameTag.innerText = entity.name; nameTag.innerText = entity.name;
@@ -873,6 +874,11 @@ function displayEntity(entity, view, x, y) {
testClick(fakeEvent); testClick(fakeEvent);
}); });


const heightBar = document.createElement("div");
heightBar.classList.add("height-bar");

box.appendChild(heightBar);

box.id = "entity-" + entityIndex; box.id = "entity-" + entityIndex;
box.dataset.key = entityIndex; box.dataset.key = entityIndex;
entity.view = view; entity.view = view;
@@ -938,6 +944,10 @@ document.addEventListener("DOMContentLoaded", () => {
document.body.classList[e.target.checked ? "add" : "remove"]("toggle-bottom-name"); document.body.classList[e.target.checked ? "add" : "remove"]("toggle-bottom-name");
}); });


document.querySelector("#options-world-show-height-bars").addEventListener("input", e => {
document.body.classList[e.target.checked ? "add" : "remove"]("toggle-height-bars");
});

document.querySelector("#options-order-forward").addEventListener("click", e => { document.querySelector("#options-order-forward").addEventListener("click", e => {
if (selected) { if (selected) {
entities[selected.dataset.key].priority += 1; entities[selected.dataset.key].priority += 1;


Načítá se…
Zrušit
Uložit