add drag_interp_radius attribute, defaults to 1.
This commit is contained in:
@@ -80,7 +80,8 @@ var min_rows = 10; // Minimum number of rows to display if scrollable i
|
||||
var color_mode = 0; // Change the way the filled slots (stored presets) color is handeld. 0: stored_slot_color. 1: looping through color_1 to color_6. 2: Freely assign colors 1 to 6. 3: Set any color to any preset
|
||||
var select_mode = 0; // 0: single click to select and recall the slot. 1: single click to select the slot, double click to recall it.
|
||||
var click_mode = 0; // Sets the behavior of single clicks. 0: normal (recall), 1: select, 2: store, 3: delete
|
||||
var drag_mode = 1; // Sets the behavior of drag operations. 0: disabled, 1: move preset (default), 2: in-line interpolation
|
||||
var drag_mode = 1; // Sets the behavior of drag operations. 0: disabled, 1: move preset (default), 2: in-line interpolation, 3: zone interpolation
|
||||
var drag_interp_radius = 1; // In use with drag_mode 3
|
||||
var send_name = "none"; // The global name to send presets dict name to (received by the [receive] object)
|
||||
var unique_names = false; // When enabled, force names to be unique when renaming slots by appending "bis" to them. Gets applied only to subsequently renamed presets.
|
||||
var autoname = false; // Automatically name new presets when created as "Preset" followed by the slot id
|
||||
@@ -1967,14 +1968,13 @@ function ondrag(x,y,but,cmd,shift,capslock,option,ctrl)
|
||||
}
|
||||
// last_hovered retains the slot where the drag began
|
||||
if (is_dragging === 3 && last_hovered > -1) {
|
||||
var radius = 2;
|
||||
var nearby_slots = [];
|
||||
var max_dist = 0;
|
||||
for (var i = 0; i < filled_slots.length; i++) {
|
||||
var s_pos = slots[filled_slots[i]].center;
|
||||
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 (dist_from_mouse < radius) {
|
||||
var interp_factor = 1 - (dist_from_mouse / radius);
|
||||
if (dist_from_mouse < drag_interp_radius) {
|
||||
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;
|
||||
}
|
||||
@@ -2415,7 +2415,9 @@ function setselect_mode(v) {
|
||||
}
|
||||
setselect_mode.local = 1;
|
||||
|
||||
declareattribute("drag_mode", null, null, 1, { style: "enumindex", enumvals: ["Disabled", "Move", "In-Line Interp", "Interp"], default: 1, label: "Drag Mode", paint: 1});
|
||||
declareattribute("drag_mode", null, null, 1, { style: "enumindex", enumvals: ["Disabled", "Move", "In-Line Interp", "Interp"], default: 1, label: "Drag Mode", paint: 1 });
|
||||
|
||||
declareattribute("drag_interp_radius", null, null, 1, { type: "float", min: 1, default: 1, label: "Drag Interpolation Radius" });
|
||||
|
||||
declareattribute("color_mode", "getcolor_mode", "setcolor_mode", 1, {type: "long", min: 0, max: 3, style: "enumindex", enumvals: ["Classic", "Cycle", "Select", "Custom"], label: "Color Mode", category: "Appearance"});
|
||||
function getcolor_mode() {
|
||||
|
||||
Reference in New Issue
Block a user