ui/scene: add different cursor type
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
.cubes-scene-container {
|
.cubes-scene-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <div class="absolute bottom-4 left-1/2 flex -translate-x-1/2 flex-col items-center">
|
/* <div class="absolute bottom-4 left-1/2 flex -translate-x-1/2 flex-col items-center">
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { Accessor } from "solid-js";
|
|||||||
import { renderLoop } from "./RenderLoop";
|
import { renderLoop } from "./RenderLoop";
|
||||||
import { ObjectRegistry } from "./ObjectRegistry";
|
import { ObjectRegistry } from "./ObjectRegistry";
|
||||||
import { MachineManager } from "./MachineManager";
|
import { MachineManager } from "./MachineManager";
|
||||||
|
import cx from "classnames";
|
||||||
|
|
||||||
function garbageCollectGroup(group: THREE.Group) {
|
function garbageCollectGroup(group: THREE.Group) {
|
||||||
for (const child of group.children) {
|
for (const child of group.children) {
|
||||||
@@ -101,6 +102,8 @@ export function CubeScene(props: {
|
|||||||
const [positionMode, setPositionMode] = createSignal<"grid" | "circle">(
|
const [positionMode, setPositionMode] = createSignal<"grid" | "circle">(
|
||||||
"grid",
|
"grid",
|
||||||
);
|
);
|
||||||
|
// Managed by controls
|
||||||
|
const [isDragging, setIsDragging] = createSignal(false);
|
||||||
|
|
||||||
const [cursorPosition, setCursorPosition] = createSignal<[number, number]>();
|
const [cursorPosition, setCursorPosition] = createSignal<[number, number]>();
|
||||||
|
|
||||||
@@ -273,6 +276,13 @@ export function CubeScene(props: {
|
|||||||
bgCamera,
|
bgCamera,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
controls.addEventListener("start", (e) => {
|
||||||
|
setIsDragging(true);
|
||||||
|
});
|
||||||
|
controls.addEventListener("end", (e) => {
|
||||||
|
setIsDragging(false);
|
||||||
|
});
|
||||||
|
|
||||||
// Lighting
|
// Lighting
|
||||||
const ambientLight = new THREE.AmbientLight(0xd9f2f7, 0.72);
|
const ambientLight = new THREE.AmbientLight(0xd9f2f7, 0.72);
|
||||||
scene.add(ambientLight);
|
scene.add(ambientLight);
|
||||||
@@ -582,7 +592,17 @@ export function CubeScene(props: {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div class="cubes-scene-container" ref={(el) => (container = el)} />
|
<div
|
||||||
|
class={cx(
|
||||||
|
"cubes-scene-container",
|
||||||
|
worldMode() === "default" && "cursor-no-drop",
|
||||||
|
worldMode() === "select" && "cursor-pointer",
|
||||||
|
worldMode() === "service" && "cursor-pointer",
|
||||||
|
worldMode() === "create" && "cursor-cell",
|
||||||
|
isDragging() && "!cursor-grabbing",
|
||||||
|
)}
|
||||||
|
ref={(el) => (container = el)}
|
||||||
|
/>
|
||||||
<div class="toolbar-container">
|
<div class="toolbar-container">
|
||||||
<div class="absolute bottom-full left-1/2 mb-2 -translate-x-1/2">
|
<div class="absolute bottom-full left-1/2 mb-2 -translate-x-1/2">
|
||||||
{props.toolbarPopup}
|
{props.toolbarPopup}
|
||||||
@@ -615,7 +635,7 @@ export function CubeScene(props: {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ToolbarButton
|
<ToolbarButton
|
||||||
icon="Reload"
|
icon="Update"
|
||||||
name="Reload"
|
name="Reload"
|
||||||
description="Reload machines"
|
description="Reload machines"
|
||||||
onClick={() => machinesQuery.refetch()}
|
onClick={() => machinesQuery.refetch()}
|
||||||
|
|||||||
Reference in New Issue
Block a user