예제 #1
0
        private void OnMouseDragStart(object sender, MouseDragEventArgs e)
        {
            Point position = e.GetPosition(this);
            int   index    = this.CurrentPage - this.PagePosition(this.CurrentPage);

            if (((this.Orientation == System.Windows.Controls.Orientation.Horizontal) && (position.X > (base.RenderSize.Width / 2.0))) || ((this.Orientation == null) && (position.Y > (base.RenderSize.Height / 2.0))))
            {
                index++;
            }
            this._dragged = base.ItemContainerGenerator.ContainerFromIndex(index) as BookItem;
            if (this._dragged != null)
            {
                BookItem item = this.Back(this._dragged);
                if (item == null)
                {
                    this._dragged = null;
                }
                else
                {
                    this.InstantUndoFold();
                    this._dragged.TransitionFront = false;
                    item.TransitionFront          = true;
                    this._dragged.DragStart       = item.DragStart = this._dragged.DragCurrent = item.DragCurrent = new Vector2(position) / base.RenderSize;
                    this.SortPages(this.PagePosition(index) == 1);
                    this.BeginRendering();
                    if (this.DragPageStarted != null)
                    {
                        this.DragPageStarted(this, EventArgs.Empty);
                    }
                }
            }
        }
예제 #2
0
 private void OnMouseDragEnd(object sender, MouseDragEventArgs e)
 {
     if (this._dragged != null)
     {
         BookItem item      = this.Back(this._dragged);
         Vector2  dragStart = this._dragged.DragStart;
         Vector2  vector2   = new Vector2(e.GetPosition(this)) / base.RenderSize;
         Vector2  vector3   = new Vector2(0.5, 0.5);
         if (((this.Orientation == System.Windows.Controls.Orientation.Horizontal) && (Math.Sign((double)(vector2.X - vector3.X)) != Math.Sign((double)(this._dragged.DragStart.X - vector3.X)))) || ((this.Orientation == null) && (Math.Sign((double)(vector2.Y - vector3.Y)) != Math.Sign((double)(this._dragged.DragStart.Y - vector3.Y)))))
         {
             dragStart        = VectorHelper.Symmetry(new Size(1.0, 1.0), item.Direction, dragStart);
             dragStart        = VectorHelper.Flip(new Size(1.0, 1.0), this._dragged.Direction, dragStart);
             this.CurrentPage = base.ItemContainerGenerator.IndexFromContainer(item);
         }
         BookItem backItem = this.Back(this._dragged);
         if (LinearTransition(this._dragged, backItem, (double)0.0, dragStart))
         {
             this.BeginRendering();
         }
         this._dragged = null;
         if (this.DragPageFinished != null)
         {
             this.DragPageFinished(this, new BookDragPageFinishedEventArgs(this.CurrentPage));
         }
     }
 }
예제 #3
0
 private void OnMouseDragMove(object sender, MouseDragEventArgs e)
 {
     if (this._dragged != null)
     {
         this.Back(this._dragged).DragCurrent = this._dragged.DragCurrent = new Vector2(e.GetPosition(this)) / base.RenderSize;
         this.BeginRendering();
     }
 }