Add the cursor position to the editor's fledgling status bar

This commit is contained in:
Eevee (Evelyn Woods) committed 2021-04-23 14:37:20 -06:00
1 parent ea9cc5ef07
commit e3a128df60
2 files changed
+16 -2

No files matched your search

+5 -1
View File
@@ -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)