diff --git a/srcs/plugins/map_prof/mp_create_div.php b/srcs/plugins/map_prof/mp_create_div.php index 8871cef..864484e 100644 --- a/srcs/plugins/map_prof/mp_create_div.php +++ b/srcs/plugins/map_prof/mp_create_div.php @@ -22,7 +22,7 @@ function mp_filter_drop_down($key, &$filter) {

'.$value->_name.'

*/ $content .= ' -

'.$value->_name.'

+

'.$value->_name.'

'; } $content .= ' @@ -37,19 +37,17 @@ function mp_filter_buttons($key, &$filter) { //

TOUT DESELECTIONNER

- $content = ' - - '; return $content; }; @@ -69,8 +67,8 @@ function mp_create_div(&$filters) { }; $mp_map_div .= ' -
-
+
+

sans filtre

diff --git a/srcs/plugins/map_prof/scripts/mp_filter_events.js b/srcs/plugins/map_prof/scripts/mp_filter_events.js index ce5016a..8dd2c55 100644 --- a/srcs/plugins/map_prof/scripts/mp_filter_events.js +++ b/srcs/plugins/map_prof/scripts/mp_filter_events.js @@ -8,7 +8,7 @@ * return intersection of both arrays : indexes and g_indexes */ -function filter_selection_indexes(indexes) { +function filter_selection_indexes(indexes, invert) { // if g_indexes empty, just fill it with indexes // because it's like intersection of indexes and g_indexes if g_indexes was the list of all markers if (g_indexes.length == 0) { @@ -34,9 +34,24 @@ function filter_selection_indexes(indexes) { * even if already visible in current view */ -function filter_show_only_selection(indexes, zoom_in = false) { +function filter_show_only_selection(element, indexes, zoom_in = false) { + //console.log("element:"); + //console.log(element); + //console.log("element.checked:"); + //console.log(element.checked); + //console.log("element.attributes.type:"); + //console.log(element.attributes.type); + //console.log("element.attributes.type.value:"); + //console.log(element.attributes.type.value); - filter_selection_indexes(indexes); + let type = element.attributes.type; + let invert = false; + if (type != null) + type = type.value; + if (type === "checkbox") + invert = true; + // if checkbox is unchecked, re-add filters + filter_selection_indexes(indexes, invert); let indexes_count = g_indexes.length; if (indexes_count === 0) diff --git a/srcs/plugins/map_prof/styles/mp_filters.css b/srcs/plugins/map_prof/styles/mp_filters.css index c7fa868..1981ce4 100644 --- a/srcs/plugins/map_prof/styles/mp_filters.css +++ b/srcs/plugins/map_prof/styles/mp_filters.css @@ -16,6 +16,8 @@ position: relative; width: 100%; z-index: 1; + gap: 10px; + margin-bottom: 10px; } /* @@ -28,16 +30,27 @@ width: 100%; overflow: visible; cursor: pointer; -} -#ljdp_map_filters .filter_menu_title { border: 1px solid #ba197a; } -#ljdp_map_filters .filter_menu_title p { +#ljdp_map_filters .filter_menu * { + cursor: pointer; +} + +#ljdp_map_filters .filter_menu_title { + width: 100%; padding: 5px; } +#ljdp_map_filters .filter_menu_title p { + /* display inline-block for text-align to work */ + display: inline-block; + width: 100%; + text-align: center; +} + + /* ************************************** DROP DOWN MENU @@ -57,7 +70,6 @@ left: 0px; max-height: 400px; width: 100%; - cursor: pointer; overflow: scroll; background-color: #ffffff; @@ -99,26 +111,33 @@ /* ************************************** - MENU BUTTONS + MENU CHECKBOX */ /* */ +#ljdp_map_filters label.filter_menu_checkbox { + border-radius: 20px; +} -#ljdp_map_filters .filter_menu_buttons { - flex-direction: row; +#ljdp_map_filters input.filter_menu_checkbox:checked + label.filter_menu_checkbox { + color: #ffffff; + background-color: #ba197a; } /* ************************************** - MENU RESET + MENU BUTTON */ /* */ - +#ljdp_map_filters .filter_menu_button { + flex-shrink: 2; + white-space: nowrap; +}