mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-15 21:04:46 +01:00
This contains a bunch of things packaged in 1: 1) UI improvements for the 3D viewer to support all sort of file types and create a nice rendering in a clean way with all sort of options 2) enable people to use Filestash as an SDK so we can embed the 3d viewer elsewhere
23 lines
879 B
JavaScript
23 lines
879 B
JavaScript
import { onDestroy } from "../../../lib/skeleton/index.js";
|
|
import { ViewCubeGizmo, SimpleCameraControls, ObjectPosition } from "../../../lib/vendor/three/viewcube.js";
|
|
|
|
export default function({ camera, renderer, refresh, controls }) {
|
|
const viewCubeGizmo = new ViewCubeGizmo(camera, renderer, {
|
|
pos: ObjectPosition.RIGHT_BOTTOM,
|
|
dimension: 130,
|
|
faceColor: 0xf9f9fa,
|
|
outlineColor: 0xe2e2e2,
|
|
});
|
|
|
|
const simpleCameraControls = new SimpleCameraControls(camera);
|
|
simpleCameraControls.setControls(controls);
|
|
|
|
refresh.push(() => {
|
|
viewCubeGizmo.update();
|
|
simpleCameraControls.update();
|
|
});
|
|
|
|
const onCubeClick = (event) => simpleCameraControls.flyTo(event.quaternion);
|
|
viewCubeGizmo.addEventListener("change", onCubeClick);
|
|
onDestroy(() => viewCubeGizmo.removeEventListener("change", onCubeClick));
|
|
}
|