Skip to content

Commit ca25f6c

Browse files
ochafikclaude
andcommitted
fix: don't reset camera on final ontoolinput if already positioned
If the camera was positioned during streaming (ontoolinputpartial), skip re-positioning in ontoolinput. This preserves the user's view if they panned or zoomed while annotations were streaming in. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f9cad00 commit ca25f6c

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

examples/map-server/src/mcp-app.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,7 +1611,9 @@ app.ontoolinput = async (params) => {
16111611
bbox = bboxFromCenter(args.latitude, args.longitude, args.radiusKm ?? 50);
16121612
}
16131613

1614-
if (bbox) {
1614+
// Only position camera if we haven't already (from streaming partial).
1615+
// If the user panned/zoomed during streaming, don't override their view.
1616+
if (bbox && !hasPositionedFromPartial) {
16151617
hasReceivedToolInput = true;
16161618
log.info("Positioning camera to bbox:", bbox);
16171619
setViewToBoundingBox(viewer, bbox);
@@ -1629,7 +1631,7 @@ app.ontoolinput = async (params) => {
16291631
);
16301632
}
16311633

1632-
if (bbox) {
1634+
if (bbox && !hasPositionedFromPartial) {
16331635
await waitForTilesLoaded(viewer);
16341636
hideLoading();
16351637
log.info(

0 commit comments

Comments
 (0)