Implementing a MouseLeaveHandler.
This commit is contained in:
parent
0fb7f47207
commit
c409633017
|
@ -25,7 +25,7 @@ const Viewport: react.FC<{}> = (props: {}) => {
|
||||||
console.log('mouseState: ' + JSON.stringify(mouseState));
|
console.log('mouseState: ' + JSON.stringify(mouseState));
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: implement resize and focusout or blur events
|
// TODO: implement resize event
|
||||||
// TODO: check boundaries
|
// TODO: check boundaries
|
||||||
|
|
||||||
const mouseDownHandler = (event: any) => {
|
const mouseDownHandler = (event: any) => {
|
||||||
|
@ -37,6 +37,15 @@ const Viewport: react.FC<{}> = (props: {}) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const mouseLeaveHandler = (event: any) => {
|
||||||
|
genericHandler(event);
|
||||||
|
event.preventDefault();
|
||||||
|
throtteledMouseMoveHandler.cancel();
|
||||||
|
setMouseState(initialMouseState);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const mouseUpHandler = (event: any) => {
|
const mouseUpHandler = (event: any) => {
|
||||||
genericHandler(event);
|
genericHandler(event);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
@ -83,6 +92,7 @@ const Viewport: react.FC<{}> = (props: {}) => {
|
||||||
onMouseDown={mouseDownHandler}
|
onMouseDown={mouseDownHandler}
|
||||||
onMouseMove={throtteledMouseMoveHandler}
|
onMouseMove={throtteledMouseMoveHandler}
|
||||||
onMouseUp={mouseUpHandler}
|
onMouseUp={mouseUpHandler}
|
||||||
|
onMouseLeave={mouseLeaveHandler}
|
||||||
>
|
>
|
||||||
<Background shift={shift} />
|
<Background shift={shift} />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue