예제 #1
0
        protected override void OnPointerWheelChanged(PointerRoutedEventArgs e)
        {
            base.OnPointerWheelChanged(e);
            if (e == null || m_transform == null)
            {
                return;
            }

            if (Render == null)
            {
                return;
            }

            e.Handled = true;
            var pointer = e.GetCurrentPoint(Parent as Canvas);

            if (e.KeyModifiers == Windows.System.VirtualKeyModifiers.Control)
            {
                var s = (1 + (float)pointer.Properties.MouseWheelDelta / 2400.0f);

                m_transform.ScaleX *= s;
                m_transform.ScaleY *= s;
                Render.Scale       *= s;
            }

            CompositeTransformChange?.Invoke(this);
        }
예제 #2
0
        protected override void OnManipulationDelta(ManipulationDeltaRoutedEventArgs e)
        {
            base.OnManipulationDelta(e);
            if (e == null || m_transform == null)
            {
                return;
            }

            if (Render == null)
            {
                return;
            }

            e.Handled = true;

            m_transform.ScaleX *= e.Delta.Scale;
            m_transform.ScaleY *= e.Delta.Scale;

            m_transform.Rotation += e.Delta.Rotation;

            m_transform.TranslateX += e.Delta.Translation.X;
            m_transform.TranslateY += e.Delta.Translation.Y;

            Render.Left = m_transform.TranslateX;
            Render.Top  = m_transform.TranslateY;

            CompositeTransformChange?.Invoke(this);
        }