コード例 #1
0
 private void stackLayer_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     if (sender as LayerIcon != null)
     {
         SelectLayerIcon = sender as LayerIcon;
     }
 }
コード例 #2
0
 public void ClearSelect()
 {
     for (int i = 0; i < stackLayer.Children.Count; i++)
     {
         LayerIcon li = stackLayer.Children[i] as LayerIcon;
         li.UnSelect();
     }
 }
コード例 #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));
     }
 }
コード例 #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;//默认不可缩放
        }
コード例 #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());
 }
コード例 #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;
            }
        }
コード例 #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();
            }
        }
コード例 #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();
            }
        }
コード例 #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;
     }
 }
コード例 #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();
         }
     }
 }
コード例 #11
0
 private void LayerIcon_PointerPressed(object sender, PointerRoutedEventArgs e)
 {
     ClearSelect();
     SelectLayerIcon = sender as LayerIcon;
     SelectLayerIcon.Select();
 }