The life cycle methods of the onPointerDown , onPointerMove and onPointerUp (more details in bobril / index.ts IBobrilComponent ) are exactly what you need but with less code.
Use bobril b.registerMouseOwner with your context in the onPointerDown method.
onPointerDown(ctx: ICtx, event: b.IBobrilPointerEvent) { b.registerMouseOwner(ctx);
Then your component can handle the mouse movement in the onPointerMove method, even moving beyond the element. You only need to be sure that you are still the current owner. So your method might look like this. eg:
onPointerMove(ctx: ICtx, event: b.IBobrilPointerEvent) { if (!b.isMouseOwner(ctx)) return false; if (ctx.lastX === event.x && ctx.lastY === event.y) return false;
Do not forget to free your registration.
onPointerUp(ctx: ICtx, event: b.IBobrilPointerEvent) { b.releaseMouseOwner(); return true; }
The above example stores the last coordinates of the pointer in the context of the ICtx component. It can then be used to provide deltaY and deltaY in the onMove handler. This handler can be registered with the input when creating the node component.
source share