apneadiving / Google-Maps-for-Rails

Enables easy Google map + overlays creation in Ruby apps
https://apneadiving.github.io/
MIT License
2.26k stars 382 forks source link

Added support for z-index in markers #174

Closed tomups closed 12 years ago

tomups commented 12 years ago

Allows to set the z-index of markers so they would overlap with a custom priority.

Can be set like this

counter = 0
@json = User.all.to_gmaps4rails do |user, marker|
     marker.picture({
                     :picture => "http://www.blankdots.com/img/github-32x32.png",
                     :width   => "32",
                     :height  => "32",
                     :zindex =>  User.all.size - counter   # can be set here
                    })
     marker.title   "i'm the title"
     marker.sidebar "i'm the sidebar"
     marker.json({ :id => user.id, :zindex => User.all.size - counter}) # ...or here as well
     counter += 1
end

This would overlap the markers in order of insertion (first marker at top, last marker at bottom)

apneadiving commented 12 years ago

Thanks for your job!

I'm rewriting part of the gem, I'll merge this when I'm done with my current task :)

tomups commented 12 years ago

Cheers!

Looking forward to the rewrite. I hope you will keep backwards compatibility though :)

apneadiving commented 12 years ago

Well, I'm fed up of the non semantic Gmaps.map.map syntax

So I guess I'll rename it somehow to make it more understandable.

No other backward incompatibility I guess but I'll keep posting them.

On Apr 17, 2012, at 9:58 PM, Tomás Arribas wrote:

Cheers!

Looking forward to the rewrite. I hope you will keep backwards compatibility though :)


Reply to this email directly or view it on GitHub: https://github.com/apneadiving/Google-Maps-for-Rails/pull/174#issuecomment-5184349

apneadiving commented 12 years ago

just taken the code, but I couldn't merge automatically. Thanks!

apneadiving commented 12 years ago

1.5.0.pre released.

I've removed css inclusion in pipeline + enable_js and enable_css for view_helper.

The rest should be fully backward compatible.

tomups commented 12 years ago

Brilliant! Great job as usual.

So still Gmaps.map.map in JS?

apneadiving commented 12 years ago

Well... yes I don't dare changing this since it will confuse many people.

But that's why 1.5.0 is still pre: I am not sure what to do...

Your point of view?

On May 1, 2012, at 12:27 AM, Tomás Arribas wrote:

Brilliant! Great job as usual.

So still Gmaps.map.map in JS?


Reply to this email directly or view it on GitHub: https://github.com/apneadiving/Google-Maps-for-Rails/pull/174#issuecomment-5429368

tomups commented 12 years ago

I would call it Gmaps.map.serviceObject, like you are doing with markers already.

To keep backwards compatibility, make Gmap.map.map refer to serviceObject as well for now, and just update the docs saying serviceObject is the preferred naming convention for all and any references to "native" objects of the currently used map API, with a deprecation warning for .map.map.

apneadiving commented 12 years ago

It's not that straight:

Gmaps.map stands for Gmaps.the_id_of_the_div_containing_the_map

So if someone calls it foo, Gmaps.foo.serviceObject would be really non sense...

But I wonder if many people really change the map's id...

Sent from my iPhone

On 1 mai 2012, at 00:42, Tomás Arribasreply@reply.github.com wrote:

I would call it Gmap.map.serviceObject, like you are doing with markers already.

To keep backwards compatibility, make Gmap.map.map refer to serviceObject as well for now, and just update the docs saying that's the preferred naming convention, with a deprecation warning for .map.map.


Reply to this email directly or view it on GitHub: https://github.com/apneadiving/Google-Maps-for-Rails/pull/174#issuecomment-5429654

tomups commented 12 years ago

I suggested serviceObject so it would follow some kind of standard with the markers :) If you are happy with an alternative naming, something like nativeMap, nativeApi, nativeObject... might be clearer. But then for markers it would have to be nativeMarker and so on... if you want to keep that level of consistency.

In my case I didn't have a need to changed the map ID, as I only have 1 map per page so far. But if I had to change it, most surely I would name it "foo-bar-map", so it would be Gmaps.foo_bar_map.serviceObject, which is not bad. I think most people would place "map" somewhere in the ID if changing it.

apneadiving commented 12 years ago

Ok thanks for your feedback.

I guess I'll do the renaming leap with serviceObject and face the flow of questions, for semantic sake!

After all, we are all supposed to clarify the version of the gems we use in Gemfile so there is no reason, hopefuly, I break some prod app...

Sent from my iPhone

On 1 mai 2012, at 00:54, Tomás Arribasreply@reply.github.com wrote:

I suggested serviceObject so it would follow some kind of standard with the markers :) If you are happy with an alternative naming, something like nativeMap, nativeApi, nativeObject... might be clearer. But then for markers it would have to be nativeMarker and so on... if you want to keep that level of consistency.

In my case I didn't have a need to changed the map ID, as I only have 1 map per page so far. But if I had to change it, most surely I would name it "foo-bar-map", so it would be Gmaps.foo_bar_map.nativeObject, which is not bad. I think most people would place "map" somewhere in the ID if changing it.


Reply to this email directly or view it on GitHub: https://github.com/apneadiving/Google-Maps-for-Rails/pull/174#issuecomment-5429916

tomups commented 12 years ago

Cheers :) But please give a thought to keeping a deprecated Gmaps.map.map reference for a few versions to let people catch-up.

Best would be to show a deprecation warning in the console when accessing .map.map, bunt until this is implemented in browsers there's no way! :(

apneadiving commented 12 years ago

Yep, so:

I'll:

Seems reasonable!

Thanks for your insights :)

Sent from my iPhone

On 1 mai 2012, at 01:34, Tomás Arribasreply@reply.github.com wrote:

Cheers :) But please give a thought to keeping a deprecated Gmaps.map.map reference for a few versions to let people catch-up.

Best would be to show a deprecation warning in the console when accessing .map.map, bunt until this is implemented in browsers there's no way! :(


Reply to this email directly or view it on GitHub: https://github.com/apneadiving/Google-Maps-for-Rails/pull/174#issuecomment-5430515

tomups commented 12 years ago

Looks fine :) Looking forward to it!

apneadiving commented 12 years ago

1.5.0pre2 is released :)

tomups commented 12 years ago

Got 1.5.1, working fine :)

A small note: I think it's better to show deprecation messages as a gem post-install message rather than on the console, as it can get annoying in the long term :). Nothing major though!

Thanks for the great work as usual. Gmaps4rails has proven invaluable in shortening dev and testing time for our project, which is based heavily in maps!