protected void OnRotationChanged(int rotation)
        {
            var currentRotation = DeviceRotation.Unknown;

            switch (rotation / 45)
            {
            case 0:
            case 7:
                currentRotation = DeviceRotation.Portrait;
                break;

            case 1:
            case 2:
                currentRotation = DeviceRotation.Landscape;
                break;

            case 3:
            case 4:
                currentRotation = DeviceRotation.ReversePortrait;
                break;

            case 5:
            case 6:
                currentRotation = DeviceRotation.ReverseLandscape;
                break;
            }

            if (DeviceRotation != currentRotation)
            {
                DeviceRotation = currentRotation;
                RotationChanged?.Invoke(this, EventArgs.Empty);
            }
        }
Example #2
0
 protected virtual void OnRotationChanged(ValueChangedEventArgs e)
 {
     if (!_externallySet)
     {
         RotationChanged?.Invoke(this, e);
     }
 }
 public void SendRotationChangedEvent()
 {
     if (RotationChanged != null)
     {
         RotationChanged.Invoke();
     }
 }
Example #4
0
        /// <summary>
        /// Creates and initializes a new instance of the Window class.
        /// </summary>
        /// <param name="parent">
        /// Parent widget which this window is created on.
        /// </param>
        /// <param name="name">
        /// Window name.
        /// </param>
        /// <param name="type">
        /// Window type.
        /// </param>
        /// <remarks>
        /// Window constructor.show window indicator, set callback
        /// when closing the window in any way outside the program control,
        /// and set callback when window rotation is changed.
        /// </remarks>
        /// <since_tizen> preview </since_tizen>
        public Window(Window parent, string name, WindowType type)
        {
            Name = name;
            Type = type;
            Realize(parent);
            IndicatorMode = IndicatorMode.Show;

            _deleteRequest       = new SmartEvent(this, "delete,request");
            _rotationChanged     = new SmartEvent(this, "wm,rotation,changed");
            _deleteRequest.On   += (s, e) => CloseRequested?.Invoke(this, EventArgs.Empty);
            _rotationChanged.On += (s, e) => RotationChanged?.Invoke(this, EventArgs.Empty);
        }
Example #5
0
 private void OnRotationChanged()
 {
     RotationChanged?.Invoke(Rotation);
     TransformChanged?.Invoke(this);
 }
Example #6
0
 /// <summary>
 ///     Raises the <see cref="RotationChanged" /> event.
 /// </summary>
 /// <seealso cref="EventArgs" />
 protected virtual void OnRotationChanged()
 {
     RotationChanged?.Invoke(this, EventArgs.Empty);
 }
 private void OnRotationChanged(SyncObject obj)
 {
     RotationChanged.RaiseEvent();
 }
Example #8
0
        private void PositionChange(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "Size":
                if (ScaleReference == Vector2i.Zero)
                {
                    ScaleReference = Size;
                }
                SizeChanged?.Invoke(this, EventArgs.Empty);
                goto case "InvalidateMatrix";

            case "ScaleWithParent":
            case "ScaleSize":
                SizeChanged?.Invoke(this, EventArgs.Empty);
                goto case "InvalidateMatrix";

            case "ScalePosition":
            case "Origin":
            case "Anchor":
            case "Position":
                PositionChanged?.Invoke(this, EventArgs.Empty);
                goto case "InvalidateMatrix";

            case "RotationCenter":
            case "Rotation":
                RotationChanged?.Invoke(this, EventArgs.Empty);
                goto case "InvalidateMatrix";

            case "CustomOrigin":
                if (Origin != Anchor.Custom)
                {
                    return;
                }
                PositionChanged?.Invoke(this, EventArgs.Empty);
                goto case "InvalidateMatrix";

            case "CustomAnchor":
                if (Anchor != Anchor.Custom)
                {
                    return;
                }
                PositionChanged?.Invoke(this, EventArgs.Empty);
                goto case "InvalidateMatrix";

            case "RotationCustomCenter":
                if (RotationCenter != Anchor.Custom)
                {
                    return;
                }
                RotationChanged?.Invoke(this, EventArgs.Empty);
                goto case "InvalidateMatrix";

            case "InvalidateMatrix":
                if (State == ResourceState.NotLoaded)
                {
                    return;
                }

                Invalidate("Transformation", InvalidationDirection.Children);
                Invalidate("Graphics", InvalidationDirection.Both);
                break;
            }
        }
