-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Render image if robot icon exists Signed-off-by: angatupyry <[email protected]> * Add scale to robot resource Signed-off-by: angatupyry <[email protected]> * Using scale if exists in resource Signed-off-by: angatupyry <[email protected]> * Make waypoints transparent Signed-off-by: angatupyry <[email protected]> * Adjust text according to its length Signed-off-by: angatupyry <[email protected]> * Remove hasOwn property control Signed-off-by: angatupyry <[email protected]> --------- Signed-off-by: angatupyry <[email protected]>
- Loading branch information
1 parent
59065b1
commit db60f9c
Showing
7 changed files
with
143 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 20 additions & 25 deletions
45
packages/dashboard/src/components/three-fiber/robot-three.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,34 @@ | ||
import { ThreeEvent } from '@react-three/fiber'; | ||
import React from 'react'; | ||
import { RobotThreeMaker } from 'react-components'; | ||
import { RobotThreeMaker, RobotData } from 'react-components'; | ||
import { Euler, Vector3 } from 'three'; | ||
import { RobotData } from '../robots-overlay'; | ||
|
||
interface RobotThreeProps { | ||
robots: RobotData[]; | ||
robot: RobotData; | ||
robotLocations: Record<string, [number, number, number]>; | ||
onRobotClick?: (ev: ThreeEvent<MouseEvent>, robot: RobotData) => void; | ||
} | ||
|
||
export const RobotThree = ({ robots, robotLocations, onRobotClick }: RobotThreeProps) => { | ||
const STANDAR_Z_POSITION = 4; | ||
export const RobotThree = ({ robot, robotLocations, onRobotClick }: RobotThreeProps) => { | ||
const STANDAR_Z_POSITION = 5; | ||
const CIRCLE_SEGMENT = 64; | ||
|
||
return ( | ||
<> | ||
{robots.map((robot) => { | ||
const robotId = `${robot.fleet}/${robot.name}`; | ||
const robotLocation = robotLocations[robotId]; | ||
const rotationZ = robotLocation[2] + Math.PI / 2; | ||
const robotId = `${robot.fleet}/${robot.name}`; | ||
const robotLocation = robotLocations[robotId]; | ||
const rotationZ = robotLocation[2] - Math.PI; | ||
|
||
const position = new Vector3(robotLocation[0], robotLocation[1], STANDAR_Z_POSITION); | ||
|
||
const position = new Vector3(robotLocation[0], robotLocation[1], STANDAR_Z_POSITION); | ||
return ( | ||
<React.Fragment key={robotId}> | ||
<RobotThreeMaker | ||
robot={robot} | ||
position={position} | ||
onRobotClick={onRobotClick} | ||
rotation={new Euler(0, 0, rotationZ)} | ||
circleSegment={CIRCLE_SEGMENT} | ||
/> | ||
</React.Fragment> | ||
); | ||
})} | ||
</> | ||
return ( | ||
<React.Fragment key={robotId}> | ||
<RobotThreeMaker | ||
robot={robot} | ||
imageUrl={robot.iconPath} | ||
position={position} | ||
onRobotClick={onRobotClick} | ||
rotation={new Euler(0, 0, rotationZ)} | ||
circleSegment={CIRCLE_SEGMENT} | ||
/> | ||
</React.Fragment> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters