update
This commit is contained in:
@@ -134,6 +134,7 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter] public RobotMonitorDto? MonitorData { get; set; }
|
||||
[Parameter] public bool IsConnected { get; set; }
|
||||
|
||||
@@ -178,7 +179,7 @@
|
||||
|
||||
// Auto-follow robot
|
||||
private bool AutoFollowRobot = false;
|
||||
|
||||
|
||||
private void OnAutoFollowRobotChanged(bool value)
|
||||
{
|
||||
AutoFollowRobot = value;
|
||||
@@ -194,7 +195,7 @@
|
||||
private const double MapImageOriginY = -20.0; // OriginY in world coordinates (meters)
|
||||
private const double MapImageResolution = 0.1; // Resolution: meters per pixel
|
||||
private const string MapImageUrl = "images/gara20250309.png";
|
||||
|
||||
|
||||
private bool MapImageLoaded = false;
|
||||
private double MapImageWidth = 0; // Width in world coordinates (meters)
|
||||
private double MapImageHeight = 0; // Height in world coordinates (meters)
|
||||
@@ -233,11 +234,11 @@
|
||||
try
|
||||
{
|
||||
var imageDimensions = await JS.InvokeAsync<ElementSize>("robotMonitor.loadImageAndGetDimensions", MapImageUrl);
|
||||
|
||||
|
||||
// Convert pixel dimensions to world coordinates (meters)
|
||||
MapImageWidth = imageDimensions.Width * MapImageResolution;
|
||||
MapImageHeight = imageDimensions.Height * MapImageResolution;
|
||||
|
||||
|
||||
if (MapImageWidth > 0 && MapImageHeight > 0)
|
||||
{
|
||||
MapImageLoaded = true;
|
||||
@@ -278,16 +279,17 @@
|
||||
// Kích thước robot trong world coordinates (mét)
|
||||
const double RobotWidthMeters = 0.606;
|
||||
const double RobotLengthMeters = 1.106;
|
||||
|
||||
|
||||
// Điều chỉnh kích thước dựa trên ZoomScale
|
||||
// Tăng kích thước lên 1.5x để robot to hơn
|
||||
double scaleFactor = 2 / ZoomScale; // Tăng kích thước hiển thị
|
||||
|
||||
scaleFactor = scaleFactor < 1 ? 1 : scaleFactor;
|
||||
|
||||
double width = RobotWidthMeters * scaleFactor;
|
||||
double height = RobotLengthMeters * scaleFactor;
|
||||
double x = -width / 2;
|
||||
double y = -height / 2;
|
||||
|
||||
|
||||
return (x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user