public void ScrollToNotRaiseScrollChangedEvent(int x, int y, out UIScrollEventArgs hScrollEventArgs, out UIScrollEventArgs vScrollEventArgs) { hScrollEventArgs = null; vScrollEventArgs = null; if (x > rootGraphics.Width - viewportWidth) { x = rootGraphics.Width - viewportWidth; } if (x < 0) { x = 0; } if (y < 0) { y = 0; } else if (y > 0) { if (y > rootGraphics.Height - viewportHeight) { y = rootGraphics.Height - viewportHeight; if (y < 0) { y = 0; } } } int old_y = viewportY; viewportX = x; viewportY = y; vScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_y, viewportY, UIScrollOrientation.VerticalScroll); CalculateCanvasPages(); }
void viewport_VScrollChanged(object sender, UIScrollEventArgs e) { if (VScrollChanged != null) { VScrollChanged.Invoke(sender, e); } }
public void RaiseProperEvents(UIScrollEventArgs hScrollEventArgs, UIScrollEventArgs vScrollEventArgs) { if (this.VScrollChanged != null && vScrollEventArgs != null) { VScrollChanged.Invoke(owner, vScrollEventArgs); } if (this.HScrollChanged != null && hScrollEventArgs != null) { HScrollChanged.Invoke(owner, hScrollEventArgs); } }
public void ScrollByNotRaiseEvent(int dx, int dy, out UIScrollEventArgs hScrollEventArgs, out UIScrollEventArgs vScrollEventArgs) { vScrollEventArgs = null; if (dy < 0) { int old_y = viewportY; if (viewportY + dy < 0) { dy = -viewportY; viewportY = 0; } else { viewportY += dy; } vScrollEventArgs = new UIScrollEventArgs( UIScrollEventType.ThumbPosition, old_y, viewportY, UIScrollOrientation.VerticalScroll); } else if (dy > 0) { int old_y = viewportY; int viewportButtom = viewportY + viewportHeight; if (viewportButtom + dy > rootGraphics.Height) { if (viewportButtom < rootGraphics.Height) { viewportY = rootGraphics.Height - viewportHeight; } } else { viewportY += dy; } vScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_y, viewportY, UIScrollOrientation.VerticalScroll); } hScrollEventArgs = null; if (dx == 0) { } else if (dx > 0) { int old_x = viewportX; int viewportRight = viewportX + viewportWidth; if (viewportRight + dx > rootGraphics.Width) { if (viewportRight < rootGraphics.Width) { viewportX = rootGraphics.Width - viewportWidth; } } else { viewportX += dx; } hScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_x, viewportX, UIScrollOrientation.HorizontalScroll); } else { int old_x = viewportX; if (old_x + dx < 0) { dx = -viewportX; viewportX = 0; } else { viewportX += dx; } hScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_x, viewportX, UIScrollOrientation.HorizontalScroll); } CalculateCanvasPages(); }
void MyScrollByNotRaiseEvent(int dx, int dy, out UIScrollEventArgs hScrollEventArgs, out UIScrollEventArgs vScrollEventArgs) { vScrollEventArgs = null; Size innerContentSize = this.InnerContentSize; if (dy < 0) { int old_y = this.ViewportY; if (ViewportY + dy < 0) { dy = -ViewportY; this.SetViewport(this.ViewportX, 0); } else { this.SetViewport(this.ViewportX, this.ViewportY + dy); } if (this.vscrollableSurface != null && scrollRelation.HasVScrollChanged) { vScrollEventArgs = new UIScrollEventArgs( UIScrollEventType.ThumbPosition, old_y, ViewportY, UIScrollOrientation.VerticalScroll); } } else if (dy > 0) { int old_y = ViewportY; int viewportButtom = ViewportY + Height; if (viewportButtom + dy > innerContentSize.Height) { if (viewportButtom < innerContentSize.Height) { this.SetViewport(this.ViewportX, innerContentSize.Height - Height); } } else { this.SetViewport(this.ViewportX, innerContentSize.Height + dy); } if (vscrollableSurface != null && scrollRelation.HasVScrollChanged) { vScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_y, this.ViewportY, UIScrollOrientation.VerticalScroll); } } hScrollEventArgs = null; if (dx == 0) { } else if (dx > 0) { int old_x = this.ViewportX; int viewportRight = ViewportX + Width; if (viewportRight + dx > innerContentSize.Width) { if (viewportRight < innerContentSize.Width) { this.SetViewport(innerContentSize.Width - Width, this.ViewportY); } } else { this.SetViewport(this.ViewportX + dx, this.ViewportY); } if (vscrollableSurface != null && scrollRelation.HasHScrollChanged) { hScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_x, ViewportX, UIScrollOrientation.HorizontalScroll); } } else { int old_x = this.ViewportX; if (old_x + dx < 0) { dx = -ViewportX; SetViewport(0, this.ViewportY); } else { SetViewport(this.ViewportX + dx, this.ViewportY); } if (vscrollableSurface != null && scrollRelation.HasHScrollChanged) { hScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_x, this.ViewportX, UIScrollOrientation.HorizontalScroll); } } if (vscrollableSurface != null) { vscrollableSurface.QuadPagesCalculateCanvas(); vscrollableSurface.FullModeUpdate = true; } }
void MyScrollToNotRaiseEvent(int x, int y, out UIScrollEventArgs hScrollEventArgs, out UIScrollEventArgs vScrollEventArgs) { hScrollEventArgs = null; vScrollEventArgs = null; Size innerContentSize = this.InnerContentSize; if (x < 0) { x = 0; } else if (x > 0) { if (x > innerContentSize.Width - Width) { x = innerContentSize.Width - Width; if (x < 0) { x = 0; } } } if (y < 0) { y = 0; } else if (y > 0) { if (y > innerContentSize.Height - Height) { y = innerContentSize.Height - Height; if (y < 0) { y = 0; } } } if (vscrollableSurface == null) { this.InvalidateGraphics(); this.SetViewport(x, y); this.InvalidateGraphics(); } else { if (ViewportX != x && scrollRelation.HasHScrollChanged) { hScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, this.ViewportX, x, UIScrollOrientation.HorizontalScroll); } if (ViewportY != y && scrollRelation.HasVScrollChanged) { vScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, this.ViewportY, y, UIScrollOrientation.VerticalScroll); } this.SetViewport(x, y); vscrollableSurface.QuadPagesCalculateCanvas(); vscrollableSurface.FullModeUpdate = true; this.InvalidateGraphics(); vscrollableSurface.FullModeUpdate = false; } }
public void ScrollByNotRaiseEvent(int dx, int dy, out UIScrollEventArgs hScrollEventArgs, out UIScrollEventArgs vScrollEventArgs) { vScrollEventArgs = null; if (dy < 0) { int old_y = _viewportY; if (_viewportY + dy < 0) { dy = -_viewportY; _viewportY = 0; } else { _viewportY += dy; } vScrollEventArgs = new UIScrollEventArgs( UIScrollEventType.ThumbPosition, old_y, _viewportY, UIScrollOrientation.VerticalScroll); } else if (dy > 0) { int old_y = _viewportY; int viewportButtom = _viewportY + _viewportHeight; // if (viewportButtom + dy > _rootgfx.Height) { if (viewportButtom < _rootgfx.Height) { _viewportY = _rootgfx.Height - _viewportHeight; } } else { _viewportY += dy; } vScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_y, _viewportY, UIScrollOrientation.VerticalScroll); } hScrollEventArgs = null; if (dx == 0) { } else if (dx > 0) { int old_x = _viewportX; int viewportRight = _viewportX + _viewportWidth; if (viewportRight + dx > _rootgfx.Width) { if (viewportRight < _rootgfx.Width) { _viewportX = _rootgfx.Width - _viewportWidth; } } else { _viewportX += dx; } hScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_x, _viewportX, UIScrollOrientation.HorizontalScroll); } else { int old_x = _viewportX; if (old_x + dx < 0) { dx = -_viewportX; _viewportX = 0; } else { _viewportX += dx; } hScrollEventArgs = new UIScrollEventArgs(UIScrollEventType.ThumbPosition, old_x, _viewportX, UIScrollOrientation.HorizontalScroll); } CalculateCanvasPages(); }