show vectors option

This commit is contained in:
Ladd 2025-12-27 02:21:57 -06:00
parent 3233052f63
commit 952ea553c7

View File

@ -1,7 +1,8 @@
// Options picker
import { Tool } from '../tool.js';
import {
MODE_PAN_VIEW,
DISPLAY_ACCELERATION_VECTORS,
DISPLAY_VELOCITY_VECTORS,
PAUSE_DURING_CREATION,
PAUSE_DURING_SELECTION,
} from '../config.js';
@ -12,6 +13,11 @@ export class Options extends Tool {
items: [
{ type: 'boolean', name: 'creation', title: 'Creation', default: PAUSE_DURING_CREATION },
{ type: 'boolean', name: 'selection', title: 'Selection', default: PAUSE_DURING_SELECTION },
]}, {
type: 'group', name: 'show', title: 'Show Vectors',
items: [
{ type: 'boolean', name: 'velocity', title: 'Velocity', default: DISPLAY_VELOCITY_VECTORS },
{ type: 'boolean', name: 'acceleration', title: 'Acceleration', default: DISPLAY_ACCELERATION_VECTORS },
]
}];
@ -36,12 +42,11 @@ export class Options extends Tool {
button.innerHTML = `<h4>${item.title}</h4>`;
this.setOption(path, item.default);
button.style.opacity = this.values[path] ? '100%' : '50%';
button.addEventListener('click', (e) => {
button.addEventListener('click', () => {
this.setOption(path, !this.getOption(path));
button.style.opacity = this.values[path] ? '100%' : '50%';
});
return button;
break;
}
default:
throw new Error('unknown option type');