This commit is contained in:
2026-07-09 13:23:24 +02:00
parent 589c97b56b
commit bc3a4b31e7

View File

@@ -319,13 +319,14 @@ function calc_rows_columns(src) {
slots[cur].set_geom(left, top, right, bottom); slots[cur].set_geom(left, top, right, bottom);
} else { } else {
// Empty slot, possibly not initialized (if above slots_highest) // Empty slot, possibly not initialized (if above slots_highest)
slots[cur] = new slot(left, top, right, bottom); slots[cur] = new slot();
slots[cur].set_geom(left, top, right, bottom);
} }
} }
} }
if (slots_count_display < slots_highest) { if (slots.length < slots_highest ) {
for (var i = slots_count_display + 1; i <= slots_highest; i++) { for (var i = slots_count_display + 1; i <= slots_highest; i++) {
slots[i] = new slot(); slots[i] = new slot();
} }
@@ -1497,7 +1498,6 @@ find_pattrstorage.local = 1;
function to_pattrstorage() { function to_pattrstorage() {
if (pattrstorage_obj != null) { if (pattrstorage_obj != null) {
// post('sending to pattrstorage: ', arrayfromargs(arguments), '\n');
pattrstorage_obj.message(arrayfromargs(arguments)); pattrstorage_obj.message(arrayfromargs(arguments));
} }
} }
@@ -1600,7 +1600,6 @@ function update_filled_slots_dict() {
tmp_dict['color_custom'] = slot.color_custom; // Preset color (when color_mode = 3) tmp_dict['color_custom'] = slot.color_custom; // Preset color (when color_mode = 3)
} }
if (use_uid) tmp_dict['uid'] = slot.uid; // Preset uid (unique and persistent across preset renaming, overwriting and moving) Useful for keeping track of preset across changes if (use_uid) tmp_dict['uid'] = slot.uid; // Preset uid (unique and persistent across preset renaming, overwriting and moving) Useful for keeping track of preset across changes
// post('updating by_uid', slot.uid, '\n');
if (timestamp) { if (timestamp) {
tmp_dict['created'] = slot.created; tmp_dict['created'] = slot.created;
tmp_dict['modified'] = slot.modified; tmp_dict['modified'] = slot.modified;
@@ -1971,12 +1970,15 @@ function ondrag(x,y,but,cmd,shift,capslock,option,ctrl)
var nearby_slots = []; var nearby_slots = [];
var max_dist = 0; var max_dist = 0;
for (var i = 0; i < filled_slots.length; i++) { for (var i = 0; i < filled_slots.length; i++) {
var s_pos = slots[filled_slots[i]].center; // Interpolating only through displayed slots;
var dist_from_mouse = Math.sqrt((x - s_pos.x) * (x - s_pos.x) + (y - s_pos.y) * (y - s_pos.y)) / (slot_size + spacing); if (filled_slots[i] <= slots_count_display) {
if (dist_from_mouse < drag_interp_radius) { var s_pos = slots[filled_slots[i]].center;
var interp_factor = 1 - (dist_from_mouse / drag_interp_radius); var dist_from_mouse = Math.sqrt((x - s_pos.x) * (x - s_pos.x) + (y - s_pos.y) * (y - s_pos.y)) / (slot_size + spacing);
nearby_slots.push(filled_slots[i] + interp_factor); if (dist_from_mouse < drag_interp_radius) {
if (max_dist < dist_from_mouse) max_dist = dist_from_mouse; var interp_factor = 1 - (dist_from_mouse / drag_interp_radius);
nearby_slots.push(filled_slots[i] + interp_factor);
if (max_dist < dist_from_mouse) max_dist = dist_from_mouse;
}
} }
} }
if (nearby_slots.length) { if (nearby_slots.length) {