prevents some uneeded redraws in v8ui

This commit is contained in:
2026-07-16 16:56:34 +02:00
parent ac39f1ac4d
commit eb89d37a7c

View File

@@ -95,6 +95,7 @@ var poll_edited = 0; // If >0, check if current preset is edited every X
var nbslot_edit = true; // If nbslot_edit and scrollable are enabled, the last two visible slots are replaced by buttons to add or remove lines of slot. var nbslot_edit = true; // If nbslot_edit and scrollable are enabled, the last two visible slots are replaced by buttons to add or remove lines of slot.
// (WORK) // (WORK)
var is_jsui = this.box.maxclass === "jsui";
var pattrstorage_name = null; var pattrstorage_name = null;
var pattrstorage_obj = null; var pattrstorage_obj = null;
@@ -496,11 +497,15 @@ paint_base.local = 1;
function paint() function paint()
{ {
// post("redraw\n"); // post("redraw\n");
if (is_jsui) {
// Handling Presentation mode enable/disable // Handling Presentation mode enable/disable
var cur_size = mgraphics.size; var cur_size = mgraphics.size;
if (cur_size[0] != ui_width || cur_size[1] != ui_height) { if (cur_size[0] != ui_width || cur_size[1] != ui_height) {
onresize(cur_size[0], cur_size[1]); onresize(cur_size[0], cur_size[1]);
} else { return
}
}
mgraphics.select_font_face(font_name); mgraphics.select_font_face(font_name);
mgraphics.set_font_size(font_size); mgraphics.set_font_size(font_size);
mgraphics.translate(0, y_offset); mgraphics.translate(0, y_offset);
@@ -557,7 +562,6 @@ function paint()
// Interpolated slots // Interpolated slots
if (is_dragging !== 1 && display_interp && is_interpolating) { if (is_dragging !== 1 && display_interp && is_interpolating) {
for (var i = 1; i <= slots_count_display; i++) { for (var i = 1; i <= slots_count_display; i++) {
var slot = slots[i]; var slot = slots[i];
var interp = slot.interp; var interp = slot.interp;
@@ -740,7 +744,7 @@ function paint()
} }
} }
}
} }
paint.local = 0; paint.local = 0;
@@ -2110,11 +2114,13 @@ onresize.local = 1;
if (ui_width == 64 && ui_height == 64) { if (ui_width == 64 && ui_height == 64) {
box.setboxattr("patching_rect", box.rect[0], box.rect[1], 130, 58); box.setboxattr("patching_rect", box.rect[0], box.rect[1], 130, 58);
} }
// Allows for dynamic resizing even in presentation mode (addressing the limitation of onresize()) // Allows for dynamic resizing even in presentation mode (addressing the limitation of onresize() in jsui)
var pres_rect = new MaxobjListener(this.box,"presentation_rect",get_prect); if (is_jsui) {
var pres_rect = new MaxobjListener(this.box,"presentation_rect",get_prect);
}
function get_prect(prect) { function get_prect(prect) {
// post(this.patcher.wind.assoc.getattr("globalpatchername") == max.frontpatcher.wind.assoc.getattr("globalpatchername") ? 1 : 0, "\n") // post(this.patcher.wind.assoc.getattr("globalpatchername") == max.frontpatcher.wind.assoc.getattr("globalpatchername") ? 1 : 0, "\n")
onresize(prect.value[2], prect.value[3]) onresize(prect.value[2], prect.value[3], "from_maxobjlistener");
} }
get_prect.local = 1; get_prect.local = 1;