publiclab / Leaflet.DistortableImage

A Leaflet extension to distort or "rubber sheet" images
https://publiclab.github.io/Leaflet.DistortableImage/examples/
BSD 2-Clause "Simplified" License
271 stars 283 forks source link

Keymapper Pt. 3 - Dynamic #368

Open sashadev-sky opened 5 years ago

sashadev-sky commented 5 years ago

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.

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.

======================

Next:

Part 4: will focus on allowing live user editing of the keymapper to update keybindings

======================

sashadev-sky commented 5 years ago

@jywarren @rexagod

sashadev-sky commented 5 years ago

Our keymapper is really going places

rexagod commented 5 years ago

Sasha, can you elaborate on the first two points above please? Didn't quite get those. Thanks!

sashadev-sky commented 5 years ago

@rexagod so like with the actions API we now have the ability to remove actions. I'm thinking if a user removes an action they also want to be removing the keybinding for it right? Right now we don't have that in sync but I think it's a bug to fix?

rexagod commented 5 years ago

Makes sense, and this would be a nice enhancement to add! 👍

sashadev-sky commented 5 years ago

@rexagod in progress already?? woah!

rexagod commented 5 years ago

Sorry for the delay here, something really frustrating has came up and I'm just up awake days and night trying to fix that with no luck whatsoever. :/

rexagod commented 5 years ago

Also I haven't forgot about #372, #358, or #225 as well, just want to fix the this issue ASAP and integrate the matcher into IS through node like @jywarren said, which is also my first priority atm, but I haven't heard back from the folks at puppeteer till now.

Tough times.