private void UpdateState(Control control, InteractiveState state) { ProcessAnyLeftClick(control, state); ProcessAnyLeftRelease(control, state); ProcessAnyMovement(control, state); ProcessAnyDrag(state); }
private void ProcessAnyLeftClick(Control control, InteractiveState state) { if (leftClick != Vector2D.Unused) { state.IsPressed = control.RotatedDrawAreaContains(leftClick); } }
private static void ClickControl(Control control, InteractiveState state) { state.IsPressed = false; control.Click(); if (state.CanHaveFocus) state.WantsFocus = true; }
private static void ClickControl(Control control, InteractiveState state) { control.Click(); if (state.CanHaveFocus) { state.WantsFocus = true; } }
private void ProcessAnyDrag(InteractiveState state) { if (dragStart == Vector2D.Unused) { return; } state.DragStart = dragStart; state.DragEnd = dragEnd; state.DragDone = dragDone; }
private void ProcessAnyMovement(Control control, InteractiveState state) { if (movement == Vector2D.Unused) { return; } state.IsInside = control.RotatedDrawAreaContains(movement); Vector2D rotatedMovement = control.Rotation == 0.0f ? movement : movement.RotateAround(control.RotationCenter, -control.Rotation); state.RelativePointerPosition = control.DrawArea.GetRelativePoint(rotatedMovement); }
private void ProcessAnyLeftRelease(Control control, InteractiveState state) { if (leftRelease == Vector2D.Unused) { return; } if (state.IsPressed && control.RotatedDrawAreaContains(leftRelease) && control.IsVisible) { ClickControl(control, state); } state.IsPressed = false; }
private static void ResetDragForControl(InteractiveState state) { state.DragStart = Vector2D.Unused; state.DragEnd = Vector2D.Unused; state.DragDone = false; }
private void ProcessAnyLeftRelease(Control control, InteractiveState state) { if (leftRelease == Vector2D.Unused) return; if (state.IsPressed && control.RotatedDrawAreaContains(leftRelease) && control.IsVisible) ClickControl(control, state); state.IsPressed = false; }
private void ProcessAnyLeftClick(Control control, InteractiveState state) { if (leftClick != Vector2D.Unused) state.IsPressed = control.RotatedDrawAreaContains(leftClick); }
private void ProcessAnyDrag(InteractiveState state) { if (dragStart == Vector2D.Unused) return; state.DragStart = dragStart; state.DragEnd = dragEnd; state.DragDone = dragDone; }
private void ProcessAnyMovement(Control control, InteractiveState state) { if (movement == Vector2D.Unused) return; state.IsInside = control.RotatedDrawAreaContains(movement); Vector2D rotatedMovement = control.Rotation == 0.0f ? movement : movement.RotateAround(control.RotationCenter, -control.Rotation); state.RelativePointerPosition = control.DrawArea.GetRelativePoint(rotatedMovement); }
private static InteractiveState LoadInteractiveState(BinaryReader reader) { var state = new InteractiveState { IsInside = reader.ReadBoolean(), IsPressed = reader.ReadBoolean(), IsSelected = reader.ReadBoolean(), RelativePointerPosition = new Vector2D(reader.ReadSingle(), reader.ReadSingle()), CanHaveFocus = reader.ReadBoolean(), HasFocus = reader.ReadBoolean(), WantsFocus = reader.ReadBoolean(), DragStart = new Vector2D(reader.ReadSingle(), reader.ReadSingle()), DragEnd = new Vector2D(reader.ReadSingle(), reader.ReadSingle()), DragDone = reader.ReadBoolean() }; return state; }