示例#1
0
        public static void up(MouseButtonEventArgs e, InkPresenter inkCanvas, Grid LayoutRoot)
        {
            dragStarted = false;

            if (clickedLayer != -1 && !inkClicked)
            {
                WriteableBitmap tempWb = new WriteableBitmap((BitmapSource)MainPage.layerList[clickedLayer].img.Source);
                Image img = MainPage.layerList[clickedLayer].img;

                //redraw
                redrawMovedImage(tempWb, img);

                if (outOfBound)
                {
                    backupImage();
                }

                //find the new img to border dist
                Common.findNewImageToBorderDist(img, e, inkCanvas, clickedLayer, offSetLeft, offSetRight, offSetTop, offSetBottom, MainPage.layerList[clickedLayer].imageToBorderDist[LEFT], MainPage.layerList[clickedLayer].imageToBorderDist[RIGHT], MainPage.layerList[clickedLayer].imageToBorderDist[TOP], MainPage.layerList[clickedLayer].imageToBorderDist[BOTTOM]);
                //Common.calculateMax(img, e, inkCanvas, clickedLayer);
                Common.checkIfOutOfBound(e, inkCanvas, img, clickedLayer, imageBackup, offSetLeft, offSetRight, offSetTop, offSetBottom, MainPage.layerList[clickedLayer].imageToBorderDist[LEFT], MainPage.layerList[clickedLayer].imageToBorderDist[RIGHT], MainPage.layerList[clickedLayer].imageToBorderDist[TOP], MainPage.layerList[clickedLayer].imageToBorderDist[BOTTOM]);
                MainPage.layerList[clickedLayer].img.Margin = new Thickness();
            }
            else if (inkClicked)
            {

                for (int i = 0; i < ipToMove.Strokes.Count; i++)
                {
                    StylusPointCollection spcTemp = new StylusPointCollection();
                    Stroke newStroke = new Stroke();

                    placeInkBackToOriginalInkPresenter(inkCanvas, i, spcTemp, newStroke);

                }

                LayoutRoot.Children.Remove(ipToMove);

                inkClicked = false;

            }

            //if (clickedLayer != -1)
            //{
            //	MainPage.layerList[clickedLayer].img.Margin = new Thickness();

            //	//calculate img to border dist
            //	Image img = new Image();
            //	img.Source = imageBackup;
            //	Common.findNewImageToBorderDist(img, e, inkCanvas, clickedLayer, offSetLeft, offSetRight, offSetTop, offSetBottom, MainPage.layerList[clickedLayer].imageToBorderDist[LEFT], MainPage.layerList[clickedLayer].imageToBorderDist[RIGHT], MainPage.layerList[clickedLayer].imageToBorderDist[TOP], MainPage.layerList[clickedLayer].imageToBorderDist[BOTTOM]);
            //	//Common.calculateMax(img, e, inkCanvas, clickedLayer);
            //}

            inkCanvas.ReleaseMouseCapture();
        }
示例#2
0
 public static void up(MouseButtonEventArgs e, InkPresenter inkCanvas)
 {
     newStroke = null;
     inkCanvas.ReleaseMouseCapture();
 }