Exemplo n.º 1
0
 private void stackLayer_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     if (sender as LayerIcon != null)
     {
         SelectLayerIcon = sender as LayerIcon;
     }
 }
Exemplo n.º 2
0
 public void ClearSelect()
 {
     for (int i = 0; i < stackLayer.Children.Count; i++)
     {
         LayerIcon li = stackLayer.Children[i] as LayerIcon;
         li.UnSelect();
     }
 }
Exemplo n.º 3
0
 public void setLayersZIndex()
 {
     for (int i = 0; i < stackLayer.Children.Count; i++)
     {
         LayerIcon  li = stackLayer.Children[i] as LayerIcon;
         PhotoLayer pl = li.getLayer();
         Canvas.SetZIndex(pl, stackLayer.Children.Count - stackLayer.Children.IndexOf(li));
     }
 }
Exemplo n.º 4
0
    {                                             //support photo load and scale/rotate/transform
        //support draw some geometry
        //mergin layer
        public PhotoLayer()
        {
            InitializeComponent();
            li         = new LayerIcon(this);
            acm        = new ActionMove(this, this);
            acm.Enable = false;

            ar        = new ActionResize(Layer, Layer, new LynxResized(_Resized));
            ar.Enable = false;//默认不可缩放
        }
Exemplo n.º 5
0
 public void AddLayer(PhotoLayer o)//层永远加在最上面
 {
     setLayersZIndex();
     Canvas.SetZIndex(o, pc.getLayers().Children.Count);
     SelectLayerIcon              = new LayerIcon(o);
     SelectLayerIcon.selectLayer += new LayerEventHandler(SelectLayerIcon_selectLayer);
     o.Selected();
     //li.Init(o);
     SelectLayerIcon.PointerPressed  += new PointerEventHandler(LayerIcon_PointerPressed);
     SelectLayerIcon.PointerReleased += new PointerEventHandler(LayerIcon_PointerReleased);
     stackLayer.Children.Add(SelectLayerIcon);
     pc.PhotoLayers.Children.Add(SelectLayerIcon.getLayer());
 }
Exemplo n.º 6
0
        //public void SelectLayer(LayerIcon li)
        //{
        //    pc.SelectLayer = li.getLayer();

        //}

        public void CutLayer()
        {
            pc.PhotoLayers.Children.Remove(SelectLayerIcon.getLayer());
            stackLayer.Children.Remove(SelectLayerIcon);
            if (stackLayer.Children.Count != 0)
            {
                SelectLayerIcon = stackLayer.Children[0] as LayerIcon;
                setLayersZIndex();
            }
            else
            {
                pc.SelectLayer = null;
            }
        }
Exemplo n.º 7
0
        private void LayerIcon_PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            LayerIcon tli = sender as LayerIcon;

            if (tli != SelectLayerIcon)
            {
                if (stackLayer.Children.Contains(SelectLayerIcon))
                {
                    stackLayer.Children.Remove(SelectLayerIcon);
                }
                stackLayer.Children.Insert(stackLayer.Children.IndexOf(tli), SelectLayerIcon);
                setLayersZIndex();
            }
        }
Exemplo n.º 8
0
        public void ReadLayers()
        {
            Canvas ls = pc.getLayers();

            stackLayer.Children.Clear();
            for (int i = 0; i < ls.Children.Count; i++)
            {
                PhotoLayer pl = ls.Children[i] as PhotoLayer;
                stackLayer.Children.Add(pl.li);
                pl.li.ReadInfor();
                LayerIcon li = stackLayer.Children[i] as LayerIcon;
                li.selectLayer += new LayerEventHandler(SelectLayerIcon_selectLayer);
                li.ReadInfor();
            }
        }
Exemplo n.º 9
0
 public void DeleteLayer()
 {
     pc.PhotoLayers.Children.Remove(SelectLayerIcon.getLayer());
     stackLayer.Children.Remove(SelectLayerIcon);
     SelectLayerIcon.selectLayer     -= new LayerEventHandler(SelectLayerIcon_selectLayer);
     SelectLayerIcon.PointerPressed  -= new PointerEventHandler(LayerIcon_PointerPressed);
     SelectLayerIcon.PointerReleased -= new PointerEventHandler(LayerIcon_PointerReleased);
     if (stackLayer.Children.Count != 0)
     {
         SelectLayerIcon = stackLayer.Children[0] as LayerIcon;
         setLayersZIndex();
     }
     else
     {
         pc.SelectLayer = null;
     }
 }
Exemplo n.º 10
0
 void SelectLayerIcon_selectLayer(object sender, LynxPhotoLayerEventArgs e)
 {
     if (e.IsSelected)
     {
         ClearSelect();
         e.currentIcon.Select();
         SelectLayerIcon = e.currentIcon;
     }
     else
     {
         if (e.currentIcon != SelectLayerIcon)
         {
             if (stackLayer.Children.Contains(SelectLayerIcon))
             {
                 stackLayer.Children.Remove(SelectLayerIcon);
             }
             stackLayer.Children.Insert(stackLayer.Children.IndexOf(e.currentIcon), SelectLayerIcon);
             setLayersZIndex();
         }
     }
 }
Exemplo n.º 11
0
 private void LayerIcon_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     ClearSelect();
     SelectLayerIcon = sender as LayerIcon;
     SelectLayerIcon.Select();
 }