Skip to content

NavigationMode.set(active, options): interface declares options, the library's own call passes preventTargetAdjustment — no implementation reads it (double moveTo on attach) #784

Description

@stokuewe

Versions

@thatopen/components 3.4.8 (verified against the published dist/index.mjs + index.d.ts; source: packages/core/src/core/OrthoPerspectiveCamera/src/types.ts, orbit-mode.ts, plan-mode.ts, first-person-mode.ts).

What happens

The NavigationMode interface declares:

set: (active: boolean, options?: any) => void;

and OrthoPerspectiveCamera's world-attach handler calls:

this.mode.set(true, { preventTargetAdjustment: true });

But all three shipped implementations have arity 1 and discard the options: OrbitMode.set(active), FirstPersonMode.set(active), PlanMode.set(active).

Consequence

activateOrbitControls() runs twice on world assignment — once from the OrbitMode constructor, once from set(true) — and each run calls controls.moveTo(target.x, target.y, target.z), adjusting exactly the target the caller asked not to adjust.

Suggested fix

Implement preventTargetAdjustment in the three modes, or drop it from the interface and the call site so the contract stops promising what nothing honours.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions