Add the cursor position to the editor's fledgling status bar
This commit is contained in:
parent
ea9cc5ef07
commit
e3a128df60
@ -3255,7 +3255,8 @@ export class Editor extends PrimaryView {
|
||||
// Populate status bar (needs doing before the mouse stuff, which tries to update it)
|
||||
let statusbar = this.root.querySelector('#editor-statusbar');
|
||||
this.statusbar_zoom = mk('div.-zoom');
|
||||
statusbar.append(this.statusbar_zoom);
|
||||
this.statusbar_cursor = mk('div.-mouse', "—");
|
||||
statusbar.append(this.statusbar_zoom, this.statusbar_cursor);
|
||||
|
||||
// Keyboard shortcuts
|
||||
window.addEventListener('keydown', ev => {
|
||||
@ -3395,9 +3396,12 @@ export class Editor extends PrimaryView {
|
||||
this.svg_cursor.classList.add('--visible');
|
||||
this.svg_cursor.setAttribute('x', x);
|
||||
this.svg_cursor.setAttribute('y', y);
|
||||
|
||||
this.statusbar_cursor.textContent = `(${x}, ${y})`;
|
||||
}
|
||||
else {
|
||||
this.svg_cursor.classList.remove('--visible');
|
||||
this.statusbar_cursor.textContent = `—`;
|
||||
}
|
||||
|
||||
if (! this.mouse_op)
|
||||
|
||||
12
style.css
12
style.css
@ -2012,7 +2012,17 @@ body.--debug #player-debug {
|
||||
#editor #editor-statusbar {
|
||||
grid-area: status;
|
||||
display: flex;
|
||||
height: 1em;
|
||||
gap: 0.5em;
|
||||
/* Try very hard to minimize reflow, since this is updated frequently */
|
||||
height: 1.25em;
|
||||
line-height: 1.25;
|
||||
overflow: hidden;
|
||||
}
|
||||
#editor #editor-statusbar > .-zoom {
|
||||
width: 4em;
|
||||
}
|
||||
#editor #editor-statusbar > .-cursor {
|
||||
width: 5em;
|
||||
}
|
||||
|
||||
.editor-level-browser {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user