Remove/reduce visibility of polygon border

New home Forums Pro Add-on General queries Remove/reduce visibility of polygon border

This topic contains 14 replies, has 4 voices, and was last updated by  AbelC 1 month, 1 week ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #26524

    Hi, I can remove/reduce visibility of polygon border in resting state but not in rollover. is there any way to remove it completely? I’ve got to join up multiple areas and don’t want the connection visible. See attached screenshot.
    Regards,
    Bryan

    Attachments:
    You must be logged in to view attached files.
    #26526

    Perry
    Moderator

    Hi Bryan,

    Are you using WP Google Maps Basic or do you have the Pro add-on?

    Thank you

    #26527

    Pro. I can dig out my license code if it helps.

    #26528

    Perry
    Moderator

    Hi Bryan,

    No that’s fine, can you please direct me to your site though? You should definitely be able to set the opacity to zero on the hover settings, there must be something else going on

    Thank you

    #26529

    The site is still in development so I can’t send you the link but the options are just missing that field. See attached screenshot.

    Attachments:
    You must be logged in to view attached files.
    #26531

    Perry
    Moderator

    Hi Bryan,

    I see what you mean

    Can you please open /wp-content/plugins/wp-google-maps-pro/js/core.js and go to around line 3128, inside the add_polygon function

    You’ll see the following code:

    google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "mouseover", function(event) {
                 this.setOptions({fillColor: "#"+tmp_data['ohfillcolor']});
                 this.setOptions({fillOpacity: tmp_data['ohopacity']});
                 this.setOptions({strokeColor: "#"+tmp_data['ohlinecolor']});
                 this.setOptions({strokeWeight: 2});
                 this.setOptions({strokeOpacity: 0.9});
           });

    Can you please change that to

    google.maps.event.addListener(WPGM_Path_Polygon[polygonid], "mouseover", function(event) {
                 this.setOptions({fillColor: "#"+tmp_data['ohfillcolor']});
                 this.setOptions({fillOpacity: tmp_data['ohopacity']});
                 this.setOptions({strokeColor: "#"+tmp_data['ohlinecolor']});
                 this.setOptions({strokeWeight: 2});
           });

    Eg. Delete the line that says strokeOpacity: 0.9

    Please note this is a quick workaround and will affect every map on your site, we can tweak it if that’s unacceptable.

    I’m going to add a note to include “Hover line opacity” in the next version, so thanks for bringing this to our attention!

    Is there anything else I can help you with?

    #26536

    Great, thanks!

    #26578

    Perry
    Moderator

    Hi Bryan,

    My pleasure!

    If there’s anything else I can help you with please feel free to ask

    Thank you
    – Perry (WP Google Maps – Support)

    #27370

    Perry
    Moderator
    This reply has been marked as private.
    #54765

    KZeni
    Member

    I would like to revisit the idea of having “On Hover Line Opacity” alongside the other polygon settings. It seems odd that everything’s provided except for hover line opacity when creating/editing a polygon, and that then can lead to undesirable results due to it not acting how you actually want (ex. I want the line to never be shown, but that’s currently not an option when using v8 Pro.)

    #54771

    KZeni
    Member

    Btw, I’ve gone ahead and implemented:

    
    if(window.location.href.indexOf("communities") > -1 || window.location.href.indexOf("community") > -1){
    	$(WPGM_Path_Polygon).each(function(i){
    		if(this !== window){
    			google.maps.event.addListener(WPGM_Path_Polygon[i], "mouseover", function(event) {
    				this.setOptions({strokeOpacity: 0});
    			});
    		}
    	});
    }
    

    for my site’s specific needs. Again, I don’t want the polygons to show a line at all on hover (nor in the original state, but that actually does have a setting made available when editing polygons unlike on hover line opacity, currently.)

    You can see this is definitely a workaround where I’m even needing to target specific maps on the site for this to happen on since I don’t want this to happen on all maps.

    Again, I’d be ideal if on hover line opacity was a setting when editing polygons as this was mentioned as being looked at for v7 (with it now being v8 & still not addressed.)

    #54773

    KZeni
    Member

    I’ve actually updated this to now be https://gist.github.com/KZeni/33f795b83303343655cf74e612acbe53 so the click interaction is also accommodated (matching the hover style).

    As such, I think the click styling should match the mouseover styling of the on hover line opacity setting for when that’s officially implemented (I’d love to have & use that instead of this workaround.)

    #55266

    AbelC
    Moderator

    Hi There,

    Thank you so much for letting us know, and our sincere apologies for the delayed response.

    Unfortunately, it is not supported to add polygons with holes or multiploygons at the moment. We do apologize for the inconvenience.

    However, we will look into adding this feature to our plugin in the future.

    We will also be adding the functionality “On Hover Line Opacity” to our plugin.

    With that said, there will still be some noticeable overlap with the semi-transparent fills of the respective polygons if you set the line opacity to zero.

    We recommend you to add one large polygon that covers all the areas. You can then add smaller polygons that are fully transparent until hovering.

    Again, we do apologize for the inconvenience.

    I hope this helps clarify, and please do let me know if this is working for you.

    Kind Regards,
    Abel

    #55298

    KZeni
    Member

    Thanks for the response @abelc!

    First & foremost, the “On Hover Line Opacity” functionality (which also has click styling matching hover like the fill behavior currently has) is the most important thing & I’d love to see that added officially. As a side benefit, this also appears to be rather straightforward to get implemented.

    Regarding the holes within polygons, it would be nice to have this available, but I found a reasonable solution. Create the part you want to be the hole as the polygon first and then click to create a square (or any other shape as needed) container surrounding that polygon to find that it effectively creates a hole within that container. You just need to then make the first & last points on the container shape line up as best as possible. Also, you need to make it so the line opacity is set to 0 at all times (even on hover & click, which I really want to have officially supported) since that otherwise creates a line where the container shape starts & ends from the interior shape/”hole”. With my workaround above, this method for creating holes had no visual artifacts or negative side-effects in my implementation.

    Multipolygons would also be beneficial since boundaries can sometimes have islands, outlying areas, etc. that are part of the same thing being shown. For now, I’ve just had multiple individual polygons for this & customized it to work as best as possible (making it so it’s clear as possible that it’s part of the same area as the other polygon[s]). Of course, being able to have these as one selectable item would be ideal. The workaround to try and piece these together with a very narrow connection between them still has a visual artifact that’s too noticeable for my taste (instead opting for the individual polygons in my specific use case), but it might be what’s needed by some until this is officially supported.

    #55307

    AbelC
    Moderator

    Hi There,

    Thank you so much for getting back to me.

    I have added the “On Hover Line Opacity” functionality to the Feature Request items for our development team to have a look at.

    We will also look into supporting multipolygons and holes in polygons for the Google Maps and OpenLayers map engine.

    Thank you so much for your suggestion.

    Please do let me know if there is anything else that we can assist you with.

    We will gladly assist with any questions or issues you may be having.

    Kind Regards,
    Abel

    • This reply was modified 1 month, 1 week ago by  AbelC.
Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.