Skip to content

Commit

Permalink
Add inline example for trackPointer (#9575)
Browse files Browse the repository at this point in the history
  • Loading branch information
Katy DeCorah authored Apr 20, 2020
1 parent 8279ca5 commit 3f39525
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ui/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,13 @@ export default class Popup extends Evented {
}

/**
* Tracks the popup anchor to the cursor position, on screens with a pointer device (will be hidden on touchscreens). Replaces the setLngLat behavior.
* For most use cases, `closeOnClick` and `closeButton` should also be set to `false` here.
* Tracks the popup anchor to the cursor position on screens with a pointer device (it will be hidden on touchscreens). Replaces the `setLngLat` behavior.
* For most use cases, set `closeOnClick` and `closeButton` to `false`.
* @example
* var popup = new mapboxgl.Popup({ closeOnClick: false, closeButton: false })
* .setHTML("<h1>Hello World!</h1>")
* .trackPointer()
* .addTo(map);
* @returns {Popup} `this`
*/
trackPointer() {
Expand Down

0 comments on commit 3f39525

Please sign in to comment.