如何检测 Pixelbook Pen 按钮?
How to detect Pixelbook Pen button?
我按照 the doc here 捕捉 Pixelbook 笔在绘图时按下的按钮,但从未引发 TOOL_TYPE_ERASER 事件。当我尝试打印日志时,我没有看到按住和释放按钮之间的任何区别:
onTouchEvent:MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=2010.4766, y[0]=778.10156, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1395185, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.527 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2009.2734, y[0]=777.6406, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=4, eventTime=1395195, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.552 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.0703, y[0]=776.71484, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=9, eventTime=1395221, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.569 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2007.8867, y[0]=776.25, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=3, eventTime=1395238, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.594 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.0703, y[0]=775.6953, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=7, eventTime=1395263, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.611 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.2578, y[0]=774.58594, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=6, eventTime=1395280, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.624 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.3477, y[0]=773.28906, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=5, eventTime=1395295, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.624 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=2008.3477, y[0]=773.28906, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1395297, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.632 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=2018.3477, y[0]=1013.64453, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402304, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.643 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.5312, y[0]=1013.64453, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=1402312, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.660 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.5508, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=6, eventTime=1402329, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.668 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.46094, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402337, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.669 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.46094, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402342, downTime=1402304, deviceId=1, source=0x1002 }
我的ChromeOS版本:69.0.3497.95(正式版)(64位)
Google 团队确认事件已被系统占用,应用程序无法使用当前 API 捕获该事件。
我按照 the doc here 捕捉 Pixelbook 笔在绘图时按下的按钮,但从未引发 TOOL_TYPE_ERASER 事件。当我尝试打印日志时,我没有看到按住和释放按钮之间的任何区别:
onTouchEvent:MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=2010.4766, y[0]=778.10156, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1395185, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.527 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2009.2734, y[0]=777.6406, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=4, eventTime=1395195, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.552 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.0703, y[0]=776.71484, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=9, eventTime=1395221, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.569 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2007.8867, y[0]=776.25, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=3, eventTime=1395238, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.594 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.0703, y[0]=775.6953, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=7, eventTime=1395263, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.611 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.2578, y[0]=774.58594, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=6, eventTime=1395280, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.624 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2008.3477, y[0]=773.28906, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=5, eventTime=1395295, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:35.624 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=2008.3477, y[0]=773.28906, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1395297, downTime=1395185, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.632 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=2018.3477, y[0]=1013.64453, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402304, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.643 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.5312, y[0]=1013.64453, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=2, eventTime=1402312, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.660 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.5508, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=6, eventTime=1402329, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.668 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_MOVE, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.46094, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402337, downTime=1402304, deviceId=1, source=0x1002 }
2018-09-29 16:15:42.669 2926-2926/com. onTouchEvent:MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=2018.1641, y[0]=1013.46094, toolType[0]=TOOL_TYPE_STYLUS, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=1402342, downTime=1402304, deviceId=1, source=0x1002 }
我的ChromeOS版本:69.0.3497.95(正式版)(64位)
Google 团队确认事件已被系统占用,应用程序无法使用当前 API 捕获该事件。