Customize the Geolocation / Map field

Below script at Change how a particular map is rendered not working.

frappe.ui.form.on("Location", {
    setup(frm) {
        frm.fields_dict.location.on_each_feature = function(feature, layer) {
            if (feature.geometry.type == "Polygon") {
                layer.setStyle({color: "red"});
            }
        };
    }
});

How to set color, set “fill” false for LineString?
Someone please suggest any hint, or what I am missing in this script.

Update:
This script is working now.
Due to my custom CSS this was not working before.
I excluded class “leaflet-interactive” from my custom CSS and it worked fine.