@pmndrs/handle
Version:
framework agnostic expandable handle implementation for threejs
29 lines (28 loc) • 740 B
JavaScript
import { HandleStore } from '../store.js';
export class DragHandle {
connections;
constructor(objects, getOptions) {
this.connections = objects.map((object) => {
const store = new HandleStore(object, () => ({
multitouch: false,
scale: false,
...getOptions?.(),
}));
return {
store,
unbind: store.bind(object),
};
});
}
update(time) {
for (const { store } of this.connections) {
store.update(time);
}
}
dispose() {
for (const { unbind } of this.connections) {
unbind();
}
this.connections.length = 0;
}
}