Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/lib/socketHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class socketHandler {
const handler = this.adapter.deviceFeatureHandlers.get(duid);
if (!handler) throw new Error(`No handler for DUID ${duid}`);

await this.adapter.requestsHandler.command(handler, duid, "app_goto_target", [points]);
await this.adapter.requestsHandler.command(handler, duid, "app_goto_target", points);
return { result: "ok" };
}

Expand Down
10 changes: 5 additions & 5 deletions src/www/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ class MapApplication {
d.x = newX;
d.y = newY;
const element = event.sourceEvent.target.closest("g.zone");
if (element) d3.select(element).attr("transform", `translate(${d.x - this.mapMinX}, ${d.y - this.mapMinY})`);
if (element) d3.select(element).attr("transform", `translate(${d.x}, ${d.y})`);
})
.on("end", (event: any) => {
const element = event.sourceEvent.target.closest("g.zone");
Expand Down Expand Up @@ -931,7 +931,7 @@ class MapApplication {
enterGroup.append("rect").attr("class", "zone-rect").attr("x", 0).attr("y", 0).style("stroke-width", this.rescaler.zoneStrokeWidth());
enterGroup.append("circle").attr("class", "zone-handle").attr("r", this.rescaler.zoneHandleRadius()).call(resizeHandler as any);
const mergedSelection = selection.merge(enterGroup as any);
mergedSelection.attr("transform", (d: Rect) => `translate(${d.x - this.mapMinX}, ${d.y - this.mapMinY})`);
mergedSelection.attr("transform", (d: Rect) => `translate(${d.x}, ${d.y})`);
mergedSelection
.select("rect")
.attr("width", (d: Rect) => d.width)
Expand Down Expand Up @@ -1059,7 +1059,7 @@ class MapApplication {
if (this.mapMinX === undefined || this.mapMinY === undefined) return { x: 0, y: 0 };
const transform = d3.zoomTransform(this.svgContainer.node() as Element);
const inverted = transform.invert([x, y]);
return { x: inverted[0] + this.mapMinX, y: inverted[1] + this.mapMinY };
return { x: inverted[0], y: inverted[1] };
}

private worldToSvgCoords(x: number, y: number): Point {
Expand Down Expand Up @@ -1211,8 +1211,8 @@ class MapApplication {
const params = this.getMapParams();
if (!this.currentRobotDuid || !params) return;
const [mouseX, mouseY] = d3.pointer(event, this.mainGroup.node());
const worldX = mouseX + this.mapMinX;
const worldY = mouseY + this.mapMinY;
const worldX = mouseX;
const worldY = mouseY;
const point = localCoordsToRobotCoords({ x: worldX, y: worldY }, params);
this.connection.sendTo(this.instanceId, "app_goto_target", { points: [point.x, point.y], duid: this.currentRobotDuid });
pin.style("opacity", 1.0);
Expand Down