refactor: any UI child node
This commit is contained in:
parent
fdd176644a
commit
ccddb4e465
|
@ -128,14 +128,24 @@ let pointingAt = [-1, -1];
|
|||
function isPointingAtAnything() {
|
||||
return -1 !== pointingAt[0] && -1 !== pointingAt[1];
|
||||
}
|
||||
function isInUi(node) {
|
||||
let walk = node;
|
||||
while (walk) {
|
||||
if (walk === stage.ui) {
|
||||
return true;
|
||||
}
|
||||
walk = walk.parentNode;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
stage.on('pointerDown', (event) => {
|
||||
if (event.target !== stage.ui) {
|
||||
if (!isInUi(event.target)) {
|
||||
return;
|
||||
}
|
||||
pointingAt = event.position;
|
||||
});
|
||||
stage.on('pointerMove', (event) => {
|
||||
if (event.target !== stage.ui) {
|
||||
if (!isInUi(event.target)) {
|
||||
return;
|
||||
}
|
||||
if (!isPointingAtAnything()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user