This is the documentation of version 1.0.0-rc.4. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Type Alias RouteDraggingOptions

    Options for RouteDragging.

    type RouteDraggingOptions = {
        insertFromRouteLines?: boolean;
        onError?: (error: unknown) => void;
        onRoutes?: (routes: Routes, waypoints: PlanningWaypoint[]) => void;
        onWaypointsChange?: (
            waypoints: PlanningWaypoint[],
            drag: WaypointDrag,
        ) => void;
        plan?: RouteDraggingPlanner | false;
        planIntervalMS?: number;
        showOnMap?: boolean;
    }
    Index
    insertFromRouteLines?: boolean

    Whether dragging a route line pulls a new waypoint off it, between the stops its detour fits best.

    true

    onError?: (error: unknown) => void

    Called when planning fails.

    a console.warn

    onRoutes?: (routes: Routes, waypoints: PlanningWaypoint[]) => void

    Called with each planned answer, in order: an answer older than one already received is dropped.

    Type Declaration

      • (routes: Routes, waypoints: PlanningWaypoint[]): void
      • Parameters

        • routes: Routes
        • waypoints: PlanningWaypoint[]

          The waypoints the routes were planned for

        Returns void

    onWaypointsChange?: (waypoints: PlanningWaypoint[], drag: WaypointDrag) => void

    Called on every step of a drag, with the waypoints it leaves.

    plan?: RouteDraggingPlanner | false

    Plans the routes for the waypoints, null placeholders left out.

    Pass your own to plan with your route options, or false to plan nothing and only get the waypoint changes.

    calculateRoute({ locations, signal })

    planIntervalMS?: number

    How often the routes re-plan while a drag lasts, in milliseconds. The drop always plans once more.

    500

    showOnMap?: boolean

    Whether the plugin shows the dragged waypoints and the planned routes on the routing module.

    Set it to false when your app shows them itself: apply each change onWaypointsChange reports and show the routes onRoutes receives.

    true