fixed button toggling

This commit is contained in:
Elad Bernard Haviv 2023-08-04 12:03:05 +03:00
parent 49f9486f97
commit 128231144e

View file

@ -14,6 +14,7 @@ function overviewMarkers() {
const markersGenerationConfig = document.getElementById("markersGenerationConfig"); const markersGenerationConfig = document.getElementById("markersGenerationConfig");
const markersRemoveAll = document.getElementById("markersRemoveAll"); const markersRemoveAll = document.getElementById("markersRemoveAll");
const markersExport = document.getElementById("markersExport"); const markersExport = document.getElementById("markersExport");
const markerTypeInput = document.getElementById("addedMarkerType");
addLines(); addLines();
@ -25,9 +26,6 @@ function overviewMarkers() {
position: {my: "right top", at: "right-10 top+10", of: "svg", collision: "fit"} position: {my: "right top", at: "right-10 top+10", of: "svg", collision: "fit"}
}); });
const markerTypeInput = document.getElementById("addedMarkerType");
markerTypeInput.addEventListener("change", toggleAddMarker);
Markers.getConfig().forEach(markerConfig => { Markers.getConfig().forEach(markerConfig => {
const option = document.createElement("option"); const option = document.createElement("option");
option.setAttribute("value", markerConfig.type); option.setAttribute("value", markerConfig.type);
@ -43,7 +41,8 @@ function overviewMarkers() {
listen(markersAddFromOverview, "click", toggleAddMarker), listen(markersAddFromOverview, "click", toggleAddMarker),
listen(markersGenerationConfig, "click", configMarkersGeneration), listen(markersGenerationConfig, "click", configMarkersGeneration),
listen(markersRemoveAll, "click", triggerRemoveAll), listen(markersRemoveAll, "click", triggerRemoveAll),
listen(markersExport, "click", exportMarkers) listen(markersExport, "click", exportMarkers),
listen(markerTypeInput, "change", changeMarkerType),
]; ];
function handleLineClick(ev) { function handleLineClick(ev) {
@ -154,6 +153,12 @@ function overviewMarkers() {
addMarker.click(); addMarker.click();
} }
function changeMarkerType() {
if (!markersAddFromOverview.classList.contains("pressed")) {
toggleAddMarker();
}
}
function removeMarker(i) { function removeMarker(i) {
notes = notes.filter(note => note.id !== `marker${i}`); notes = notes.filter(note => note.id !== `marker${i}`);
pack.markers = pack.markers.filter(marker => marker.i !== i); pack.markers = pack.markers.filter(marker => marker.i !== i);