Skip to content

Commit

Permalink
fix: deploy url, enable by defaul 3D view
Browse files Browse the repository at this point in the history
  • Loading branch information
Helias committed Apr 17, 2024
1 parent f1ef25c commit a582de3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
5 changes: 0 additions & 5 deletions dist/client/bundle.js.LICENSE.txt

This file was deleted.

10 changes: 5 additions & 5 deletions dist/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@

<body>
<div class="menu">
<a href="/?ip=127.0.0.1&robot=grande">localhost</a>
<a href="/?ip=192.168.70.20&robot=grande">GRANDE</a>
<a href="/?ip=192.168.70.120&robot=piccolo">PICCOLO</a>
<a href="/?ip=192.168.70.120&robot=ladybug">LADYBUG</a>
<a data-params="?ip=127.0.0.1&robot=grande">localhost</a>
<a data-params="?ip=192.168.70.20&robot=grande">GRANDE</a>
<a data-params="?ip=192.168.70.120&robot=piccolo">PICCOLO</a>
<a data-params="?ip=192.168.70.120&robot=ladybug">LADYBUG</a>
</div>
<br />
<div style="float: left">
<label> <input type="checkbox" id="btn-option3d" /> Enable 3D </label>
<label> <input type="checkbox" id="btn-option3d" checked /> Enable 3D </label>
<br />
<label> <input type="checkbox" id="btn-option-tof" /> Enable ToF </label>
<br />
Expand Down
3 changes: 3 additions & 0 deletions src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls';
import {
add_align_button,
add_option_3d,
fix_deploy_url,
initChart,
resetPidGraphs,
showPidGraphs,
Expand All @@ -26,6 +27,7 @@ const robotGroup = new Group();
const scene = new Scene();
const renderer = new WebGLRenderer({ antialias: true });

fix_deploy_url();
add_option_3d(enable3D, robotGroup, renderer, scene);
showPidGraphs();

Expand Down Expand Up @@ -120,3 +122,4 @@ function enable3D(): void {

requestAnimationFrame(render);
}
enable3D();
8 changes: 8 additions & 0 deletions src/client/helper/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { Socket } from 'socket.io-client';
import { Group, Scene, WebGLRenderer } from 'three';
import { SocketMessageType } from '../models/model';

export function fix_deploy_url(): void {
const links = document.querySelectorAll<HTMLLinkElement>('.menu a');
for (const link of links) {
const param = link.getAttribute('data-params');
link.href = `${location.protocol}//${location.host}${location.pathname}${param}`;
}
}

export function add_align_button(socket: Socket): void {
const alignBtn = document.querySelector<HTMLButtonElement>('#btn-align') as HTMLButtonElement;
alignBtn.onclick = function () {
Expand Down

0 comments on commit a582de3

Please sign in to comment.