Esempio n. 1
0
 /// <summary>
 ///		Cambia el tamaño de un control
 /// </summary>
 private void ExecuteResize(TimeLineModel timeLine, FrameworkElement control, ResizeActionModel action)
 {
     if (CheckMustAnimate(action))
     {
         if (action.Width != null)
         {
             CreateDoubleAnimation(control, null, action.Width ?? 100,
                                   new PropertyPath(ComicPageView.PageWidthProperty), action);
         }
         if (action.Height != null)
         {
             CreateDoubleAnimation(control, null, action.Height ?? 100,
                                   new PropertyPath(ComicPageView.PageHeightProperty), action);
         }
     }
     else
     {
         if (action.Width != null)
         {
             ComicPageView.SetPageWidth(control, action.Width ?? 100);
         }
         if (action.Height != null)
         {
             ComicPageView.SetPageHeight(control, action.Height ?? 100);
         }
     }
 }
Esempio n. 2
0
 /// <summary>
 ///		Añade un control
 /// </summary>
 private void AddControl(UIElement control, AbstractPageItemModel pageItem)
 {
     // Le asigna la clave al control
     (control as FrameworkElement).Tag = pageItem.Key;
     // Cambia la visibilidad y opacidad del control
     if (pageItem.Visible)
     {
         control.Opacity = 1;
     }
     else
     {
         control.Opacity = 0;
     }
     if (pageItem.Opacity != 0)
     {
         control.Opacity = pageItem.Opacity;
     }
     // Inicializa un grupo de transformaciones
     control.RenderTransform = new TransformGroup();
     // Asigna las propiedades
     ComicPageView.SetPageTop(control, pageItem.Dimensions.TopDefault);
     ComicPageView.SetPageLeft(control, pageItem.Dimensions.LeftDefault);
     ComicPageView.SetPageWidth(control, pageItem.Dimensions.WidthDefault);
     ComicPageView.SetPageHeight(control, pageItem.Dimensions.HeightDefault);
     Grid.SetZIndex(control, pageItem.ZIndex);
     // Añade el control a la vista
     Children.Add(control);
     // Añade el adorno si es necesario
     if (ShowAdorners)
     {
         AdornerLayer.GetAdornerLayer(control)?.Add(new FourCornersAdorner(control));
     }
 }
Esempio n. 3
0
        /// <summary>
        ///		Ejecuta la traslación de un elemento
        /// </summary>
        private void ExecuteTranslate(FrameworkElement control, TranslateActionModel action)
        {
            TransformGroup group          = (TransformGroup)control.RenderTransform;
            int            indexTranslate = -1;

            // Crea la transformación de rotación si no existe
            foreach (Transform transform in group.Children)
            {
                if (transform is TranslateTransform)
                {
                    indexTranslate = group.Children.IndexOf(transform);
                }
            }
            // Crea la animación
            if (indexTranslate < 0)
            {
                group.Children.Add(new TranslateTransform(0, 0));
                indexTranslate = group.Children.Count - 1;
            }
            // Añade la traslación del elemento
            if (CheckMustAnimate(action))
            {
                if (action.Top != null)
                {
                    CreateDoubleAnimation(control, null, action.Top,
                                          new PropertyPath(ComicPageView.PageTopProperty),
                                          action);
                }
                if (action.Left != null)
                {
                    CreateDoubleAnimation(control, null, action.Left,
                                          new PropertyPath(ComicPageView.PageLeftProperty),
                                          action);
                }
            }
            else
            {
                // Elimina la traslación
                group.Children.RemoveAt(indexTranslate);
                // Añade la traslación
                if (action.Left != null)
                {
                    ComicPageView.SetPageLeft(control, action.Left ?? 0);
                }
                if (action.Top != null)
                {
                    ComicPageView.SetPageTop(control, action.Top ?? 0);
                }
            }
        }
Esempio n. 4
0
 internal TimeLineProcessor(ComicPageView comicPageView, bool useAnimation)
 {
     PageView     = comicPageView;
     UseAnimation = useAnimation;
 }