marker with size
This commit is contained in:
@@ -18,6 +18,8 @@ $(document).ready(function () {
|
||||
let descriptionTextbox = null;
|
||||
let markerObjects = {};
|
||||
let partsListData = [];
|
||||
// DIMENSIONE GLOBALE MARKER
|
||||
let globalMarkerSize = 24;
|
||||
|
||||
// ===================
|
||||
// MODAL INITIALIZATION
|
||||
@@ -67,6 +69,9 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
modal.show();
|
||||
// Inizializza slider dimensione marker
|
||||
$("#markerSizeSlider").val(globalMarkerSize);
|
||||
$("#markerSizeValue").text(globalMarkerSize + "px");
|
||||
|
||||
// Debug: Verifica presenza elementi DOM
|
||||
console.log(
|
||||
@@ -128,6 +133,7 @@ $(document).ready(function () {
|
||||
}
|
||||
descriptionTextbox = null;
|
||||
markerObjects = {};
|
||||
globalMarkerSize = 24;
|
||||
$("#photoSelectorContainerAnnotations").empty().hide();
|
||||
$("#samplePhotoAnnotations").attr("src", "");
|
||||
$("#partsListAnnotations").empty();
|
||||
@@ -144,6 +150,16 @@ $(document).ready(function () {
|
||||
$(":focus").blur();
|
||||
});
|
||||
|
||||
// SLIDER DIMENSIONE MARKER
|
||||
$(document)
|
||||
.off("input", "#markerSizeSlider")
|
||||
.on("input", "#markerSizeSlider", function () {
|
||||
globalMarkerSize = parseInt($(this).val());
|
||||
$("#markerSizeValue").text(globalMarkerSize + "px");
|
||||
updateMarkers();
|
||||
markUnsaved();
|
||||
});
|
||||
|
||||
// ===================
|
||||
// PHOTO LOADERS
|
||||
// ===================
|
||||
@@ -465,113 +481,80 @@ $(document).ready(function () {
|
||||
);
|
||||
|
||||
// ===================
|
||||
// BACK TO PARTS MODAL
|
||||
// TORNA AL MODALE PARTI (modal_partsTable.php)
|
||||
// ===================
|
||||
$(document)
|
||||
.off("click.backToParts", "#backToPartsBtnAnnotations")
|
||||
.on("click.backToParts", "#backToPartsBtnAnnotations", function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
console.log(
|
||||
"Evento click su #backToPartsBtnAnnotations, ID elemento:",
|
||||
$(this).attr("id"),
|
||||
);
|
||||
if (!$("#backToPartsBtnAnnotations").length) {
|
||||
console.error(
|
||||
"Pulsante #backToPartsBtnAnnotations non trovato nel DOM.",
|
||||
);
|
||||
const errorMsg = $(
|
||||
'<div class="alert alert-danger temp-alert" role="alert">Errore: Pulsante #backToPartsBtnAnnotations non trovato nel DOM.</div>',
|
||||
);
|
||||
$("#annotationsModal .modal-body").prepend(errorMsg);
|
||||
setTimeout(function () {
|
||||
errorMsg.fadeOut(500, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
// Controlla modifiche non salvate
|
||||
if (
|
||||
unsavedChanges &&
|
||||
!confirm(
|
||||
"Hai modifiche non salvate. Vuoi davvero tornare al modale delle parti?",
|
||||
)
|
||||
) {
|
||||
console.log(
|
||||
"Tornare al modale delle parti annullato a causa di modifiche non salvate.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Chiudi annotationsModal
|
||||
const annotationsModalElement =
|
||||
document.getElementById("annotationsModal");
|
||||
const annotationsModal = bootstrap.Modal.getInstance(
|
||||
annotationsModalElement,
|
||||
);
|
||||
if (annotationsModal) {
|
||||
annotationsModal.hide();
|
||||
} else {
|
||||
console.error(
|
||||
"Impossibile trovare l'istanza del modale #annotationsModal.",
|
||||
);
|
||||
}
|
||||
|
||||
// Apri partsModal
|
||||
const iddatadb = $("#annotationsModal").data("iddatadb");
|
||||
const idquotations = $("#annotationsModal").data("idquotations");
|
||||
const trfHeader = $("#trfHeaderAnnotations").text();
|
||||
console.log("Apertura partsModal con:", {
|
||||
|
||||
// CHIUDI MODALE ANNOTAZIONI IN MODO SICURO
|
||||
const annotationsModalElement =
|
||||
document.getElementById("annotationsModal");
|
||||
if (annotationsModalElement) {
|
||||
const modalInstance = bootstrap.Modal.getInstance(
|
||||
annotationsModalElement,
|
||||
);
|
||||
if (modalInstance) {
|
||||
modalInstance.hide();
|
||||
} else {
|
||||
$(annotationsModalElement).modal("hide"); // fallback jQuery
|
||||
}
|
||||
}
|
||||
console.log("Torno a modal_partsTable.php con:", {
|
||||
iddatadb,
|
||||
idquotations,
|
||||
trfHeader,
|
||||
});
|
||||
// CARICA E APRI MODALE PARTI
|
||||
$.get(
|
||||
"modal_partsTable.php",
|
||||
{
|
||||
iddatadb: iddatadb || "",
|
||||
idquotations: idquotations || "",
|
||||
trfHeader: trfHeader,
|
||||
},
|
||||
function (data) {
|
||||
// Rimuovi vecchio modale (con ID corretto)
|
||||
$("#partsTableModal").remove();
|
||||
$(".modal-backdrop").remove();
|
||||
|
||||
const partsModalElement = document.getElementById("partsModal");
|
||||
if (!partsModalElement) {
|
||||
console.error("Elemento #partsModal non trovato nel DOM.");
|
||||
const errorMsg = $(
|
||||
'<div class="alert alert-danger temp-alert" role="alert">Errore: Il modale delle parti non è presente nel DOM.</div>',
|
||||
// Aggiungi nuovo modale
|
||||
$("body").append(data);
|
||||
|
||||
// Apri con Bootstrap 5
|
||||
const partsModalElement =
|
||||
document.getElementById("partsTableModal");
|
||||
if (partsModalElement) {
|
||||
const modal = new bootstrap.Modal(partsModalElement, {
|
||||
backdrop: true,
|
||||
keyboard: true,
|
||||
focus: true,
|
||||
});
|
||||
modal.show();
|
||||
}
|
||||
},
|
||||
).fail(function (xhr) {
|
||||
console.error("Errore caricamento modale parti:", xhr);
|
||||
alert(
|
||||
"Errore 404: modal_partsTable.php non trovato o errore server.",
|
||||
);
|
||||
$("#annotationsModal .modal-body").prepend(errorMsg);
|
||||
setTimeout(function () {
|
||||
errorMsg.fadeOut(500, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
let partsModal = bootstrap.Modal.getInstance(partsModalElement);
|
||||
if (!partsModal) {
|
||||
partsModal = new bootstrap.Modal(partsModalElement, {
|
||||
backdrop: true,
|
||||
keyboard: true,
|
||||
focus: true,
|
||||
});
|
||||
}
|
||||
|
||||
// Inizializza il modale delle parti
|
||||
if (typeof window.initPartsModal === "function") {
|
||||
window.initPartsModal(iddatadb, idquotations, trfHeader);
|
||||
partsModal.show();
|
||||
console.log("partsModal aperto con successo.");
|
||||
} else {
|
||||
console.error("Funzione initPartsModal non definita.");
|
||||
const errorMsg = $(
|
||||
'<div class="alert alert-danger temp-alert" role="alert">Errore: Funzione initPartsModal non trovata.</div>',
|
||||
);
|
||||
$("#annotationsModal .modal-body").prepend(errorMsg);
|
||||
setTimeout(function () {
|
||||
errorMsg.fadeOut(500, function () {
|
||||
$(this).remove();
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ===================
|
||||
// PARTS LIST
|
||||
// ===================
|
||||
@@ -892,8 +875,8 @@ $(document).ready(function () {
|
||||
return;
|
||||
}
|
||||
|
||||
const radius = 12;
|
||||
const fontSize = 16;
|
||||
const radius = globalMarkerSize / 2;
|
||||
const fontSize = Math.max(10, Math.round(globalMarkerSize * 0.65));
|
||||
const markerColor =
|
||||
marker.color || partColors[marker.partNumber] || "#ff0000";
|
||||
|
||||
@@ -1013,7 +996,7 @@ $(document).ready(function () {
|
||||
scaleY: 1,
|
||||
backgroundColor: "transparent",
|
||||
fontFamily: "Arial",
|
||||
fontSize: 24,
|
||||
fontSize: Math.max(16, Math.round(globalMarkerSize * 0.8)),
|
||||
fill: "#000000",
|
||||
padding: 10,
|
||||
editable: false,
|
||||
|
||||
Reference in New Issue
Block a user