Skip to content
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

Support centered map without marker #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jeromelebleu
Copy link
Contributor

@jeromelebleu jeromelebleu commented Mar 28, 2019

The location field might seem currently required, as there is always a marker on the map. It can be difficult so to track when the address has not been found for example, or when the user didn't touch the marker.

This tries to surround that by introducing a new option: map.center. If the field has no value, instead of using 0,0 as default - or setting an initial value which can disturb the user - the marker is hidden and the map is panned to this position. As soon as the user click on the map or a location is found, the marker is shown. However, if the field has a value, the current behavior is kept and map.center is not taken into account.

What do you think? If you approve that, my next plan is to allow one to override this value at model, form or widget level...

Note that there will be a conflict if #117 is merged that I will fix.

@jeromelebleu jeromelebleu force-pushed the default-position branch 2 times, most recently from c1c693f to 12e6b1e Compare March 28, 2019 15:53
@caioariede
Copy link
Owner

I'm wondering if we should use what's defined in field's default value, for example:

 location = LocationField(based_fields=['city'], zoom=7, default=Point(1.0, 1.0))

@caioariede caioariede self-requested a review March 28, 2019 16:29
@jeromelebleu
Copy link
Contributor Author

The problem I see with default value is that it prevent to have an empty one. I have several cases where I want to keep an empty value if the user didn't set the marker on the map - or if no position has been found for based_fields - to prevent to have wrong geolocalization... So I think about this solution instead of always overriding clean() method to empty the value if it's the same as the default. Do you see any other way to do that?

@caioariede
Copy link
Owner

@jeromelebleu can you please provide a video/gif on how this works?

Also it would need a rebase, thanks!

@jeromelebleu
Copy link
Contributor Author

@caioariede I have rebased and fix the conflict! I am not sure to find the time at the moment to provide a video/gif, but I could at least document it a bit more and maybe add it to the example application? By the way, did you succeed to try it?

@caioariede
Copy link
Owner

@jeromelebleu yes, if you could add it to the example application would be great!

@caioariede
Copy link
Owner

btw, the gif can be easily created using LICEcap (just a tip)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants