Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Touch Controls #1104

Open
wants to merge 16 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fission/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"scripts": {
"init": "(bun run assetpack && bun run playwright:install) || (npm run assetpack && npm run playwright:install)",
"dev": "vite --open",
"dev": "vite --open --host",
"build": "tsc && vite build",
"build:prod": "tsc && vite build --base=/fission/ --outDir dist/prod",
"build:dev": "tsc && vite build --base=/fission-closed/ --outDir dist/dev",
Expand Down Expand Up @@ -56,6 +56,7 @@
"@types/three": "^0.160.0",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@vitejs/plugin-basic-ssl": "^1.1.0",
"@vitejs/plugin-react": "^4.0.3",
"@vitejs/plugin-react-swc": "^3.5.0",
"autoprefixer": "^10.4.14",
Expand Down
4 changes: 3 additions & 1 deletion fission/src/Synthesis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ import AnalyticsConsent from "./ui/components/AnalyticsConsent.tsx"
import PreferencesSystem from "./systems/preferences/PreferencesSystem.ts"
import APSManagementModal from "./ui/modals/APSManagementModal.tsx"
import ConfigurePanel from "./ui/panels/configuring/assembly-config/ConfigurePanel.tsx"
import TouchControls from "./ui/components/TouchControls.tsx"

const worker = new Lazy<Worker>(() => new WPILibWSWorker())

Expand Down Expand Up @@ -164,10 +165,11 @@ function Synthesis() {
<ToastProvider key="toast-provider">
<Scene useStats={import.meta.env.DEV} key="scene-in-toast-provider" />
<SceneOverlay />
<TouchControls />
<MainHUD key={"main-hud"} />
{panelElements.length > 0 && panelElements}
{modalElement && (
<div className="absolute w-full h-full left-0 top-0" key={"modal-element"}>
<div className="fixed w-full h-full left-0 top-0" key={"modal-element"}>
{modalElement}
</div>
)}
Expand Down
2 changes: 1 addition & 1 deletion fission/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ body {
display: flex;
place-items: center;
min-width: 320px;
min-height: 100vh;
/* min-height: 100vh; */
}

h1 {
Expand Down
12 changes: 11 additions & 1 deletion fission/src/mirabuf/MirabufSceneObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import ScoringZoneSceneObject from "./ScoringZoneSceneObject"
import { SceneOverlayTag } from "@/ui/components/SceneOverlayEvents"
import { ProgressHandle } from "@/ui/components/ProgressNotificationData"
import SynthesisBrain from "@/systems/simulation/synthesis_brain/SynthesisBrain"
import { MainHUD_AddToast } from "@/ui/components/MainHUD"

const DEBUG_BODIES = false

Expand Down Expand Up @@ -186,7 +187,7 @@ class MirabufSceneObject extends SceneObject {
* This block of code should only be executed if the transform gizmo exists.
*/
if (this._transformGizmos) {
if (InputSystem.isKeyPressed("Enter")) {
if (InputSystem.isKeyPressed("ConfirmAssemblyButton") || InputSystem.isKeyPressed("Enter")) {
// confirming placement of the mirabuf object
this.DisableTransformControls()
return
Expand Down Expand Up @@ -397,6 +398,7 @@ class MirabufSceneObject extends SceneObject {
this._transformGizmos?.RemoveGizmos()
this._transformGizmos = undefined
this.EnablePhysics()
World.SceneRenderer.isPlacingAssembly = false
}

/**
Expand Down Expand Up @@ -440,6 +442,14 @@ export async function CreateMirabuf(
assembly: mirabuf.Assembly,
progressHandle?: ProgressHandle
): Promise<MirabufSceneObject | null | undefined> {
// Cancel is there is another assembly being placed
console.log(World.SceneRenderer.isPlacingAssembly)
if (World.SceneRenderer.isPlacingAssembly) {
MainHUD_AddToast("error", "Error Placing Assembly.", "Place assembly before spawning another.")
return
} else {
World.SceneRenderer.isPlacingAssembly = true
}
const parser = new MirabufParser(assembly, progressHandle)
if (parser.maxErrorSeverity >= ParseErrorSeverity.Unimportable) {
console.error(`Assembly Parser produced significant errors for '${assembly.info!.name!}'`)
Expand Down
Loading
Loading