void OnIsTouchingChangedInternal() { if (IsTouching) { ElapsedFromLastTouched.Reset(); ElapsedFromLastTouched.Start(); LastTapKind = CursorTapKind.Touching; } else { ElapsedFromLastTouched.Stop(); // NOTE: LastTapKind is "Last" TapKind, so it keeps the state, till IsTouching becomes true or tracking ends. if (IsToDetectLongTouch && IsLongTouching) { LastTapKind = CursorTapKind.LongTap; } else { LastTapKind = CursorTapKind.Tap; } IsLongTouching = false; } // NOTE: Left CursorView and right CursorView has each Bitmap, so ViewModels need not to have information whether it is left or right. CurrentImageIndex = (int)(IsTouching ? CursorImageIndexLabels.CloseHand : CursorImageIndexLabels.OpenHand); }
void InitializePropertiesDependsOnHidReport() { IsTracking = false; IsVisible = false; PositionX = short.MinValue; PositionY = short.MinValue; Rotation = 0.0; RelativeZ = 1.0; FingerPitch = 0.0; IsTouching = false; IsLongTouching = false; LastTapKind = CursorTapKind.Unknown; // NOTE(en): Check. If the next line is "CurrentImageIndex = (int)CursorImageKind.None;", the state is "None" until the first touch happens, even if it is hovering. // NOTE(ja): 要確認。次の行が"CurrentImageIndex = (int)CursorImageKind.None;"という記述だと、最初のTouchが行われるまで、HoverしていてもNoneのままになってしまう。 CurrentImageIndex = (int)CursorImageIndexLabels.OpenHand; ElapsedFromLastTouched.Reset(); CallPropertyChangedOfAllPropertiesAtOnce(); OnStateUpdated(EventArgs.Empty); }