Example #9
0
        //---------------------------------------------------------------------------

        private void OnRotationChanged(float oldRotation, float newRotation)
        {
            RotationChanged?.Invoke(oldRotation, newRotation);
        }
Example #10
0
 public void RaiseRotationChanged(object sender, EventArgs e)
 {
     RotationChanged?.Invoke(sender, e);
 }
Example #11
0
 private static void RotationPanel_ValueChanged(object sender, Events.RotationEventArgs e)
 {
     RotationChanged?.Invoke(sender, e);
 }
 /// <summary>
 /// Invokes methods attached to RotationChanged event.
 /// </summary>
 /// <param name="args">Rotary arguments.</param>
 private void OnRotaryChange(RotaryEventArgs args)
 {
     RotationChanged?.Invoke(null, args.IsClockwise);
 }
Example #13
0
        void OnSceneGUI(SceneView obj)
        {
            if (CurrentPropertyPath == default)
            {
                return;
            }

            EditorGUI.BeginChangeCheck();

            var gizmoTransform = m_GizmoObject.transform;
            var localMode      = Tools.pivotRotation == PivotRotation.Local || m_PreviewTarget == null;

            switch (Mode)
            {
            case GizmoMode.Move:
            {
                var currentPosition = (localMode && m_PreviewTarget != null) ? gizmoTransform.localPosition + m_PreviewTarget.transform.position : gizmoTransform.position;
                var currentRotation = localMode ? gizmoTransform.localRotation : gizmoTransform.rotation;

                var newPosition = Handles.PositionHandle(currentPosition, currentRotation);

                if (m_PreviewTarget != null)
                {
                    if (localMode)
                    {
                        newPosition = newPosition - m_PreviewTarget.transform.position;
                    }
                    else
                    {
                        newPosition = m_PreviewTarget.transform.InverseTransformPoint(newPosition);
                    }
                }

                if (EditorGUI.EndChangeCheck())
                {
                    m_Transform.t = newPosition;
                    gizmoTransform.localPosition = newPosition;
                    PositionChanged?.Invoke(newPosition);
                    gizmoTransform.hasChanged = false;
                }
                break;
            }

            case GizmoMode.Rotate:
            case GizmoMode.RotateNormal:
            {
                Quaternion newRotation = Handles.RotationHandle(localMode ? gizmoTransform.localRotation : gizmoTransform.rotation, gizmoTransform.position);

                if (Mode == GizmoMode.RotateNormal)
                {
                    var savedColor = Handles.color;
                    Handles.color = Color.yellow;
                    Handles.ArrowHandleCap(0, gizmoTransform.position, localMode ? gizmoTransform.localRotation : gizmoTransform.rotation, HandleUtility.GetHandleSize(gizmoTransform.position) * 1.1f, EventType.Repaint);
                    Handles.color = savedColor;
                }

                if (m_PreviewTarget != null && !localMode)
                {
                    newRotation = Quaternion.Inverse(m_PreviewTarget.transform.rotation) * newRotation;
                }

                if (EditorGUI.EndChangeCheck())
                {
                    m_Transform.q = newRotation;
                    gizmoTransform.localRotation = newRotation;
                    RotationChanged?.Invoke(newRotation);
                    gizmoTransform.hasChanged = false;
                }
                break;
            }
            }
        }
Example #14
0
 public void OnRotationChanged(DeviceRotation rotation)
 {
     RotationChanged?.Invoke(this, rotation);
 }