Public Lab

use `#replaceTool` method in MapKnitter

Problem

a #replaceTool method was added recently to compliment the existing #addTool and #removeTool methods.

https://github.com/publiclab/Leaflet.DistortableImage/blob/686e01a656cc2a693b44836c5117a7ca69ca8373/src/edit/DistortableImage.Edit.js#L176-L191

Now we want to use it downstream in MapKnitter.

Solution

MapKnitter takes advantage of LDI's tool API to remove the delete tool, create a custom variation of it, and add that tool instead.

https://github.com/publiclab/mapknitter/blob/5d825a9992dce58ae2d295612662d8402f65f5ee/app/assets/javascripts/mapknitter/Map.js#L160-L169

  • update the Leaflet.DistortableImage dependency version in MK's package.json to 0.8.7. (Update it manually, run yarn install)
    • replace out the code linked above with an implementation using #replaceTool

Additional Information

Please find further information on installation, solving, & getting help on the linked issue.

Thank you 😊

Task tags

  • npm
  • medium
  • javascript

Students who completed this task

NotDeGhost

Task type

  • code Code
close

2019