Added mouse selection
This commit is contained in:
@@ -159,6 +159,14 @@
|
||||
<li><code>rclick</code> - Right click (using rclick alias)</li>
|
||||
<li><code>click rclick</code> - Click then right-click sequence (using alias)</li>
|
||||
</ul>
|
||||
<p><strong>Element 3 - Mousedown>mouseup actions:</strong></p>
|
||||
<ul>
|
||||
<li><code>click</code> - Simple click (coexists with mousedown>mouseup)</li>
|
||||
<li><code>mousedown>mouseup</code> - Left press and release (with JS values)</li>
|
||||
<li><code>ctrl+mousedown>mouseup</code> - Ctrl + press and release</li>
|
||||
<li><code>rmousedown>mouseup</code> - Right press and release</li>
|
||||
<li><code>click mousedown>mouseup</code> - Click then press-and-release sequence</li>
|
||||
</ul>
|
||||
<p><strong>Note:</strong> <code>rclick</code> is an alias for <code>right_click</code> and works identically.</p>
|
||||
<p><strong>Tip:</strong> Try different click combinations! Right-click menu will be blocked on test elements.</p>
|
||||
</div>
|
||||
@@ -197,6 +205,14 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="test-container">
|
||||
<h2>Test Element 3 (Mousedown>mouseup actions)</h2>
|
||||
<div id="test-element-3" class="test-element" tabindex="0">
|
||||
Try mousedown>mouseup actions here!<br>
|
||||
Press and hold, then release. Also try Ctrl+drag, right-drag, and click then drag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="test-container">
|
||||
<h2>Test Input (normal clicking should work here)</h2>
|
||||
<input type="text" placeholder="Try clicking, right-clicking here - should work normally"
|
||||
@@ -346,10 +362,48 @@
|
||||
|
||||
add_mouse_support('test-element-2', JSON.stringify(combinations2));
|
||||
|
||||
// JS function for dynamic mousedown>mouseup values
|
||||
// Returns cell-like data for testing
|
||||
window.getCellId = function(event, element, combination) {
|
||||
const x = event.clientX;
|
||||
const y = event.clientY;
|
||||
return {
|
||||
cell_id: `cell-${Math.floor(x / 50)}-${Math.floor(y / 50)}`,
|
||||
x: x,
|
||||
y: y
|
||||
};
|
||||
};
|
||||
|
||||
// Element 3 - Mousedown>mouseup actions
|
||||
const combinations3 = {
|
||||
"click": {
|
||||
"hx-post": "/test/element3-click"
|
||||
},
|
||||
"mousedown>mouseup": {
|
||||
"hx-post": "/test/element3-mousedown-mouseup",
|
||||
"hx-vals-extra": {"js": "getCellId"}
|
||||
},
|
||||
"ctrl+mousedown>mouseup": {
|
||||
"hx-post": "/test/element3-ctrl-mousedown-mouseup",
|
||||
"hx-vals-extra": {"js": "getCellId"}
|
||||
},
|
||||
"rmousedown>mouseup": {
|
||||
"hx-post": "/test/element3-rmousedown-mouseup",
|
||||
"hx-vals-extra": {"js": "getCellId"}
|
||||
},
|
||||
"click mousedown>mouseup": {
|
||||
"hx-post": "/test/element3-click-then-mousedown-mouseup",
|
||||
"hx-vals-extra": {"js": "getCellId"}
|
||||
}
|
||||
};
|
||||
|
||||
add_mouse_support('test-element-3', JSON.stringify(combinations3));
|
||||
|
||||
// Log initial state
|
||||
logEvent('Mouse support initialized',
|
||||
'Element 1: All mouse actions configured',
|
||||
'Element 2: Using "rclick" alias (click, rclick, and click rclick sequence)',
|
||||
'Element 3: Mousedown>mouseup actions (with JS getCellId function)',
|
||||
'Smart timeout: 500ms for sequences', false);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user