Javascript MouseLeave激发电子中的子元素

Javascript MouseLeave激发电子中的子元素,javascript,html,angularjs,typescript,electron,Javascript,Html,Angularjs,Typescript,Electron,我使用以下HTML模板和脚本处理鼠标悬停事件。我的应用程序是用AngularJS编写的,托管在Electron中 onControlAreaLeave(event){ // Check to see if we went to a child element // Only need this because of Electron otherwise it works fine in browsers if (event.clientX > 4 &&a

我使用以下HTML模板和脚本处理鼠标悬停事件。我的应用程序是用AngularJS编写的,托管在Electron中

 onControlAreaLeave(event){
    // Check to see if we went to a child element 
    // Only need this because of Electron otherwise it works fine in browsers
    if (event.clientX > 4 && 
        event.clientX < window.innerWidth && 
        event.clientY > 4 && 
        event.clientY < this.controlArea.nativeElement.offsetHeight) {
       return;
    }

    this.controlsVisible = false;
  }
HTML:


当我通过chrome mouseleave查看我的应用程序时,只有当我离开controlArea div时,mouseleave才会启动。然而,当我将我的应用程序放入electron时,mouseleave会在我悬停在子div元素上时启动。有什么方法可以防止这种情况在Electron中发生吗?

使用当前的解决方法来过滤掉发生在控制区域内的休假事件。然而,这并不能解释为什么离开事件发生在电子的子元素上

 onControlAreaLeave(event){
    // Check to see if we went to a child element 
    // Only need this because of Electron otherwise it works fine in browsers
    if (event.clientX > 4 && 
        event.clientX < window.innerWidth && 
        event.clientY > 4 && 
        event.clientY < this.controlArea.nativeElement.offsetHeight) {
       return;
    }

    this.controlsVisible = false;
  }

角度的版本?你第一次在上空盘旋时它能正常工作吗。当进入和离开控制区域时,事件会正确触发,但当您将鼠标悬停在控制区域的任何子元素上时,鼠标移动事件会在不应该的时候再次触发;不幸的是,我无法找到一种方法,仅在移动到子元素上时停止controlArea的mouseleave传播,而在实际离开controlArea时允许传播。为什么不在moveArea id或自定义指令的时间上这样做呢。
 onControlAreaLeave(event){
    // Check to see if we went to a child element 
    // Only need this because of Electron otherwise it works fine in browsers
    if (event.clientX > 4 && 
        event.clientX < window.innerWidth && 
        event.clientY > 4 && 
        event.clientY < this.controlArea.nativeElement.offsetHeight) {
       return;
    }

    this.controlsVisible = false;
  }