disable map filtering when using other filters

<?
/**
 * disables map filtering if enabled when other
 * filters are used instead
 **/
add_action( 'facetwp_scripts', function() {
 ?>
  <script>
    (function($) {
    document.addEventListener('facetwp-refresh', function() {
        if ( null !== FWP.active_facet &&
                '' !== $(FWP.active_facet.nodes[0]).attr('data-name' ) &&
                /** change 'my_map_facet' to name of your map facet */
                'my_map_facet' !== $(FWP.active_facet.nodes[0]).attr( 'data-name' ) ) {
            var $button = $('.facetwp-map-filtering');
            $button.text(FWP_JSON['map']['filterText']);
            FWP_MAP.is_filtering = false;
            $button.toggleClass('enabled');
            FWP.facets.map = [];
        } 
    });
    })(fUtil);
  </script>
  <?php
}, 100 );