为什么 GID_ZOOM 的中心点会改变?
why does the center point of GID_ZOOM changes?
一旦 Windows 缩放手势开始,为什么后续 GID_ZOOM 消息的中心点位置会在同一手势中发生变化?
我没有触摸屏,所以我尝试模拟缩放手势。无论我在 GF_BEGIN
或 GF_END
.
中获得中心点,它都会给我相同的中心点
然而,当我查看 windows 样本时 Microsoft-classic-samples repository, GestureEngine.cpp。他们正在通过取 2 ptsLocation(s) 的平均值重新计算中心,
// We read here the second point of the gesture. This is middle point between
// fingers in this new position.
_ptSecond.x = gi.ptsLocation.x;
_ptSecond.y = gi.ptsLocation.y;
ScreenToClient(hWnd,&_ptSecond);
// We have to calculate zoom center point
ptZoomCenter.x = (_ptFirst.x + _ptSecond.x)/2;
ptZoomCenter.y = (_ptFirst.y + _ptSecond.y)/2;
我很困惑为什么 plsLocation 会因相同的手势而改变,即在我们收到 GF_END
消息之前?
Microsoft-classic-samples forum "Location of the center of the zoom in GID_ZOOM Gesture" 正是我要找的。如果有人不想通过 link.
,我会发布答案
Human beings are not very good at moving two fingers at exactly the
same rate outwards. There is usually some error, which can cause the
center to shift slightly. (For example, when I do a pinch gesture, my
index finger moves faster than my thumb.)
一旦 Windows 缩放手势开始,为什么后续 GID_ZOOM 消息的中心点位置会在同一手势中发生变化?
我没有触摸屏,所以我尝试模拟缩放手势。无论我在 GF_BEGIN
或 GF_END
.
然而,当我查看 windows 样本时 Microsoft-classic-samples repository, GestureEngine.cpp。他们正在通过取 2 ptsLocation(s) 的平均值重新计算中心,
// We read here the second point of the gesture. This is middle point between
// fingers in this new position.
_ptSecond.x = gi.ptsLocation.x;
_ptSecond.y = gi.ptsLocation.y;
ScreenToClient(hWnd,&_ptSecond);
// We have to calculate zoom center point
ptZoomCenter.x = (_ptFirst.x + _ptSecond.x)/2;
ptZoomCenter.y = (_ptFirst.y + _ptSecond.y)/2;
我很困惑为什么 plsLocation 会因相同的手势而改变,即在我们收到 GF_END
消息之前?
Microsoft-classic-samples forum "Location of the center of the zoom in GID_ZOOM Gesture" 正是我要找的。如果有人不想通过 link.
,我会发布答案Human beings are not very good at moving two fingers at exactly the same rate outwards. There is usually some error, which can cause the center to shift slightly. (For example, when I do a pinch gesture, my index finger moves faster than my thumb.)