feat(ui): restrict drag events to left mouse button only, fixes #777

Add button condition checks in initDrag and initHeaderDrag functions to ensure only left mouse button (button 0) triggers drag interactions. This prevents conflicts with middle button canvas dragging and right button context menu actions, improving user experience and interaction clarity.
This commit is contained in:
Will Miao
2026-01-24 22:26:17 +08:00
parent b05762b066
commit fad43ad003

View File

@@ -130,7 +130,12 @@ export function initDrag(
e.target.closest('.lm-lora-expand-button')) {
return;
}
// Only handle left mouse button (allow middle button for canvas drag, right button for context menu)
if (e.button !== 0) {
return;
}
// Store initial values
const lorasData = parseLoraValue(widget.value);
const loraData = lorasData.find(l => l.name === name);
@@ -255,7 +260,12 @@ export function initHeaderDrag(headerEl, widget, renderFunction) {
e.target.closest('input')) {
return;
}
// Only handle left mouse button (allow middle button for canvas drag, right button for context menu)
if (e.button !== 0) {
return;
}
// Store initial X position
initialX = e.clientX;