diff --git a/js/game.js b/js/game.js index a00e7b6..6e23d9e 100644 --- a/js/game.js +++ b/js/game.js @@ -617,6 +617,7 @@ export class Level extends LevelInterface { } } else if (tile.type.on_power) { + // FIXME this isn't quite right since there's seemingly a 1-frame delay add_to_edge_map(circuit.tiles, tile, DIRECTIONS[edge].bit); wired_outputs.add(tile); } diff --git a/js/main-editor.js b/js/main-editor.js index 44b430a..e3b39c4 100644 --- a/js/main-editor.js +++ b/js/main-editor.js @@ -2097,6 +2097,10 @@ export class Editor extends PrimaryView { } setup() { + // Add more bits to SVG overlay + this.svg_cursor = mk_svg('rect.overlay-cursor', {x: 0, y: 0, width: 1, height: 1}); + this.svg_overlay.append(this.svg_cursor); + // Keyboard shortcuts window.addEventListener('keydown', ev => { if (! this.active) @@ -2161,6 +2165,17 @@ export class Editor extends PrimaryView { window.addEventListener('mousemove', ev => { if (! this.active) return; + + let [x, y] = this.renderer.cell_coords_from_event(ev); + if (this.is_in_bounds(x, y)) { + this.svg_cursor.classList.add('--visible'); + this.svg_cursor.setAttribute('x', x); + this.svg_cursor.setAttribute('y', y); + } + else { + this.svg_cursor.classList.remove('--visible'); + } + if (! this.mouse_op) return; if ((ev.buttons & this.mouse_op.button_mask) === 0) { diff --git a/style.css b/style.css index e5cb07d..f5be779 100644 --- a/style.css +++ b/style.css @@ -1413,6 +1413,14 @@ body.--debug #player-debug { stroke-width: 0.0625; fill: none; } +#editor .level-editor-overlay rect.overlay-cursor { + display: none; + stroke: hsla(225, 100%, 60%, 0.5); + fill: hsla(225, 100%, 75%, 0.25); +} +#editor .level-editor-overlay rect.overlay-cursor.--visible { + display: initial; +} #editor .level-editor-overlay rect.overlay-cxn { stroke: red; } @@ -1523,7 +1531,11 @@ body.--debug #player-debug { #editor .palette { isolation: isolate; grid-area: palette; - padding-right: 0.25em; /* in case of scrollbar */ + width: calc(32px * 8 + 4px * 9); + padding-right: 1em; /* make room for scrollbar so we don't get a horizontal one */ + /* TODO when there IS a scrollbar, the h2s are slightly narrower. think this is an + * unexpected consequence of using min-content, which i guess does not take the + * possibility of a scrollbar into account */ overflow-y: auto; } #editor .palette h2 {