-
Notifications
You must be signed in to change notification settings - Fork 287
Open
Description
We are now building on the keymapper further, from the last PR #243 based on "Keymapper Pt. 2 - Modularity" #239
focus on making the keymapper Dynamic. Right now it is hardcoded.
- if we make changes to the actions available needs to be dynamic
- figure out how to integrate it with single and multiple image interface, as they have two different sets of tools
- lets get structured into a formula that then generates the strings based on passed parameters: - use templating feature?:
Templating
In map applications we often have to create tooltips, legends or other generic elements. The L.Util.template function can help us with this. It takes a template string and an object that includes the template data:
var tooltipTemplate =
'In the district live <strong>{persons} persons<strong>.<br />' +
'{children} of them are children, {adults} adults and {seniors} seniors';
var tooltipData = {
persons : 1400,
children : 400,
adults: 800,
seniors : 200
};
var tooltipContent = L.Util.template(tooltipTemplate, tooltipData);
// returns: 'In the district live <strong>1400 persons</strong>.<br />400 of them are children, 800 adults and 200 seniors'
// now we can add the HTML to a certain element
L.DomUtil.get('tooltip').innerHTML = tooltipContent;
As you can see we are also allowed to use HTML in the template string.- lets add some tests to make it legit
======================
Next:
Part 4: will focus on allowing live user editing of the keymapper to update keybindings
======================