Refine study controls and slice rail
This commit is contained in:
@@ -24,7 +24,7 @@ const app = {
|
||||
saving: false,
|
||||
pendingImage: null,
|
||||
drag: null,
|
||||
studySortField: "time",
|
||||
studySortField: "modified",
|
||||
studySortDir: "desc",
|
||||
studyFilter: "all",
|
||||
studyPartFilter: "all",
|
||||
@@ -117,6 +117,11 @@ function studyTimeKey(study) {
|
||||
return `${date}${time}`;
|
||||
}
|
||||
|
||||
function studyModifiedKey(study) {
|
||||
const raw = String(study.modified_at || study.annotation_updated_at || study.completion_updated_at || study.completed_at || "");
|
||||
return raw ? raw.replace(/\D/g, "").padEnd(14, "0") : studyTimeKey(study);
|
||||
}
|
||||
|
||||
function sortArrow(direction) {
|
||||
return direction === "asc" ? "↑" : "↓";
|
||||
}
|
||||
@@ -240,8 +245,8 @@ function sortStudies(list) {
|
||||
const timeResult =
|
||||
studyTimeKey(a).localeCompare(studyTimeKey(b)) ||
|
||||
String(a.ct_number || "").localeCompare(String(b.ct_number || ""), undefined, { numeric: true });
|
||||
const unannotatedResult = Number(a.unannotated_series || 0) - Number(b.unannotated_series || 0) || timeResult;
|
||||
const result = app.studySortField === "unannotated" ? unannotatedResult : timeResult;
|
||||
const modifiedResult = studyModifiedKey(a).localeCompare(studyModifiedKey(b)) || timeResult;
|
||||
const result = app.studySortField === "study_time" ? timeResult : modifiedResult;
|
||||
return app.studySortDir === "desc" ? -result : result;
|
||||
});
|
||||
}
|
||||
@@ -509,16 +514,21 @@ function renderStudies() {
|
||||
|
||||
function applyStudyCompletion(data) {
|
||||
const completed = Boolean(data.completed);
|
||||
const modifiedAt = data.completion_updated_at || data.modified_at || data.completed_at || "";
|
||||
const study = app.studies.find((item) => item.ct_number === data.ct_number);
|
||||
if (study) {
|
||||
study.completed = completed;
|
||||
study.completed_by = data.completed_by || "";
|
||||
study.completed_at = data.completed_at || "";
|
||||
study.completion_updated_at = data.completion_updated_at || study.completion_updated_at || "";
|
||||
if (modifiedAt) study.modified_at = modifiedAt;
|
||||
}
|
||||
if (app.study?.ct_number === data.ct_number) {
|
||||
app.study.completed = completed;
|
||||
app.study.completed_by = data.completed_by || "";
|
||||
app.study.completed_at = data.completed_at || "";
|
||||
app.study.completion_updated_at = data.completion_updated_at || app.study.completion_updated_at || "";
|
||||
if (modifiedAt) app.study.modified_at = modifiedAt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -993,6 +1003,16 @@ function updateLocalAnnotation(annotation, targetSeriesUid = app.activeSeries?.s
|
||||
if (options.updateNotes !== false) $("annotationNotes").value = normalized.notes || "";
|
||||
}
|
||||
refreshStudyAnnotationSummary();
|
||||
const modifiedAt = normalized.updated_at || new Date().toISOString();
|
||||
if (app.study && modifiedAt) {
|
||||
app.study.modified_at = modifiedAt;
|
||||
app.study.annotation_updated_at = modifiedAt;
|
||||
const study = app.studies.find((item) => item.ct_number === app.study.ct_number);
|
||||
if (study) {
|
||||
study.modified_at = modifiedAt;
|
||||
study.annotation_updated_at = modifiedAt;
|
||||
}
|
||||
}
|
||||
renderSeries();
|
||||
renderStudies();
|
||||
if (isActive && applyToActive) applyAnnotationControls();
|
||||
@@ -1353,7 +1373,11 @@ function changeZoom(multiplier) {
|
||||
|
||||
function wireImageGestures() {
|
||||
const wrap = document.querySelector(".image-wrap");
|
||||
document.querySelector(".slice-rail").addEventListener("pointerdown", (event) => event.stopPropagation());
|
||||
const sliceRail = document.querySelector(".slice-rail");
|
||||
["pointerdown", "pointermove", "pointerup", "pointercancel", "click"].forEach((name) => {
|
||||
sliceRail.addEventListener(name, (event) => event.stopPropagation());
|
||||
});
|
||||
sliceRail.addEventListener("wheel", (event) => event.stopPropagation(), { passive: true });
|
||||
wrap.addEventListener(
|
||||
"wheel",
|
||||
(event) => {
|
||||
|
||||
Reference in New Issue
Block a user