better queue render

This commit is contained in:
sorlinv
2026-02-26 17:32:00 +01:00
parent a65700175b
commit 20a016bd3a
12 changed files with 541 additions and 12 deletions

View File

@@ -115,7 +115,7 @@ const RenderQueue = {
obj_container.appendChild(obj_fragment);
},
update_progress: (nb_current, nb_last_render_ms, str_last_image_path, list_skipped) => {
update_progress: (nb_current, nb_last_render_ms, str_last_image_path, list_skipped, list_stopped, list_skipped_paths) => {
if (nb_current > RenderQueue.nb_last_current && nb_last_render_ms > 0) {
RenderQueue.nb_total_render_ms += nb_last_render_ms;
RenderQueue.nb_completed_renders++;
@@ -126,8 +126,18 @@ const RenderQueue = {
RenderQueue.list_items[nb_current - 1].str_image_path = str_last_image_path;
}
if (list_skipped_paths) {
for (let obj_sp of list_skipped_paths) {
if (obj_sp.nb_index < RenderQueue.list_items.length) {
RenderQueue.list_items[obj_sp.nb_index].str_image_path = obj_sp.str_path;
}
}
}
for (let nb_i = 0; nb_i < RenderQueue.list_items.length; nb_i++) {
if (list_skipped && list_skipped.indexOf(nb_i) !== -1) {
if (list_stopped && list_stopped.indexOf(nb_i) !== -1) {
RenderQueue.list_items[nb_i].str_status = "stopped";
} else if (list_skipped && list_skipped.indexOf(nb_i) !== -1) {
RenderQueue.list_items[nb_i].str_status = "skipped";
} else if (nb_i < nb_current) {
RenderQueue.list_items[nb_i].str_status = "done";
@@ -143,14 +153,20 @@ const RenderQueue = {
},
_update_statuses: () => {
let obj_rendering_el = null;
for (let obj_item of RenderQueue.list_items) {
if (!obj_item.obj_dom_el) {
continue;
}
let is_needs_click = obj_item.str_status === "done" && obj_item.str_image_path && !obj_item.is_click_bound;
let is_needs_click = (obj_item.str_status === "done" || obj_item.str_status === "skipped")
&& obj_item.str_image_path && !obj_item.is_click_bound;
if (obj_item.str_status === obj_item.str_dom_status && !is_needs_click) {
if (obj_item.str_status === "rendering") {
obj_rendering_el = obj_item.obj_dom_el;
}
continue;
}
@@ -160,6 +176,7 @@ const RenderQueue = {
if (obj_item.str_status === "rendering") {
str_icon = "mdi-loading mdi-spin";
str_color = "text-primary";
obj_rendering_el = obj_item.obj_dom_el;
} else if (obj_item.str_status === "done") {
str_icon = "mdi-check-circle";
str_color = "text-success";
@@ -169,6 +186,9 @@ const RenderQueue = {
} else if (obj_item.str_status === "skipped") {
str_icon = "mdi-skip-next-circle";
str_color = "text-info";
} else if (obj_item.str_status === "stopped") {
str_icon = "mdi-stop-circle";
str_color = "text-warning";
}
obj_item.obj_dom_icon.className = "mdi " + str_icon + " " + str_color;
@@ -184,6 +204,20 @@ const RenderQueue = {
obj_item.str_dom_status = obj_item.str_status;
}
if (obj_rendering_el) {
obj_rendering_el.scrollIntoView({ behavior: "smooth", block: "center" });
}
},
mark_existing: (list_existing) => {
for (let obj_existing of list_existing) {
if (obj_existing.nb_index < RenderQueue.list_items.length) {
RenderQueue.list_items[obj_existing.nb_index].str_status = "skipped";
RenderQueue.list_items[obj_existing.nb_index].str_image_path = obj_existing.str_path;
}
}
RenderQueue._update_statuses();
},
_update_time_display: () => {