New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Separate each tool into its own file, starting with "toggleExport" #161
Comments
@jywarren I think that most modern rails applications use webpack and it wouldn't be difficult to set up a config file. I think we should go for the former because it is encapsulated and clear about what its point is. Would be to take this up once i get the exporter system for Mapknitter running |
@jywarren Let's pin this one! That would ensure that we abide by this approach. What to you think? |
@rexagod pinned! |
adding this here as it explains the end goal that this PR is working towards -- this is branched out of #140 "We have a general need to brainstorm new UI designs for tools as more tools are added. Maybe nested menus or a modal for more tools, as the menu runs out of space? |
This one is good to close now! |
Currently all the different tools live in this file:
https://github.com/publiclab/Leaflet.DistortableImage/blob/main/src/edit/DistortableImage.Edit.js
I think it makes sense to create a new folder such as:
/src/edit/tools/
and have each tool be a separate file like:
/src/edit/tools/export.js
/src/edit/tools/showToolbar.js
etc. However, this library is not compiled using
browserify
orwebpack
and so we can't userequire()
to do this.Is it:
Leaflet
, likeL.DistortableImage.EditTools
?require
(a lot of work... maybe not worth it)In either case, we'll have to pass in some context to the tools; most ask for access to
this
, which in this case is theL.DistortableImage.Edit
context. We could pass this in like so:Then back in the original
DistortableImage.Edit.js
file, we'd bind it back in like this:The only thing left is that we'd need to add each tool to the concatenation script here:
Leaflet.DistortableImage/Gruntfile.js
Lines 78 to 81 in a3dc6d1
This is a bit convoluted but should result in a simpler set of source files for the tools, where each file represents only a single function.
@rexagod @sashadev-sky what do you think of this?
The text was updated successfully, but these errors were encountered: