Dart Documentationdartkart.mapControlsPane

ControlsPane class

The container class for MapControls. There's exactly one ControlsPane in a MapViewport.

class ControlsPane {
 MapViewport _viewport;
 DivElement _root;

 final List<MapControl> controls = [];

 ControlsPane() {
   _root = new Element.tag("div");
 }

 /// the root DOM element for this control
 DivElement get root => _root;

 /// Detach this pane from the map viewport.
 void detach() {
   _viewport = null;
 }

 /// Attach this control pane to the [viewport]. [viewport]
 /// must not be null.
 void attach(MapViewport viewport) {
   _require(viewport != null, "viewport must not be null");
   _viewport = viewport;
   _root.style
     ..width = "100%"
     ..height = "100%"
     ..position = "absolute"
     ..top = "0px"
     ..left = "0px";
   // Don't add the _container to the viewport container,
   // the map viewport takes care of this
 }

 /// layout the contronls pane
 void layout() {
   controls.forEach((c) => c.layout());
 }
}

Constructors

new ControlsPane() #

ControlsPane() {
 _root = new Element.tag("div");
}

Properties

final List<MapControl> controls #

final List<MapControl> controls = []

final DivElement root #

the root DOM element for this control

DivElement get root => _root;

Methods

void attach(MapViewport viewport) #

Attach this control pane to the viewport. viewport must not be null.

void attach(MapViewport viewport) {
 _require(viewport != null, "viewport must not be null");
 _viewport = viewport;
 _root.style
   ..width = "100%"
   ..height = "100%"
   ..position = "absolute"
   ..top = "0px"
   ..left = "0px";
 // Don't add the _container to the viewport container,
 // the map viewport takes care of this
}

void detach() #

Detach this pane from the map viewport.

void detach() {
 _viewport = null;
}

void layout() #

layout the contronls pane

void layout() {
 controls.forEach((c) => c.layout());
}