Widget control

Example

#include "xleaflet/xmap.hpp"
#include "xleaflet/xbasemaps.hpp"
#include "xwidgets/xslider.hpp"
#include "xwidgets/xnumeral.hpp"
#include "xwidgets/xlink.hpp"
#include "xleaflet/xwidget_control.hpp"

std::array<double, 2> center = {52.204793, 360.121558};

auto map = xlf::map::initialize()
    .center(center)
    .zoom(4)
    .close_popup_on_click(false)
    .finalize();
map.display();

auto button1 = xw::slider<double>::initialize()
    .min(1.0)
    .max(9.0)
    .value(4.0)
    .orientation("horizontal")
    .finalize();

auto popup2 = xlf::widget_control::initialize()
    .widget(button1)
    .position("bottomright")
    .finalize();
map.add_control(popup2);

xw::numeral<double> numeral;
auto popup4 = xlf::widget_control::initialize()
    .widget(numeral)
    .position("topright")
    .finalize();
map.add_control(popup4);


auto l = xw::link(numeral, "value", map, "zoom");
auto m = xw::link(button1, "value", map, "zoom");
<div style ="height:30px;"> </div>

Attributes

Attribute

Type

Default Value

Doc

widget

xwidget

Content of the widget

position

string

Position of the widget