zoukankan      html  css  js  c++  java
  • UI事件定位--HitTest

    In computer graphics programming, hit-testing (hit detection, picking, or pick correlation) is the process of determining whether a user-controlled cursor (such as a mouse cursor or touch-point on a touch-screen interface) intersects a given graphical object (such as a shape, line, or curve) drawn on the screen.Hit-testing may be performed on the movement or activation

    举个例子,在大家看来,点击一个HTML的<a>标签链接打开一个新页面,看起来非常理所当然的一件事情,在WebKit内核里面,却做了非常多的事情,首先,要获取当前点击的位置,带着这个位置坐标信息,去做一个HitTest。所谓的HitTest就是探测下当前的点击的内容是什么,怎么才能知道当前点击的是什么呢?HitTest会遍历整个DomTree, LayerTree,看看当前的坐标位置是什么内容,是空白?还是文字?还是图片,还是链接?这些信息都可以通过遍历DomTree, LayerTree来实现,最终将遍历的探测结果以HitTestResult的形式返回,最终通过返回的类型来判断,如果是一个链接,则回调对应的回调函数,最终实现通过点击打开一个新的页面。

    作者:三旬叔

    链接:https://www.zhihu.com/question/22799206/answer/148330651

    来源:知乎

    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

  • 相关阅读:
    uninstall_edge:win10带浏览器edge卸载工具
    安装spacedesk后,Win10状态栏图标间距变宽
    jacob实现语音朗读一段文本
    汇编语言-12内中断
    告警只提示一次,未解决也不再次提示
    汇编语言-11标志寄存器
    第2章 顺序表及其顺序存储
    第1章 概论
    再见:计算机行业
    QPainter
  • 原文地址:https://www.cnblogs.com/feng9exe/p/11712441.html
Copyright © 2011-2022 走看看