Spaces:
Running
Running
Download interactive_4x4_line_or_right_angle_only.html from MarkTheArtist/TileVisualizer: direct link, hf CLI and curl.
- Browser
- Download file 9.39 kB
-
https://huggingface.co/spaces/MarkTheArtist/TileVisualizer/resolve/main/interactive_4x4_line_or_right_angle_only.html
- Command line
-
hf download hf://spaces/MarkTheArtist/TileVisualizer/interactive_4x4_line_or_right_angle_only.html
-
curl -L -o interactive_4x4_line_or_right_angle_only.html https://huggingface.co/spaces/MarkTheArtist/TileVisualizer/resolve/main/interactive_4x4_line_or_right_angle_only.html
9.39 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>4x4 Line or Right Angle Tile Tool</title> | |
| <style> | |
| body { | |
| margin: 0; | |
| padding: 22px; | |
| background: #eee4cf; | |
| font-family: Arial, Helvetica, sans-serif; | |
| color: #222; | |
| } | |
| h1 { | |
| margin: 0 0 8px 0; | |
| } | |
| .notice { | |
| padding: 12px; | |
| margin: 12px 0 18px 0; | |
| border-radius: 10px; | |
| border: 3px solid #9b2f2f; | |
| background: #ffe7e7; | |
| font-weight: bold; | |
| } | |
| .notice.ok { | |
| border-color: #276c35; | |
| background: #e5f6e8; | |
| } | |
| .layout { | |
| display: flex; | |
| flex-wrap: wrap; | |
| gap: 22px; | |
| align-items: flex-start; | |
| } | |
| .panel { | |
| background: white; | |
| border: 3px solid #aa9568; | |
| border-radius: 14px; | |
| padding: 18px; | |
| box-shadow: 0 8px 18px rgba(0,0,0,.08); | |
| } | |
| #grid { | |
| display: grid; | |
| grid-template-columns: repeat(4, 120px); | |
| grid-template-rows: repeat(4, 120px); | |
| gap: 10px; | |
| background: #b69d6a; | |
| border: 6px solid #302614; | |
| padding: 12px; | |
| max-width: 100%; | |
| overflow: auto; | |
| } | |
| .cell { | |
| position: relative; | |
| width: 120px; | |
| height: 120px; | |
| background: #fff8e8; | |
| border: 4px solid #453720; | |
| box-sizing: border-box; | |
| cursor: pointer; | |
| } | |
| .cell.selected { | |
| outline: 7px solid #ffcc33; | |
| outline-offset: -9px; | |
| } | |
| .num { | |
| position: absolute; | |
| top: 5px; | |
| left: 7px; | |
| font-weight: bold; | |
| color: #7e6c49; | |
| z-index: 5; | |
| font-size: 13px; | |
| } | |
| .tile { | |
| position: absolute; | |
| left: 14px; | |
| top: 14px; | |
| width: 92px; | |
| height: 92px; | |
| transform-origin: 46px 46px; | |
| } | |
| /* Design A: one simple thick rectangle/line */ | |
| .line { | |
| position: absolute; | |
| left: 5px; | |
| top: 28px; | |
| width: 82px; | |
| height: 36px; | |
| background: black; | |
| } | |
| /* Design B: one simple thick right angle */ | |
| .angle-v { | |
| position: absolute; | |
| left: 28px; | |
| top: 5px; | |
| width: 36px; | |
| height: 46px; | |
| background: black; | |
| } | |
| .angle-h { | |
| position: absolute; | |
| left: 28px; | |
| top: 28px; | |
| width: 59px; | |
| height: 36px; | |
| background: black; | |
| } | |
| .controls { | |
| width: 330px; | |
| max-width: 100%; | |
| } | |
| .group { | |
| border-bottom: 1px solid #dccba5; | |
| padding-bottom: 16px; | |
| margin-bottom: 18px; | |
| } | |
| .group:last-child { | |
| border-bottom: none; | |
| } | |
| button { | |
| margin: 5px; | |
| padding: 11px 13px; | |
| border: 2px solid #6f5b35; | |
| border-radius: 8px; | |
| background: #fff8e8; | |
| font-weight: bold; | |
| cursor: pointer; | |
| font-size: 15px; | |
| } | |
| button:hover { | |
| background: #ead6aa; | |
| } | |
| button.active { | |
| background: #ffcc33; | |
| } | |
| #status { | |
| background: #fff8e8; | |
| border: 2px solid #d2bd8d; | |
| border-radius: 8px; | |
| padding: 10px; | |
| line-height: 1.45; | |
| } | |
| textarea { | |
| width: 100%; | |
| height: 150px; | |
| font-family: monospace; | |
| font-size: 12px; | |
| box-sizing: border-box; | |
| } | |
| .legend { | |
| display: flex; | |
| align-items: center; | |
| gap: 10px; | |
| margin: 12px 0; | |
| } | |
| .mini { | |
| position: relative; | |
| width: 62px; | |
| height: 62px; | |
| border: 3px solid #493b23; | |
| background: #fff8ea; | |
| overflow: hidden; | |
| } | |
| .mini .line { | |
| left: 8px; | |
| top: 22px; | |
| width: 46px; | |
| height: 18px; | |
| } | |
| .mini .angle-v { | |
| left: 22px; | |
| top: 8px; | |
| width: 18px; | |
| height: 24px; | |
| } | |
| .mini .angle-h { | |
| left: 22px; | |
| top: 22px; | |
| width: 32px; | |
| height: 18px; | |
| } | |
| @media (max-width: 650px) { | |
| #grid { | |
| grid-template-columns: repeat(4, 68px); | |
| grid-template-rows: repeat(4, 68px); | |
| gap: 6px; | |
| padding: 7px; | |
| } | |
| .cell { | |
| width: 68px; | |
| height: 68px; | |
| border-width: 3px; | |
| } | |
| .num { | |
| font-size: 11px; | |
| top: 3px; | |
| left: 5px; | |
| } | |
| .tile { | |
| left: 8px; | |
| top: 8px; | |
| width: 52px; | |
| height: 52px; | |
| transform-origin: 26px 26px; | |
| } | |
| .line { | |
| left: 3px; | |
| top: 16px; | |
| width: 46px; | |
| height: 15px; | |
| } | |
| .angle-v { | |
| left: 16px; | |
| top: 3px; | |
| width: 15px; | |
| height: 26px; | |
| } | |
| .angle-h { | |
| left: 16px; | |
| top: 16px; | |
| width: 33px; | |
| height: 15px; | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1>4×4 Tile Tool — Line or Right Angle Only</h1> | |
| <div id="jsCheck" class="notice"> | |
| JavaScript is NOT running yet. If this message stays here, the file is being opened in a preview mode that blocks interaction. | |
| </div> | |
| <div class="layout"> | |
| <div class="panel"> | |
| <div id="grid"></div> | |
| </div> | |
| <div class="panel controls"> | |
| <div class="group"> | |
| <h2>Selected tile</h2> | |
| <div id="status">Waiting for JavaScript...</div> | |
| </div> | |
| <div class="group"> | |
| <h2>Design</h2> | |
| <button id="designA" type="button">Line</button> | |
| <button id="designB" type="button">Right angle</button> | |
| </div> | |
| <div class="group"> | |
| <h2>Orientation</h2> | |
| <button class="rot" data-rot="0" type="button">0°</button> | |
| <button class="rot" data-rot="90" type="button">90°</button> | |
| <button class="rot" data-rot="180" type="button">180°</button> | |
| <button class="rot" data-rot="270" type="button">270°</button> | |
| <br> | |
| <button id="turn" type="button">Rotate selected 90°</button> | |
| </div> | |
| <div class="group"> | |
| <h2>Legend</h2> | |
| <div class="legend"> | |
| <div class="mini"> | |
| <div class="line"></div> | |
| </div> | |
| <div><b>Line</b><br>one thick rectangle</div> | |
| </div> | |
| <div class="legend"> | |
| <div class="mini"> | |
| <div class="angle-v"></div> | |
| <div class="angle-h"></div> | |
| </div> | |
| <div><b>Right angle</b><br>one thick L shape</div> | |
| </div> | |
| </div> | |
| <div class="group"> | |
| <h2>Layout data</h2> | |
| <textarea id="dataBox"></textarea> | |
| <button id="selectData" type="button">Select data</button> | |
| <button id="reset" type="button">Reset</button> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| (function () { | |
| var selected = 0; | |
| function defaultCells() { | |
| return [ | |
| {design:"line", rot:0}, {design:"angle", rot:90}, {design:"line", rot:90}, {design:"angle", rot:180}, | |
| {design:"angle", rot:0}, {design:"line", rot:0}, {design:"angle", rot:180},{design:"line", rot:90}, | |
| {design:"line", rot:90}, {design:"angle", rot:270}, {design:"line", rot:0}, {design:"angle", rot:0}, | |
| {design:"angle", rot:270},{design:"line", rot:180}, {design:"angle", rot:90}, {design:"line", rot:0} | |
| ]; | |
| } | |
| var cells = defaultCells(); | |
| var jsCheck = document.getElementById("jsCheck"); | |
| jsCheck.className = "notice ok"; | |
| jsCheck.textContent = "JavaScript is working. You can click cells and change the design or rotation."; | |
| function makeTile(cell) { | |
| var design = ""; | |
| if (cell.design === "line") { | |
| design = '<div class="line"></div>'; | |
| } else { | |
| design = '<div class="angle-v"></div><div class="angle-h"></div>'; | |
| } | |
| return '<div class="tile" style="transform: rotate(' + cell.rot + 'deg)">' + design + '</div>'; | |
| } | |
| function render() { | |
| var grid = document.getElementById("grid"); | |
| grid.innerHTML = ""; | |
| for (var i = 0; i < 16; i++) { | |
| var div = document.createElement("div"); | |
| div.className = "cell" + (i === selected ? " selected" : ""); | |
| div.setAttribute("data-index", i); | |
| div.innerHTML = '<div class="num">' + (i + 1) + '</div>' + makeTile(cells[i]); | |
| div.addEventListener("click", function () { | |
| selected = Number(this.getAttribute("data-index")); | |
| render(); | |
| }); | |
| grid.appendChild(div); | |
| } | |
| var current = cells[selected]; | |
| var designName = current.design === "line" ? "Line" : "Right angle"; | |
| document.getElementById("status").innerHTML = | |
| "Cell " + (selected + 1) + "<br>" + designName + "<br>Rotation " + current.rot + "°"; | |
| document.getElementById("designA").className = current.design === "line" ? "active" : ""; | |
| document.getElementById("designB").className = current.design === "angle" ? "active" : ""; | |
| var rotButtons = document.querySelectorAll(".rot"); | |
| for (var r = 0; r < rotButtons.length; r++) { | |
| var val = Number(rotButtons[r].getAttribute("data-rot")); | |
| rotButtons[r].className = "rot" + (val === current.rot ? " active" : ""); | |
| } | |
| document.getElementById("dataBox").value = JSON.stringify(cells, null, 2); | |
| } | |
| document.getElementById("designA").addEventListener("click", function () { | |
| cells[selected].design = "line"; | |
| render(); | |
| }); | |
| document.getElementById("designB").addEventListener("click", function () { | |
| cells[selected].design = "angle"; | |
| render(); | |
| }); | |
| var rotButtons = document.querySelectorAll(".rot"); | |
| for (var r = 0; r < rotButtons.length; r++) { | |
| rotButtons[r].addEventListener("click", function () { | |
| cells[selected].rot = Number(this.getAttribute("data-rot")); | |
| render(); | |
| }); | |
| } | |
| document.getElementById("turn").addEventListener("click", function () { | |
| cells[selected].rot = (cells[selected].rot + 90) % 360; | |
| render(); | |
| }); | |
| document.getElementById("selectData").addEventListener("click", function () { | |
| var box = document.getElementById("dataBox"); | |
| box.focus(); | |
| box.select(); | |
| }); | |
| document.getElementById("reset").addEventListener("click", function () { | |
| cells = defaultCells(); | |
| selected = 0; | |
| render(); | |
| }); | |
| render(); | |
| })(); | |
| </script> | |
| </body> | |
| </html> | |