-
Notifications
You must be signed in to change notification settings - Fork 284
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
save map coordinates in local storage #1225
base: main
Are you sure you want to change the base?
Conversation
@jywarren , @TildaDares please review our pr |
@@ -218,11 +218,17 @@ L.DistortableCollection = L.FeatureGroup.extend({ | |||
|
|||
json.images = json.images.reverse(); | |||
json.avg_cm_per_pixel = this._getAvgCmPerPixel(json.images); | |||
|
|||
var jsonImages = json.images; | |||
savetoLocalStorage(jsonImages); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, this is looking like a good start, thank you! I wanted to suggest that you build on #1237, because it is almost the same! We'll want to make a function which runs each time there is an update to an image... it could even be each time there's a MouseUp, maybe? And it'll write a new "saved state" into localStorage, and similarly to #1237, not just the selected ones but all the images.
Shall we wait a little bit until #1237 is resolve then? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually wait, cancel that. My mistake. I meant #1161 -- where we are working with the generateExportJson()
function. Unfortunately I think there is some overlap between #1237 and #1161, and I'd like to ask you and @leilayesufu to try to work together on #1237 and to record a joint contribution. Would you both be willing to try that, since it's quite a complex one? If so, you can mark the PR as collaborative and work on it together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, this is looking like a good start, thank you! I wanted to suggest that you build on #1237, because it is almost the same! We'll want to make a function which runs each time there is an update to an image... it could even be each time there's a MouseUp, maybe? And it'll write a new "saved state" into localStorage, and similarly to #1237, not just the selected ones but all the images.
Shall we wait a little bit until #1237 is resolve then? Thanks!
Hi Jeff, I'm little bit confused how to get started on this. Could you please drop some hints? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Jeff, just a little hint, please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @vanithaak -- so, I had realized that I was also working with @leilayesufu on a parallel track on parts of this, in #1161 -- and we had found that the problem was it only downloaded images that have been selected, so we needed to modify generateExportJson()
to have a an onlySelected
parameter defaulting to true, but so that we can override it if we want ALL images:
Once this modification is made, we can use generateExportJson()
for both downloading a JSON file, and storing the JSON file in localStorage. If you or @leilayesufu are interested in continuing to work on this, I think that's the key. It could even be done as its own PR -- and then we can begin using generateExportJson(false)
to collect ALL images, for saving in localStorage OR for download. Does that make sense?
Hi @7malikk, thank you so much for asking. Please go ahead to work on this feature. Would love to see your work! |
@jywarren, you mirrored my thought on the consideration for supporting 'undo' operation. The 'undo' operation will only have to be limited to a lean number of save points given the memory size constraint on localStorage. |
Agreed, we can think about it later, but I've for example used a rule like "overwrite if last save is within 5 minutes ago" and there can also be a hard rule like "limit total # of saves to 50 and delete older ones when adding a new one". Thanks! |
Okay let's see. |
@jywarren per our conversation on saving a map to localStorage does the work @vanithaak accomplished set a good base? |
Hi, I think we need to design some kind of new interface for this. Could we show a list of saved maps and, maybe, how many images each save has, when it was saved? And have a button on each to recover? Would you like to try to create a sketch of how this UI might look? Thank you! |
Sure, I would like to get that done @jywarren |
Hello @jywarren I was thinking we could use a modal designed like so: What do you think? |
That looks great! It could be done with bootstrap components pretty easily
right?
…On Tue, Feb 7, 2023, 10:12 AM Malik ***@***.***> wrote:
Hello @jywarren <https://github.com/jywarren> I was thinking we could use
a modal designed like so:
[image: Saved Maps]
<https://user-images.githubusercontent.com/75104021/217283516-6af515ab-113d-4400-8f34-a3c459ee8f84.png>
What do you think?
—
Reply to this email directly, view it on GitHub
<#1225 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAF6JZT2TDYV4PLVNALMHLWWJQ37ANCNFSM6AAAAAARMLEVUM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Yea, i believe so |
I believe like you said, what we might see as giving the users options may look like complexities to the user. But in the end I believe it'll be beneficial to the the user. They'd just have to get used to it? What do you think? @jywarren |
This seems like the best spot, if we're deciding the modal does not come first But we do have to decide on where the save to localStorage button will be if there will be one. @jywarren |
Further more, if we do decide to add the save to LocalStorage, I was taking a look at the bootstrap dropdown I believe it'll suffice. |
That does sound like a good idea! Would the dropdown present both options each time, or would the main button have a default action? For example, this button has other options, but the main one is "Squash and merge". What might be the default for our Save button? I think it might be worth making a more visible button outline (using a different bootstrap style or color) as well to make it more clear, what do you think? |
As to complexity, having a strong default can really help with that. Then, new users will just use the default. Others can use the more advanced features hidden under the dropdown. How does that sound? |
@jywarren, my initial thought was that the button would trigger the dropdown which contains the two possible actions being: download or save to localStorage. With a descriptive tooltip, even new users won't find it complex in my opinion. Using the |
Hello @jywarren What do you think about this? |
This sounds great. I am not sure that's the way Bootstrap dropdowns normally work but they can probably be configured that way! |
Regarding the diagram, i like it! Very easy to read. The part about max # of maps is also a good thing to think ahead to. I think it would be a very long time before we hit the limit though... isn't localStorage like 4 mb or something? |
I'd get on it and see |
That's true, 4-5 mb |
looks perfect!! |
I know we're discussing in #1357, but also just let me know when this is ready to merge! |
Fixes #998 (<=== Add issue number here)
Co-authored by: @7malikk
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!
grunt test
If tests do fail, click on the red
X
to learn why by reading the logs.Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software
Thanks!
GIF
MapKnitter.Lite.-.Google.Chrome.2022-10-22.23-17-57.mp4