Constructs a compass control with default settings. The compass control provides a user interface widget for panning and zooming as an alternative to mouse and keyboard controls. The compass also provides shift-drag support for zooming to a given extent.
The compass is not part of the standard set of interaction controls (see po.interact). The compass control is rendered using SVG elements and must be styled through CSS. An example stylesheet is available in the Git repository.
Adds this control to the specified map x, removes this control from its current map, or returns the current map. This method is typically not called directly, but is needed to support the map’s add and remove methods.
If the argument x is specified, this method returns this. If x is null, this control is removed from its current map; otherwise, this control is added to the specified map. If no arguments are specified, this method returns the current map, which may be null. Whew!
Compass controls should be added after any layers so that they are visible. If a compass control is added before a layer, it will typically be occluded by the layer’s tiles.
Sets or gets the radius of the panning controls. If the argument x is specified, this method sets the radius to the given value (a number of pixels) and returns this. If no arguments are specified, this method returns the current radius.
If a custom radius is desired, this method must be called before the compass control is added to the map. The default radius is 30 pixels.
Sets or gets the position of the compass. If the argument x is specified, this method sets the position to the given named value and returns this. If no arguments are specified, this method returns the current named position.
The following position names are supported, representing the four corners of the map: “top-left”, “top-right”, “bottom-left”, “bottom-right”.
Sets or gets the pan style of the compass. If the argument x is specified, this method sets the pan style to the given named value and returns this. If no arguments are specified, this method returns the current named pan style.
The following pan styles are supported: “none”, “small”.
Sets or gets the zoom style of the compass. If the argument x is specified, this method sets the zoom style to the given named value and returns this. If no arguments are specified, this method returns the current named zoom style.
The following zoom styles are supported: “none”, “small”, “big”.