DragGestureOptions
10/22/22Less than 1 minute
floating_window DragGestureOptions
Options passed to FloatingWindow.enableDrag: edge snapping, bounce animation length, and click / long-press callbacks on the drag handle.
Table of contents
Properties
Properties
bounceDuration
bounceDuration?:number
When keepToEdge is "bounce", duration of the elastic snap animation in milliseconds. Default 300.
keepToEdge
keepToEdge?:KeepToEdgeType
How the window sticks to screen edges: true, false, or "bounce". See KeepToEdgeType. Default false.
onClick
onClick?:() => void
Because dragging intercepts touches on the drag anchor view, normal setOnClickListener may not fire. Provide onClick here to receive taps on that handle.
Example
"nodejs";
const { createWindow } = require('floating_window');
async function main() {
const window = createWindow();
window.setViewFromXml(...);
const dragHandle = window.view.findView('dragHandle');
window.enableDrag(dragHandle, {
onClick: () => {
console.log('click');
}
});
window.show();
}
main().catch(console.error);Returns (callback)
void
onLongClick
onLongClick?:() => void
Same idea as onClick for long-press on the drag handle.
Example
"nodejs";
const { createWindow } = require('floating_window');
async function main() {
const window = createWindow();
window.setViewFromXml(...);
const dragHandle = window.view.findView('dragHandle');
window.enableDrag(dragHandle, {
onLongClick: () => {
console.log('long click');
}
});
}
main().catch(console.error);Returns (callback)
void
